Third experiment, Linux system administration and user configuration VIM

Third experiment Linux system user management and configuration VIM

project content
This work belongs courses Class Course Home
Where this requirement in the job Work requirements
Student ID - Name 17043123- summer 财文
Job learning objectives 1. Learning 2. Learning Linux system user management and configuration using vim
  1. Linux User Management

Q: Why should avoid using the Linux system root user login?

A: root privileges is the highest in the system, avoid using the root account login is afraid of misuse root cause huge disaster, then is afraid that he might have malicious software, or the software itself is defective, it will cause great loss .

1) How to view the current user's information in three files related to the user's?
cat / etc / passwd | grep xia # View the information of the user xia

Please briefly describe these three documents?

1./etc/passwd file: the user's profile.

2./etc/group file: User group configuration file that all of the information user groups are stored in this file.

3./etc/shadow file: password configuration file for password information storage Linux system users.

2) view the current user-related information id command

 

 Please briefly describe the output?

A: uid refers to the user's user id, gid refers to the group id.

xia number of uid = 1000, gid number = 1000.

User group: gid number of amd = 4, cdrom a GID number = 24, sudo a GID number = 27, dip the GID number = 30, plugdev a GID number = 46, Ipadmin a GID number = 108, sambashare a GID number = 124.

root user UID, GID = 0

3) Create two accounts, an account for the test, the other account begins with a capital E add your own student number ending in four and two respectively account password and administrator rights, after account setup is complete, simply switching the account to view information , delete the test account, leaving the other account for subsequent operation.

a) Create an account

 

 b) Set Password

 

 c) set permissions

 

 d) switching the account

 

 e) delete the account test

 

 2.VIM simple configuration

a) switch to the newly created account reserved

b) VIM create a configuration file in the user's home directory .vimrc

 

 

 c) Open the file and add the following

the SET Number The           " show line numbers   

ON syntax            " syntax highlighting 
the SET cursorline      
SET ruler A            " display ruler   
SET showcmd          " command input is displayed, see more clearly   SET scrolloff = 3 " cursor row distance holder 3 to the top and bottom of the buffer   SET novisualbell     " Do scintillator (not understand)   SET statusline =% F% m% r % h% w \ [FORMAT =% {& ff}] \ [TYPE =% Y] \ [POS =% l,% v] [% p %%] \% {strftime (\ " % D /% m /% Y \ - \% H:% m \")}    " the contents of the status line shows  
     


the SET nocompatible                " remove VIM consistency, must "
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
set fileencoding=utf-8
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""新文件标题
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" New .c, .h, .sh, .java files, automatically insert the file header

autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()" 
"" Defined functions SetTitle, automatically inserted header
func SetTitle() 
    " If the file type is .sh file 
IF & filetype == ' SH ' 
        call setline(1,"\#########################################################################") 
        call append(line("."), "\# File Name: ".expand("%")) 
        call append(line(".")+1, "\# Author: liq") 
        call append(line(".")+2, "\# mail: [email protected] ") 
        call append(line(".")+3, "\# Created Time: ".strftime("%c")) 
        call append(line(".")+4, "\#########################################################################") 
        call append(line(".")+5, "\#!/bin/bash") 
        call append(line(".")+6, "") 
    else 
        call setline(1, "/*************************************************************************") 
        call append(line("."), "    > File Name: ".expand("%")) 
        call append(line(".")+1, "    > Author: xia") 
        call append(line(".")+2, "    > Mail: [email protected]") 
        call append(line(".")+3, "    > Created Time: ".strftime("%c")) 
        call append(line(".")+4, " ************************************************************************/") 
        call append(line(".")+5, "")
    endif
    if &filetype == 'cpp'
        call append(line(".")+6, "#include<iostream>")
        call append(line(".")+7, "using namespace std;")
        call append(line(".")+8, "")
    endif
    if &filetype == 'c'
        call append(line(".")+6, "#include<stdio.h>")
        call append(line(".")+7, "")
    endif
    " After the new document, automatically navigate to the end of the file

    autocmd BufNewFile * normal G
endfunc 
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set autoindent      " 自动缩进
set cindent
SET TabStop = . 4         " the Tab key width 
SET softtabstop = . 4 " Unified indent. 4 SET shiftwidth = . 4       

the SET noexpandtab          " Do not use spaces instead of tabs, 
the SET smarttab             " line and the beginning of the paragraph with tabs the SET showmatch

the SET History = 1000         " History number of 
the SET nobackup             " prohibit generate temporary files the SET noswapfile

the SET ignorecase           " search Ignore case 
the SET hlsearch             " search-by-character highlight the SET incsearch

SET gdefault             " Alternatively the line 
SET langmenu = zh_CN.UTF- . 8 " language setting SET helplang = CN        

SET laststatus = 2                 " is always displayed in the status line

ON filetype                      " detect file types

ON plugin filetype           " loading filetype plugin

indent ON filetype           " load a specific file type indent file 
the SET iskeyword + = _, $, @,%, #, -       " a word with the following symbols are not to be divided wrap the SET linespace = 0 " between the characters inserted the number of pixel rows SET wildmenu         " enhanced mode automatically operating command SET Backspace = 2 " that the backspace (Backspace) normal processing indent, eol, start other SET whichwrap + = <,>, H, L       " allow backspace and cursor keys across the boundary line SET mouse = a      " can use the mouse anywhere in the buffer (similar to double-clicking the mouse is positioned at office workspace) SET Selection =
         

     


exclusive
set selectmode=mouse,key
" Autocomplete

: inoremap (() <ESC> is
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {<CR>}<ESC>O
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i

function! ClosePair(char)
    if getline('.')[col('.') - 1] == a:char
        return "\<Right>"
    else
        return a:char
    endif
endfunction
the SET completeopt = longest, the MENU     " to open the file type detection, add the phrase before they can use intelligent completion

 

  


d) Create and open a file that ends in .c

 

 

 

 

Guess you like

Origin www.cnblogs.com/0218l/p/12526777.html