Tag: Parameter causes lock UI filename system add Add expression
1.ETC file function:
(1)/ETC/PASSWD user account information.
(2)/etc/shadow secure user account information.
(3)/etc/group group account information.
(4)/etc/gshadow security group account information.
(5) Default value for/etc/default/useradd account creation.
(6)/etc/skel/contains the default file directory.
(7)/etc/login.defs Shadow cipher Suite configuration.
2. Create a user process:
(1) sudo useradd-m (create user home folder)-S (set the shell used by user login)/bin/bash user name # Add user
(2) sudo passwd user name #设置用户密码
(3) Su-user name #登陆用户, use the ID command to obtain UID and GID
3. Add Users:
(1) Useradd-c remarks plus notes. This note text is added to the 5th field in/etc/passwd
(2) useradd-d User home folder. Specifies the directory into which the user is logged in and gives the user full control of the directory error Example: useradd-d/user1; Userdel user1 causes system root to be deleted system crashes
(3) useradd-e validity period. Specify the expiration date for the account. The format is YYYY-MM-DD and will be stored in the/etc/shadow
(4) Useradd-f buffer days. Limit the number of days after the password expires and deactivate the user account
(5) Useradd-g main group. Set the primary group to which the user belongs www.cit.cn
(6) Useradd-g Secondary group. Set up a secondary group to which the user belongs, set up multiple groups
(7) Useradd-m force does not create user home folder
(8) Useradd-m Force the User home folder and copy the files in the/etc/skel/to the user's root directory
(9) useradd-p password. Enter the password for this account #-s shell. Shell used by user login
(Ten) Useradd-u uid. Specifies the identifier of the account user ID, referred to as UID
4. Delete the User:
(1) Userdel user name #删掉用户账户, keep home directory
(2) userdel-r user name #删掉该用户账户和家目录
5. Modify user information:
(1) usermod-c< notes > #修改用户帐号的备注文字.
(2) usermod-d< login catalogue > #修改用户登入时的目录.
(3) usermod-e< validity period > #修改帐号的有效期限.
(4) usermod-f< buffer days > #修改在密码过期后多少天即关闭该帐号.
(5) usermod-g< group > #修改用户所属的群组.
(6) usermod-g< Group > Staff user #修改用户所属的附加群组, add user to group staff
(7) usermod-l< account name > User1 user #修改用户帐号名称, modify username to User1
(8) Usermod-l user name #锁定用户密码 to invalidate the password.
(9) usermod-s<shell> #修改用户登入后所使用的shell.
(usermod-u<uid>) #修改用户ID. As long as ID 0 is an administrator, regardless of user name
(one) usermod-u user name #解除用户密码锁定.
6. Operation of the group:
(1) Groupadd: Add Group
Groupadd group1
Groupadd-g group1 # Specify GID as 1000
(2) Groupdel: Deleting a group
Groupdel group1 # Deleting a group
7.alias: Alias the command
Alias alias = ' formerly ' #如:alias la= ' Ls-a '
If an alias is required to be permanent, it needs to be saved to the. bashrc file
8.su with sudo:
(1) SU: Switch User, when no parameters, the default switch to the root user
Su-# switch to root and load User1 's environment configuration
Su-user1 # Switch to user1 and load the User1 environment configuration
(2) sudo: Let the current user temporarily execute the command as Administrator root
sudo has a configuration file:/etc/sudoers; By modifying the configuration file, you can have the specified user use the sudo command
9.source file name: reads and executes the commands in the filename under the current bash environment. The filename file can have no "execute permission"
10.env: View Current environment variables
11.export: Set or display the environment variable (temporarily in the terminal, to be permanently in effect need to modify the configuration file)
12.echo can be used to print content on the screen, Echo-n no line-wrapping output
The 13.$ variable name represents the value of the variable
14. Modify the PATH environment variable:
Add path= "path to add: $PATH" in the last line under ~/.profile to modify the current user environment variable, which can be modified for all users under/etc/profile (but not recommended)
15. Pipe Symbol | : Its function is to give the result of the previous command to the latter command using
Python Learning record--ubuntu (ii) Users and user groups