File permissions

From Funtoo
Revision as of 15:20, August 19, 2013 by Defer (talk | contribs) (Created page with "== chmod == You can change file permissions with: <console>$ chmod [r][g][u] [file]</console> [r] = number for root permissions, [g] = number for group permissions and [u] = n...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

chmod

You can change file permissions with:

user $ chmod [r][g][u] [file]

[r] = number for root permissions, [g] = number for group permissions and [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)

chown

You can change owner and group of file with:

root # chown [user]:[group] [file]

You can change owner of folder and files inside recursively with:

root # chown -R [user]:[group] [folder]

gpasswd

You can add user to group with:

root # gpasswd -a [user] [group]

You can remove user from group with:

root # gpasswd -d [user] [group]

useradd

You can add new user with:

root # useradd -g users -G wheel,audio,portage -m [user]
root # passwd [user]

You can delete user with:

root # userdel [user]

groupadd

You can add new group with:

root # groupadd [group]

You can delete group with:

root # groupdel [group]