Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

File permissions

From Funtoo
Revision as of 20:56, September 25, 2014 by Causes (talk | contribs)
Jump to navigation Jump to search

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>