Home | 簡體中文 | 繁體中文 | 雜文 | Search | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 作品與服務 | Email

第 18 章 Permission

目錄

18.1. User
18.1.1. Add a new user
18.1.2. remove an existed user
18.1.3. usermod - modify a user account
18.1.4. lock / unlock
18.1.4.1. /etc/passwd
18.2. Group
18.2.1. Add a new group
18.2.2. Add a user to the group
18.2.3. /etc/group
18.3. umask
18.4. Access Permissions
18.4.1. chown - change file owner and group
18.4.2. chgrp - change group ownership
18.4.3. chmod - change file access permissions
18.5. chattr - change file attributes on a Linux second extended file system
18.6. su - run a shell with substitute user and group IDs
18.7. runuser - run a command with substitute user and group ID
18.8. sudo, sudoedit - execute a command as another user
18.8.1. NOPASSWD
18.8.2. 允許或禁止命令
18.8.3. Cmnd_Alias 用法
18.8.4. wheel 組
18.9. ACL - Access Control List
18.9.1. getfacl - get file access control lists
18.9.2. setfacl - set file access control lists
18.9.2.1. set
18.9.2.2. default
18.9.2.3. remove
18.9.2.4. backup and restore

18.1. User

18.1.1. Add a new user

$ adduser neo			
			

18.1.2. remove an existed user

remove an existed user, but keeping directory /home/neo

$ userdel neo			
			

delete user's directory under /home when removing an existed user

$ userdel -r neo
			

18.1.3. usermod - modify a user account

usermod -G group -a user

[root@scientific ~]# groupadd vm
[root@scientific ~]# adduser xen
[root@scientific ~]# usermod -G vm -a xen
[root@scientific ~]# usermod -G vm -a kvm
[root@scientific ~]# id xen
uid=501(xen) gid=502(xen) groups=502(xen),501(vm)
			

18.1.4. lock / unlock

passwd -l neo
			
passwd -u neo
			

18.1.4.1. /etc/passwd

[root@test ~]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/etc/news:
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
pcap:x:77:77::/var/arpwatch:/sbin/nologin
rpc:x:32:32:Portmapper RPC user:/:/sbin/nologin
mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin
smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:4294967294:4294967294:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
avahi:x:70:70:Avahi daemon:/:/sbin/nologin
haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
avahi-autoipd:x:100:102:avahi-autoipd:/var/lib/avahi-autoipd:/sbin/nologin
neo:x:500:500::/home/neo:/bin/bash
mysql:x:501:501::/home/mysql:/bin/bash
				
comments powered by Disqus