*info about account
syntax: id
*change password
styntax: passwd
*files about account/group
/etc/passwd account
/etc/shadow password
/etc/group group
*View current users
whoami -show the current user
who -show all users who are using this server
w -show all users who are using this server and what they are doing
*how to create a new user
syntax: useradd newusername
*add password for account
syntax: passwd [option] username
option:
-d home directory
-s shell
-u userId
-g main group
-G Other groups (seperate by ",")
*modify account
syntax: usermod [option] username
option: -l newusername
-u new userId
-d new home directory
-g main group
-G other groups
-L lock the account
-U unlock the account
*delete account
syntax: userdel [option] username
option: -r delete home directory
example: userdel test (delete account test but not delete its home directory)
userdel -r test (delete account test and delete its home directory)
*add group
syntax: groupadd groupname
*modify group
syntax: groupmod [option]
option: -n newname oldname (change group name)
-g newGid oldGid (change groupId)
*delete group
syntax: groupdel groupname
*use command "chown" to change owner of file/directory
syntax: chown account file
chown -R account directory
*use command "chgrp" to change group of file/directory
syntax: chgrp group file
chgrp -R group directory
*use command "chmod" to change permission of file/directory
syntax: chmod [option] file
chmod -R [option] directory
option:
u,g,o represent user,group,other
a represent ugo
+,- represent add,del
4,2,1 represent r,w,x
example:
chmod u+rw filename
chmod g-x fileanme
chmod go+r filename
chmod a-x filename
chmod 660 filename (change permission to rw-rw----)
*default permission of file/directory
default file permission: 777-umask
default directory permission: 666-umask
syntax: umask (show umask)
umask newnumber (change umask)
*special right
suid (let exec file run as it owner's right)
5.用户及权限
猜你喜欢
转载自oracle-api.iteye.com/blog/2171809
今日推荐
周排行