Open main menu

Funtoo β

File permissions

Revision as of 09:56, September 27, 2014 by Pytony (talk | contribs) (fixed formatting)

Add user

You can add user with useradd.

root # useradd -g users -G wheel,portage,audio,video,usb,cdrom,tty -m <username>

Delete user

You can delete user with userdel.

root # userdel -r <username>

List groups

You can list groups with group.

user $ groups
user $ groups <username>

Add or remove user from group

You can add or remove user from group with gpasswd.

root # gpasswd -a <user> <group>
root # gpasswd -d <user> <group>

Create new group

You can create new group with groupadd.

root # groupadd <group>

Delete group

You can also delete group with groupadd.

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 <u> = 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>