-
Notifications
You must be signed in to change notification settings - Fork 2
/
permissions.html
173 lines (163 loc) · 12.2 KB
/
permissions.html
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!DOCTYPE HTML>
<!--
Phantom by HTML5 UP
html5up.net | @ajlkn
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
<head>
<title>Permissions</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="assets/css/main.css" />
<noscript><link rel="stylesheet" href="assets/css/noscript.css" /></noscript>
</head>
<body class="is-preload">
<!-- Wrapper -->
<div id="wrapper">
<!-- Header -->
<header id="header">
<div class="inner">
<!-- Logo -->
<a href="index.html" class="logo">
<span class="symbol"><img src="images/NeuroNestLogo.png" alt="NeuroNest Logo" /></span><span class="title">NeuroNest</span>
</a>
<!-- Nav -->
<nav>
<ul>
<li><a href="#menu">Menu</a></li>
</ul>
</nav>
</div>
</header>
<!-- Menu -->
<nav id="menu">
<h2>Menu</h2>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="resource_menu.html">Resources</a></li>
<li><a href="https://sopkoc.wixsite.com/neuronest/forum">Ask a Question</a></li>
<li><a href="https://sopkoc.wixsite.com/neuronest/about">About NeuroNest</a></li>
<li><a href="https://sopkoc.wixsite.com/neuronest/contact">Contact</a></li>
</ul>
</nav>
<!-- Main -->
<div id="main">
<div class="inner">
<h1>Permissions</h1>
<span class="image main"><img src="images/pic13.jpg" alt="" /></span>
<h2 id="understanding-permissions">Understanding Permissions</h2>
<p>In Unix-like operating systems, permissions control who can read, modify, or execute files and directories. This is crucial for managing security and access on your system. The way permissions are handled in Unix is somewhat similar to Windows, but the specifics differ.
In Unix-like systems, permissions can be set for the file's owner (<code>u</code>), the group associated with the file (<code>g</code>), and all other users (<code>o</code>). Below are various ways to modify these permissions using the <code>chmod</code> command.</p>
<h3 id="basic-concepts">Basic Concepts</h3>
<ul><li><strong>Ownership</strong>: Every file and directory has an owner and a group associated with it. The operating system tracks these using numeric IDs.</li>
<li><strong>Categories</strong>: Each user falls into one of three categories for any file:<ul>
<li><strong>Owner</strong>: The user who owns the file.</li>
<li><strong>Group</strong>: Users who are part of the file’s associated group.</li>
<li><strong>Others</strong>: Everyone else on the system.</li>
</ul></li></ul>
<h3 id="permission-types">Permission Types</h3>
<ul>
<li><strong>Read (<code>r</code>)</strong>: Allows viewing the contents of the file.</li>
<li><strong>Write (<code>w</code>)</strong>: Allows modifying the file.</li>
<li><strong>Execute (<code>x</code>)</strong>: Allows running the file if it is a program or script.</li>
</ul>
<ul>
<h3 id="viewing-permissions">Viewing Permissions</h3>
<p>Use the <code>ls -l</code> command to view detailed file permissions. The output includes a string like <code>-rwxr-xr-x</code> that shows permissions.</p>
<li>The first character indicates the type (e.g., <code>-</code> for files, <code>d</code> for directories).</li>
<li>The next three characters are the owner's permissions (aka the "user").</li>
<li>The following three are the permissions for the group the user belongs to.</li>
<li>The last three are the permissions for all other users.</li>
</ul></li></ul>
<ul>
For example, <code>-rwxr-xr-x</code> means:
<ul>
<li>Owner: Can read, write, and execute.</li>
<li>Group: Can read and execute, but not write.</li>
<li>Others: Can read and execute, but not write.</li>
</ul>
</ul>
<h2 id="changing-permissions">Changing Permissions</h2>
<p><h3 id="grant-read-permission">Grant Read Permission</h3>
This command gives the file's owner read access. The resulting permissions would be <code>-r--------</code>.</p>
<pre><code class="lang-bash"> <span class="hljs-selector-tag">$ chmod</span> <span class="hljs-selector-tag">u</span>+<span class="hljs-selector-tag">r</span> <span class="hljs-selector-tag">filename</span><span class="hljs-selector-class">.txt</span></code></pre>
<h3 id="grant-write-permission">Grant Write Permission</h3>
<p>This command adds write permission for the owner. The file's permissions will then be <code>--w-------</code>.</p>
<pre><code class="lang-bash"><span class="hljs-selector-tag">$ chmod</span> <span class="hljs-selector-tag">u</span>+<span class="hljs-selector-tag">w</span> <span class="hljs-selector-tag">filename</span><span class="hljs-selector-class">.txt</span></code></pre>
<h3 id="grant-execute-permission">Grant Execute Permission</h3>
<p>This command allows the owner to execute the file. The permissions would be updated to <code>---x------</code>.</p>
<pre><code class="lang-bash"><span class="hljs-selector-tag">$ chmod</span> <span class="hljs-selector-tag">u</span>+<span class="hljs-selector-tag">x</span> <span class="hljs-selector-tag">filename</span><span class="hljs-selector-class">.txt</span></code></pre>
<h3 id="grant-read-write-and-execute-permissions">Grant Read, Write, and Execute Permissions</h3>
<p>This command provides full access (read, write, and execute) to the file's owner. The file permissions will be <code>-rwx------</code>.</p>
<pre><code class="lang-bash"><span class="hljs-selector-tag">$ chmod</span> <span class="hljs-selector-tag">u</span>+<span class="hljs-selector-tag">rwx</span> <span class="hljs-selector-tag">filename</span><span class="hljs-selector-class">.txt</span></code></pre>
<h3 id="applying-permissions-to-the-group-and-others">Applying Permissions to the Group and Others</h3>
<h4 id="for-the-group">For the Group</h4>
<p>This grants the group read, write, and execute permissions, resulting in <code>----rwx---</code>.</p>
<pre><code class="lang-bash"><span class="hljs-selector-tag">$ chmod</span> <span class="hljs-selector-tag">g</span>+<span class="hljs-selector-tag">rwx</span> <span class="hljs-selector-tag">filename</span><span class="hljs-selector-class">.txt</span></code></pre>
<h4 id="for-others">For Others</h4>
<p>This command allows all other users to read, write, and execute the file, setting permissions to <code>-------rwx</code>.</p>
<pre><code class="lang-bash"><span class="hljs-selector-tag">$ chmod</span> <span class="hljs-selector-tag">o</span>+<span class="hljs-selector-tag">rwx</span> <span class="hljs-selector-tag">filename</span><span class="hljs-selector-class">.txt</span></code></pre>
<h3 id="combine-permission-changes">Combine Permission Changes</h3>
<p>This updates permissions to <code>-rwx-rw-r--</code>, providing different levels of access to the owner, group, and others.</p>
<pre><code class="lang-bash"><span class="hljs-selector-tag">$ chmod</span> <span class="hljs-selector-tag">u</span>+<span class="hljs-selector-tag">rwx</span>,<span class="hljs-selector-tag">g</span>+<span class="hljs-selector-tag">rw</span>,<span class="hljs-selector-tag">o</span>+<span class="hljs-selector-tag">r</span> <span class="hljs-selector-tag">filename</span><span class="hljs-selector-class">.txt</span></code></pre>
<h3 id="setting-exact-permissions">Setting Exact Permissions</h3>
<p>To set permissions precisely, use the equal sign (<code>=</code>) to define permissions explicitly. For example:</p>
<pre><code class="lang-bash"><span class="hljs-attribute">$ chmod u</span>=rw,g=rw,o=r filename.txt
<p>This command configures permissions to <code>-rw-rw-r--</code>, ensuring read and write access for the owner and group, and read-only access for others.</p>
</code></pre>
<h3 id="using-numerical-permission-codes">Using Numerical Permission Codes</h3>
<p>Numerical codes offer a compact way to set file permissions. Each digit represents permissions for the owner, group, and others, respectively.</p>
<h4 id="read-permission-only">Read Permission Only</h4>
<pre><code>$ chmod 400 filename.txt</code></pre>
<p>This sets permissions to <code>-r--------</code>, allowing only the owner to read the file.</p>
<h4 id="read-permission-for-owner-and-group">Read Permission for Owner and Group</h4>
<pre><code>$ chmod 440 filename.txt</code></pre>
<p>This results in <code>-r--r-----</code>, enabling read access for both the owner and the group.</p>
<h4 id="read-permission-for-everyone">Read Permission for Everyone</h4>
<pre><code>$ chmod 444 filename.txt</code></pre>
<p>This configuration, <code>-r--r--r--</code>, allows all users to read the file. Here, the number <code>4</code> signifies read permission.</p>
<h4 id="read-and-write-permissions">Read and Write Permissions</h4>
<pre><code>$ chmod 664 filename.txt</code></pre>
<p>This sets permissions to <code>-rw-rw-r--</code>, giving both the owner and the group read and write access.</p>
<h4 id="read-write-and-execute-permissions">Read, Write, and Execute Permissions</h4>
<pre><code>$ chmod 774 filename.txt</code></pre>
<p:>This sets permissions to <code>-rwxrwxr--</code>, allowing full access for the owner and group.</p>
<h4 id="full-access-for-owner-only">Full Access for Owner Only</h4>
<pre><code>$ chmod 700 filename.txt</code></pre>
<p>This grants full permissions to the owner (<code>-rwx------</code>) and none to others.</p>
<h4 id="typical-permissions-for-directories">Typical Permissions for Directories</h4>
<p>For directories, <code>755</code> results in <code>drwxr-xr-x</code>, providing read, write, and execute access to the owner, and read and execute access to the group and others.</p>
<pre><code>$ chmod 755 MyDir</code></pre>
<p>See <a href="https://alvinalexander.com/linux-unix/linux-chmod-command-permissions-file-directories/">https://alvinalexander.com/linux-unix/linux-chmod-command-permissions-file-directories/</a> for more information and examples.</p>
</div>
</div>
<!-- filenameter -->
<filenameter id="filenameter">
<div class="inner">
<section>
<h2>Funding</h2>
<p> We would like to express our heartfelt gratitude to <strong>Neurohackademy</strong> at the <strong>University of Washington eScience Institute</strong> for providing invaluable training and support. This experience has significantly enriched our understanding of neuroimaging and data science. We also acknowledge the support of the National Institute of Mental Health (NIMH) grant number <strong>5R25MH112480-08</strong>, which made this opportunity possible.</p>
</section>
<section>
<h2>Follow</h2>
<ul class="icons">
<li><a href="https://x.com/Neuro_Nest" class="icon brands style2 fa-twitter"><span class="label">Twitter</span></a></li>
<li><a href="https://github.com/NeuroHackademy2024/NeuroNest" class="icon brands style2 fa-github"><span class="label">GitHub</span></a></li>
<li><a href="mailto:[email protected]" class="icon solid style2 fa-envelope"><span class="label">Email</span></a></li>
</ul>
</section>
<ul class="copyright">
<li>© Untitled. All rights reserved</li><li>Design: <a href="http://html5up.net">HTML5 UP</a></li>
</ul>
</div>
</filenameter>
</div>
<!-- Scripts -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/browser.min.js"></script>
<script src="assets/js/breakpoints.min.js"></script>
<script src="assets/js/util.js"></script>
<script src="assets/js/main.js"></script>
</body>
</html>