注意:
The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "File permissions"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
== Add user == | == Add user == | ||
<console> | <console> | ||
# useradd -g users -G wheel,portage,audio,video,usb,cdrom,tty -m <username> | |||
</console> | </console> | ||
== Delete user == | == Delete user == | ||
<console> | <console> | ||
# userder -r <username> | |||
</console> | </console> | ||
== List groups == | == List groups == | ||
$ | <console> | ||
$ | $ groups | ||
$ groups <username> | |||
</console> | |||
== List users == | == List users == | ||
$ | <console> | ||
$ users | |||
</console> | |||
== Add user to group == | == Add user to group == | ||
<console> | |||
# gpasswd -a <user> <group> | |||
</console> | |||
== Remove user from group == | == Remove user from group == | ||
<console> | |||
# gpasswd -d <user> <group> | |||
</console> | |||
== Add new group == | == Add new group == | ||
<console> | |||
# groupadd <group> | |||
</console> | |||
== Delete group == | == Delete group == | ||
<console> | |||
# groupdel <group> | |||
</console> | |||
== File permissions == | == File permissions == | ||
You can change file permissions with chmod. | You can change file permissions with chmod. | ||
<console> | <console> | ||
$ | $ chmod <r><g><u> <file> | ||
</console> | </console> | ||
<r> = number for root permissions | <r> = number for root permissions | ||
Line 47: | Line 59: | ||
You can change owner and group of file with chown. | You can change owner and group of file with chown. | ||
<console> | <console> | ||
# chown <user>:<group> <file> | |||
</console> | </console> | ||
You can change owner of folder and files inside recursively with: | You can change owner of folder and files inside recursively with: | ||
<console> | <console> | ||
# chown -R <user>:<group> <folder> | |||
</console> | </console> | ||
[[Category:HOWTO]] | [[Category:HOWTO]] | ||
[[Category:First Steps]] | [[Category:First Steps]] |
Revision as of 20:56, September 25, 2014
Add user
root # useradd -g users -G wheel,portage,audio,video,usb,cdrom,tty -m <username>
Delete user
root # userder -r <username>
List groups
user $ groups user $ groups <username>
List users
user $ users
Add user to group
root # gpasswd -a <user> <group>
Remove user from group
root # gpasswd -d <user> <group>
Add new group
root # groupadd <group>
Delete group
root # groupdel <group>
File permissions
You can change file permissions with chmod.
user $ chmod <r><g><u> <file>
<r> = number for root permissions <g> = number for group permissions = number for user permissions
7 = 4+2+1 (read/write/execute) 6 = 4+2 (read/write) 5 = 4+1 (read/execute) 4 = 4 (read) 3 = 2+1 (write/execute) 2 = 2 (write) 1 = 1 (execute)
Change owner and group of file
You can change owner and group of file with chown.
root # chown <user>:<group> <file>
You can change owner of folder and files inside recursively with:
root # chown -R <user>:<group> <folder>