-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
116 lines (100 loc) · 5.88 KB
/
index.html
File metadata and controls
116 lines (100 loc) · 5.88 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Linux Chmod App</title>
<link rel="stylesheet" href="style.css"> </head>
<body>
<div class="container">
<h1>Linux Chmod Calculator</h1>
<div class="permission-section">
<h2>Symbolic Permissions</h2>
<div class="permission-group">
<h3>User (U)</h3>
<label>
<input type="checkbox" data-permission-type="user" data-permission-value="4" class="permission-checkbox"> Read (r)
</label>
<label>
<input type="checkbox" data-permission-type="user" data-permission-value="2" class="permission-checkbox"> Write (w)
</label>
<label>
<input type="checkbox" data-permission-type="user" data-permission-value="1" class="permission-checkbox"> Execute (x)
</label>
</div>
<div class="permission-group">
<h3>Group (G)</h3>
<label>
<input type="checkbox" data-permission-type="group" data-permission-value="4" class="permission-checkbox"> Read (r)
</label>
<label>
<input type="checkbox" data-permission-type="group" data-permission-value="2" class="permission-checkbox"> Write (w)
</label>
<label>
<input type="checkbox" data-permission-type="group" data-permission-value="1" class="permission-checkbox"> Execute (x)
</label>
</div>
<div class="permission-group">
<h3>Others (O)</h3>
<label>
<input type="checkbox" data-permission-type="others" data-permission-value="4" class="permission-checkbox"> Read (r)
</label>
<label>
<input type="checkbox" data-permission-type="others" data-permission-value="2" class="permission-checkbox"> Write (w)
</label>
<label>
<input type="checkbox" data-permission-type="others" data-permission-value="1" class="permission-checkbox"> Execute (x)
</label>
</div>
</div>
<div class="output-section">
<h2>Results</h2>
<p><strong>Symbolic:</strong> <span id="symbolicOutput">---------</span></p>
<p><strong>Octal:</strong> <span id="octalOutput">000</span></p>
<p><strong>Chmod Command:</strong> <code id="commandOutput">chmod 000 filename</code></p>
</div>
<div class="explanation-section">
<h2>Understanding Linux Permissions</h2>
<p>Linux file permissions control who can read, write, or execute a file or directory. They are managed for three distinct categories of users:</p>
<h3>User (U) - The Owner</h3>
<ul>
<li>This refers to the individual user who owns the file or directory.</li>
<li>When you create a new file or directory, you are typically its owner by default.</li>
<li>The 'User' permissions apply only to this specific owner.</li>
</ul>
<h3>Group (G) - Group Members</h3>
<ul>
<li>This refers to a group of users defined on the system.</li>
<li>Users can be members of one or more groups.</li>
<li>The 'Group' permissions apply to all users who are members of the file's assigned group. This is useful for team projects where multiple users need similar access.</li>
</ul>
<h3>Others (O) - Everyone Else</h3>
<ul>
<li>This refers to all other users on the system who are not the owner and are not members of the file's assigned group.</li>
<li>These permissions are often the most restrictive to prevent unauthorized access by general users.</li>
</ul>
<p>Each of these categories (User, Group, Others) can have Read, Write, and Execute permissions:</p>
<h3>Read (r / 4)</h3>
<ul>
<li><strong>For Files:</strong> Allows viewing the contents of the file. You can open and read it.</li>
<li><strong>For Directories:</strong> Allows listing the contents of the directory (i.e., seeing what files and subdirectories are inside).</li>
</ul>
<h3>Write (w / 2)</h3>
<ul>
<li><strong>For Files:</strong> Allows modifying, saving changes to, or deleting the file.</li>
<li><strong>For Directories:</strong> Allows creating new files or subdirectories within that directory, deleting existing files or subdirectories, and renaming files within that directory.</li>
</ul>
<h3>Execute (x / 1)</h3>
<ul>
<li><strong>For Files:</strong> Allows running the file as a program or script. Without execute permission, you can't run a script even if you can read its contents.</li>
<li><strong>For Directories:</strong> Allows "entering" or traversing into the directory. Without execute permission, you cannot `cd` into the directory or access files within it, even if you have read permission to list its contents.</li>
</ul>
<p>The numbers (4, 2, 1) represent the octal values for each permission, which are summed up to form the 3-digit octal permission mode (e.g., rwx = 4+2+1 = 7).</p>
</div>
</div>
<script src="script.js"></script> <footer>
<p>© 2025 Imam Bashir (twenty4). Built with ♥ by a Security Engineer.</p>
<p>Contact: <a href="https://x.com/twenty4_io" target="_blank">X</a> | <a href="https://linkedin.com/in/imambashir" target="_blank">LinkedIn</a></p>
</footer>
</body>
</html>