- 0) check user info id <username>
- 1) users / groups are owners of file or directory
bsc@ubuntu:/home$ ls -lt
total 8
drwxr-xr-x 25 bsc yu 4096 Apr 15 13:27 yu // bsc is username, yu is group
drwxr-xr-x 15 test test 4096 Mar 16 2016 test
users in the same grops can share files/directory
- 2) Add user and groups
in ubuntu `useradd` and `adduser` are same functions , but adduser can only be accessed by root user, always user adduser
groupadd to add groups
useradd or usermod to change the group of the user
usermod <username> -aG <user_new_group>
to change user primay group
usermod <username> -g <user new group>
- 3) delete user or group
userdel, groupdel -r
- 4) groupmod
-g, --gid GID change the group ID to GID
-n, --new-name NEW_GROUP change the name to NEW_GROUP
- 5) to swtich user : su - <username>
- 6) default useradd cofigure in /etc/default/useradd
default user perporty in /etc/login.def
- 7) change user password : chage <username> or passwd <username>
- 8)user configuration file
when a new user created, the configure saved in /etc/passwd and /etc/shadow
e.g bsc:x:1000:1000:bsc:/home/yu:/bin/bash, /username/password/uid/pid/use_describiton/home dir_/user_shell to change the etc/passwd usevipw.
- 9) group configuration file
adm:x:4:syslog,test,bsc ; / group name/group password/group id/ group members
yu:x:1000: ; / if the group is primary group, there is no group member in it , just it self