Third experiment linux user management and system configuration VIM

Third experiment linux user management and system configuration VIM

project content
This work belongs courses Course link (Click to view)
Where this requirement in the job Operational requirements link (Click to view)
Student ID - Name 17043206- Yang Hua
Job learning objectives 1. Learning 2. Learning Linux system user management and configuration using vim

1.Linux user management short answer: Linux System Why should avoid using root user login?

A: 1, because the root user's permissions too high, to avoid using root user login to the system to avoid the harm caused by misuse.

operating

(1) how the three files related to the user's

cat / etc / passwd | grep toad # yh display line contains the / etc / passwd in

Please briefly describe these three documents?

/ etc / passwd saved in this file is the primary information system for all users and users.

/ etc / group file on the system administrator to manage users and groups.

/ etc / shadow which is a shadow passwd file, rows / etc / shadow file with the / etc / passwd in one to one correspondence, it is commanded by pwconv The / etc / passwd data is automatically generated.

(2) view the current user-related information id command

Please briefly describe the output.

Yh user's UID = 1000, GID = 1000

yh members of the group:

The GID number yh = 1000 ADM's GID number ** = . 4 CDROM 's GID number = 24 the sudo the GID number = 27 DIP 's GID number = 30 the plugdev the GID number = 46 is the lpadmin a GID number = 1 16 SambaShare the GID number = 126

(3) to 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 the account set up, simple to switch accounts to view after the message, delete the test account, leaving the other account for subsequent operation.

a) Create an account

b) Set Password

c) set permissions

Please briefly describe the concept of user groups?

User (user) user group (group) that has the same characteristics of the collection; for example, sometimes we have to let multiple users have the same permissions, such as view, modify a file or execute a command, then we need a user group we put the same user-defined user group, we modify a file or directory permissions, allowing users to set a certain operating authority, under the user so that the user group for the file or directory have the same rights, this is us permissions define and modify files set to achieve.

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

Number SET   "display line number 
syntax on" syntax highlighting
SET cursorline
SET ruler A "display scale
set showcmd" command input is displayed, see more clearly
set scrolloff = 3 "for 3-line cursor to the top and bottom from the buffer
set novisualbell "Do scintillator (not understand)
SET statusline =% F.% m% R & lt% H% W \ [the FORMAT =% {& FF}] \ [the TYPE =% the Y] \ [the POS =% L,% V] [% p %%] \% {strftime ( \ "% d /% m /% y \ - \% H:% m \")} " status line displays the contents of
set nocompatible" VIM removed 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, header files automatically inserted
autocmd BufNewFile When .cpp *, * [CH], SH *, * Java Exec...": The SetTitle Call () "
" "defined functions SetTitle, automatically insert the file header
FUNC the SetTitle ()
"if the file type is .sh file IF & filetype == 'SH'   Call The setline (. 1," \ ################ ################################################## ####### ")   Call the append (Line (". ")," \ # File the Name: ".expand ("% "))   Call the append (Line (". ") + 1," \ the Author #: JPP-17,043,214 ")   Call the append (Line (". ") + 2," \ # mail: [email protected] ")   Call the append (Line (". ") +. 3," \ # the 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: 17043214-jpp")

  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

"新建文件后,自动定位到文件末尾

autocmd BufNewFile * normal G
endfunc
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""`
`set autoindent " 自动缩进set cindentset tabstop=4 " Tab键的宽度set softtabstop=4` ` Autoindent SET "auto indent SET cindent SET. 4 TabStop =" width of the Tab key set softtabstop = 4` ` Autoindent SET "auto indent
SET cindent
SET. 4 TabStop =" width of the Tab key
set softtabstop = 4"Unified indented 4
the SET shiftwidth = 4
the SET noexpandtab " Do not use spaces instead of tabs,
the SET smarttab "section at the beginning of the line and use the tab
the SET showmatch
the SET History = 1000 " number of records in the history of
the SET nobackup "prohibit generate temporary files
noswapfile the sET
the sET ignorecase "search ignore case
the sET hlsearch " search-by-character highlight
the sET incsearch
the sET gdefault "replace inline
the sET langmenu = zh_CN.UTF-8 " language setting
the sET helplang = CN
the sET laststatus = 2 "is always displayed in the status line
filetype on "detect file type
filetype plugin on" loading filetype plugin
filetype indent ON "load-related indent file for specific file types
the SET iskeyword + = _, $, @,%, #, - "Word with the following symbols are not divided wrap
set linespace = 0"Between character insertion pixel row number
SET wildmenu " enhanced mode command automatically operating
SET Backspace = 2 "that the backspace (Backspace) normal processing indent, eol, start other
set whichwrap + = <,>, h, l "allow backspace and cursor keys across row boundaries
SET mouse = a " may be used anywhere in the buffer mouse (similar to the office, double-click the mouse is positioned in the work area)
SET Selection = exclusive
SET selectmode = mouse, key
"Auto completion
: inoremap ( () i`
`: inoremap) = ClosePair ( ')')`
`: inoremap O` {} {
`: inoremap ClosePair} = ( '}') `
`: inoremap [[] i`
`: inoremap] = ClosePair ( ']') `
`: inoremap "" "i`
`: inoremap '' 'I
! function ClosePair (char) `
` IF getline ('. ') [COL ('. ') -. 1] == A:char`
`return "\"`
`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 ending in .c, such as vim helloworld.c

 

The new files are shown below

Guess you like

Origin www.cnblogs.com/1yanghua/p/12550127.html