Difference between revisions of "File permissions"

(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...")
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
== chmod ==
 
== chmod ==
 
You can change file permissions with:
 
You can change file permissions with:
<console>$ chmod [r][g][u] [file]</console>
+
<console>
 +
$##bl## chmod [r][g][u] [file]
 +
</console>
 
[r] = number for root permissions, [g] = number for group permissions and [u] = number for user permissions.
 
[r] = number for root permissions, [g] = number for group permissions and [u] = number for user permissions.
 
<pre>7 = 4+2+1 (read/write/execute)
 
<pre>7 = 4+2+1 (read/write/execute)
Line 13: Line 15:
 
== chown ==
 
== chown ==
 
You can change owner and group of file with:
 
You can change owner and group of file with:
<console># chown [user]:[group] [file]</console>
+
<console>
 +
###i## chown [user]:[group] [file]
 +
</console>
 
You can change owner of folder and files inside recursively with:
 
You can change owner of folder and files inside recursively with:
<console># chown -R [user]:[group] [folder]</console>
+
<console>
 +
###i## chown -R [user]:[group] [folder]
 +
</console>
  
 
== gpasswd ==
 
== gpasswd ==
 
You can add user to group with:
 
You can add user to group with:
<console># gpasswd -a [user] [group]</console>
+
<console>
You can remove user from group with:
+
###i## gpasswd -a [user] [group]
<console># gpasswd -d [user] [group]</console>
+
</console>
 +
You can remove a user from a group with:
 +
<console>
 +
###i## gpasswd -d [user] [group]
 +
</console>
  
 
== useradd ==
 
== useradd ==
You can add new user with:
+
You can add a new user with:
<console># useradd -g users -G wheel,audio,portage -m [user]
+
<console>
# passwd [user]</console>
+
###i## useradd -g users -G wheel,audio,portage -m [user]
You can delete user with:
+
###i## passwd [user]
<console># userdel [user]</console>
+
</console>
 +
You can delete a user with:
 +
<console>
 +
###i## userdel [user]
 +
</console>
  
 
== groupadd ==
 
== groupadd ==
You can add new group with:
+
You can add a new group with:
<console># groupadd [group]</console>
+
<console>
You can delete group with:
+
###i## groupadd [group]
<console># groupdel [group]</console>
+
</console>
 +
You can delete a group with:
 +
<console>
 +
###i## groupdel [group]
 +
</console>
  
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]
 +
[[Category:First Steps]]

Latest revision as of 19:29, 4 March 2014

chmod

You can change file permissions with:

$ 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:

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

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

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

gpasswd

You can add user to group with:

# gpasswd -a [user] [group]

You can remove a user from a group with:

# gpasswd -d [user] [group]

useradd

You can add a new user with:

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

You can delete a user with:

# userdel [user]

groupadd

You can add a new group with:

# groupadd [group]

You can delete a group with:

# groupdel [group]