-
Notifications
You must be signed in to change notification settings - Fork 1
/
Permissions.txt
47 lines (35 loc) · 1.35 KB
/
Permissions.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2016-10-22T17:31:52+02:00
====== Permissions ======
Created lørdag 22 oktober 2016
**#** **To change permissions of a file/folder, use** //chmod//
$ chmod //who=<PERMISSIONS> <FILE_NAME>//
**#** **Who **
u **= user that owns the file**
g **= group the file belongs to**
o **= other users (everyone else)**
a **= all of the above (use instead of ugo)**
**#** **Permissions **
r **= read access**
w **= write access**
x **= execute-able**
== Basic Examples ==
$ chmod og=rx ~/Documents **# owner and group gets read and execute access**
$ chmod g= ~/Documents **# no access for group (empty space means no access)**
**#** **You'll sometimes see numeric given permissions**
r = 4 w = 2 x = 1
**#** **So as an example, we could say **
[owner] : rwx = 4+2+1 = 7
[group] : r-x = 4+0+1 = 5
[other] : r-x = 4+0+1 = 5
**# Would be produced as**
$ chmod 755 //<FILE_NAME>//
== Bulk chmod ==
# **chmod directories to 755** //-type d// **for directory**
$ find //directory// -type d -exec chmod 755 {} +
**#** **chmod files to 644 **//-type f// **for files**
$ find //directory// -type f -exec chmod 644 {} +
== Change ownership ==
**# Let's say we have a folder owned by **//root//** - maybe we created a new partition with **//gparted//** ex.**
$ chown //username// /path/to/folder