January 11, 2017, Wednesday linux_ User Management & Rights Management 1. Linux User Management & Rights ManagementThe concept of the terminal:TTY view logged-in terminalType userGroup other hard link count is the main group size modified time file nameD rwx r-x r-x 3 sxt sxtgod 4096 Jan 19:33 UANDGType-DocumentsCatalog DL ConnectionPermissions:R:readW:writeX: ExecuteUser: Who it is, who it isGroup: Multiple users can belong to this groupOther: Other users out of the above user!!! : Root user ignores permissions, majority, release default off rootTo create users and groups:Useradd
Useradd GodUseradd sxt01Useradd sxt02
ID GodView information for a user
Groupadd
Groupadd Sxtgodto delete a user:
Userdel [option] USERNAME
-r: Delete User's home directory at the same time
Userdel-r sxt01
To modify the password for the specified user:
passwd sxt01To add a user to a group:Usermod
usermod-a-G Sxtgod sxt01Bind the resource (ego) to users and groups:ChownOwner: Genus Group
chown sxt:sxtgod EgoModify the access rights of the resource (ego):chmodFirst way: (U+x, G-r, o+x)
chmod u+x Egochmod g-r Egochmod o+w EgoThe second way: (using BITS)
chmod 777 Ego = = drwxrwxrwxchmod 717 Ego = = drwx--xrwxchmod 213 Ego = = d-w---x-wx
2.
/etc/passwd:cat/etc/passwdUser name: Password: uid:gid: Comments: Home directory: Default Shell
/etc/group:cat/etc/groupGroup name: Password: GID: List of users with this group attached to the group
/etc/shadow:cat/etc/shadowUser name: Password: Last time the password was modified: Minimum Age: Maximum Age: Warning Time: Inactive time: Expiry time:
3.
User Management Useradd, Userdel, Usermod, passwd, Chsh, CHFN, finger, id, chage
useradd [Options] USERNAME -U UID -G GID (Basic Group) -G GID,... (Additional groups) -C "COMMENT" -d/path/to/directory -S SHELL -m-k -M -R: Adding system users
Userdel: Userdel [option] USERNAME -r: Delete User's home directory at the same time
ID: View user's account attribute information -u-g-g-n
Finger: View user account information finger USERNAME
To modify user account properties: Usermod -U UID -G GID -a-g GID: Does not use the-a option to overwrite previous additional groups;-C -d-m: -s-l -L: Lock account -U: Unlock Account
CHSH: Modifying the user's default shell CHFN: Modifying annotation information
|
Password Management: passwd [USERNAME] --stdin -L -U -D: Remove user password PWCK: Checking user account Integrity |
Group Management Create Group: Groupadd Groupadd -G GID -R: Added as System group
Groupmod -G GID -N GRPNAME
Groupdel
GPASSWD: Setting a password for a group Newgrp GRPNAME <--> Exit
Chage -D: Last modification time -E: Expiration time -I: Inactive time -M: Minimum period of use -M: Maximum lifespan -W: Warning time
|
Rights Management R: W: X: Three types of users: U: belong to the main G: Group O: Other users Chown: Change file owner (only administrators can use this command) # chown USERNAME File,... -R: Modify the owner of the directory and its internal files --reference=/path/to/somefile file,... Chown username:grpname File,... Chown USERNAME. GRPNAME file,... Chgrp GRPNAME File,... -R --reference=/path/to/somefile file,...
chmod: Modify permissions for a file Modify permissions for three categories of users: chmod MODE File,... -R --reference=/path/to/somefile file,...
Rwxr-x---
|
Linux Command additions:
ll-dView current directory information (permissions, number of hard links, owner, genus Group, size, modification time, file name)
Ll-rReverse Display
ll-r recursive
display
ll-a
Show hidden files that begin with a point. Represents the current directory: Represents the parent directory
~ Indicates home directory
ll-hFor unit conversions
Null
LINUX_ User Management & Rights Management