<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://dikapediav2.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Linux_Permissions</id>
	<title>Linux Permissions - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://dikapediav2.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Linux_Permissions"/>
	<link rel="alternate" type="text/html" href="https://dikapediav2.com/wiki/index.php?title=Linux_Permissions&amp;action=history"/>
	<updated>2026-04-30T00:58:52Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://dikapediav2.com/wiki/index.php?title=Linux_Permissions&amp;diff=111&amp;oldid=prev</id>
		<title>Ardika Sulistija: Created page with &quot;&lt;div style=&#039;text-align: center;&#039;&gt;&lt;span style=&quot;font-size:180%;&quot;&gt;Users, Groups, and Ownership&lt;/span&gt;&lt;/div&gt;     ====Linux Permissions==== ----   =====&lt;u&gt;What are &lt;b&gt;User and Group&lt;/b&gt; Permissions?&lt;/u&gt;=====   * Linux was designed to allow more than one user to have access to the system at the same time. &lt;b&gt;In order for this multiuser design to work properly, there needs to be a method to protect users from each other&lt;/b&gt;. * &lt;b&gt;Permissions&lt;/b&gt; are the &quot;&lt;...&quot;</title>
		<link rel="alternate" type="text/html" href="https://dikapediav2.com/wiki/index.php?title=Linux_Permissions&amp;diff=111&amp;oldid=prev"/>
		<updated>2024-08-27T00:38:56Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;div style=&amp;#039;text-align: center;&amp;#039;&amp;gt;&amp;lt;span style=&amp;quot;font-size:180%;&amp;quot;&amp;gt;Users, Groups, and Ownership&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;     ====Linux Permissions==== ----   =====&amp;lt;u&amp;gt;What are &lt;a href=&quot;#Users_and_Groups&quot;&gt;&amp;lt;b&amp;gt;User and Group&amp;lt;/b&amp;gt;&lt;/a&gt; Permissions?&amp;lt;/u&amp;gt;=====   * Linux was designed to allow more than one user to have access to the system at the same time. &amp;lt;b&amp;gt;In order for this multiuser design to work properly, there needs to be a method to protect users from each other&amp;lt;/b&amp;gt;. * &amp;lt;b&amp;gt;Permissions&amp;lt;/b&amp;gt; are the &amp;quot;&amp;lt;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;div style=&amp;#039;text-align: center;&amp;#039;&amp;gt;&amp;lt;span style=&amp;quot;font-size:180%;&amp;quot;&amp;gt;Users, Groups, and Ownership&amp;lt;/span&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Linux Permissions====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;What are [[#Users and Groups|&amp;lt;b&amp;gt;User and Group&amp;lt;/b&amp;gt;]] Permissions?&amp;lt;/u&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Linux was designed to allow more than one user to have access to the system at the same time. &amp;lt;b&amp;gt;In order for this multiuser design to work properly, there needs to be a method to protect users from each other&amp;lt;/b&amp;gt;.&lt;br /&gt;
* &amp;lt;b&amp;gt;Permissions&amp;lt;/b&amp;gt; are the &amp;quot;&amp;lt;i&amp;gt;rights&amp;lt;/i&amp;gt;&amp;quot; to act on a file or directory.&lt;br /&gt;
** &amp;lt;b&amp;gt;Read&amp;lt;/b&amp;gt; - allows the contents of the file to be viewed. Read permission on a directory will allow you to list the contents of a directory.&lt;br /&gt;
** &amp;lt;b&amp;gt;Write&amp;lt;/b&amp;gt; - write permission allows you to modify the contents of that file. Write permissions on a directory will allow you to add/remove files in that directory.&lt;br /&gt;
** &amp;lt;b&amp;gt;Execute&amp;lt;/b&amp;gt; - Executable permission allows you to run the file and execute a program or script. Executable permissions on a directory allows you to enter int and access files (or other directories) inside. Users usually have a default group, but they may belong to several additional groups. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;How to view permissions of file/directory?&amp;lt;/u&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
Use &amp;#039;&amp;lt;b&amp;gt;ls&amp;lt;/b&amp;gt;&amp;#039; command like so:&lt;br /&gt;
 $ ls -l directory/file&lt;br /&gt;
 $ ll directory/file&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;10 bits in the Permissions&amp;lt;/u&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
* First column = ten bits/characters = permissions of the directory/file.&lt;br /&gt;
* Second column with the number indicates the number of files/directories in the directory. &lt;br /&gt;
** It will  show a 1 if it is just a file, a directory with 1 file will show as 2.&lt;br /&gt;
* Third column = owner, then group, size, data, and time of last access, name of file/directory.&lt;br /&gt;
&lt;br /&gt;
 $ ls -al &lt;br /&gt;
 drwxrwxr-x 2 ec2-user ec2-user       39 Jan 26 05:37 .aws&lt;br /&gt;
 -rw------- 1 ec2-user ec2-user    26372 Mar 24 17:51 .bash_history&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;lt;b&amp;gt;d&amp;lt;/b&amp;gt;&amp;#039; this indicates a &amp;lt;b&amp;gt;directory&amp;lt;/b&amp;gt;.&lt;br /&gt;
* &amp;#039;&amp;lt;b&amp;gt;-&amp;lt;/b&amp;gt;&amp;#039; this indicates a &amp;lt;b&amp;gt;file&amp;lt;/b&amp;gt;.&lt;br /&gt;
* The &amp;lt;b&amp;gt;last 9 bits&amp;lt;/b&amp;gt; are the &amp;lt;b&amp;gt;permissions&amp;lt;/b&amp;gt;.&lt;br /&gt;
* The &amp;lt;b&amp;gt;first 3 bits&amp;lt;/b&amp;gt; are the permissions of the &amp;lt;b&amp;gt;OWNER&amp;lt;/b&amp;gt;.&lt;br /&gt;
* The &amp;lt;b&amp;gt;second 3 bits&amp;lt;/b&amp;gt; are the permissions of the &amp;lt;b&amp;gt;GROUP&amp;lt;/b&amp;gt;.&lt;br /&gt;
* The &amp;lt;b&amp;gt;last 3 bits&amp;lt;/b&amp;gt; are the permissions of &amp;lt;b&amp;gt;OTHER&amp;lt;/b&amp;gt; user on the server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Users and Groups====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
User permissions are used to provide your system with greater security without any direct interaction. The best practice is to give each user their own login to your system. This protects each user’s files from all other users. Furthermore, using specific accounts for users allows more accurate system logging, particularly when combined with tools like [[#Sudo Permissions|&amp;lt;b&amp;gt;sudo&amp;lt;/b&amp;gt;]]. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;Creating User Accounts&amp;lt;/u&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
(Note* you will need root/sudo privileges) To create a new standard user account:&lt;br /&gt;
* &amp;lt;b&amp;gt;useradd&amp;lt;/b&amp;gt;:&lt;br /&gt;
 $ useradd [user]                   # Add user&lt;br /&gt;
 $ useradd -c &amp;quot;Real Name&amp;quot; [user]    # Add user with REAL NAME. &lt;br /&gt;
 $ useradd [user] -d /home/[user]   # Create home directory for user&lt;br /&gt;
 $ useradd [user] -e [YYYY-MM-DD]   # The date when the account will expire    &lt;br /&gt;
 $ useradd [user] -f [#]            # The number of days before the account expires. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
What is the difference between &amp;lt;b&amp;gt;useradd&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;adduser&amp;lt;/b&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;lt;b&amp;gt;adduser&amp;lt;/b&amp;gt;&amp;#039; is more user friendly and interactive. Creates a home directory and sets the default group, shell, etc. Must include username like so:&lt;br /&gt;
 $ adduser [user]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;Deleting User Accounts&amp;lt;/u&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
(Note* you will need root/sudo privileges) To remove a user:&lt;br /&gt;
* &amp;lt;b&amp;gt;userdel&amp;lt;/b&amp;gt;:&lt;br /&gt;
 $ userdel [user]&lt;br /&gt;
 $ userdel -r [user]                # To remove the user, their home folder, and their files.              &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;Set a Password for the New User&amp;lt;/u&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;passwd&amp;lt;/b&amp;gt;:&lt;br /&gt;
 $ passwd [user]&lt;br /&gt;
&lt;br /&gt;
The user will be able to change their password at anytime using the &amp;lt;b&amp;gt;passwd&amp;lt;/b&amp;gt; command. &lt;br /&gt;
 $ passwd&lt;br /&gt;
 Changing password for ec2-user.&lt;br /&gt;
 (current) UNIX password:&lt;br /&gt;
 Enter new UNIX password:&lt;br /&gt;
 Retype new UNIX password:&lt;br /&gt;
 passwd: password updated successfully&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
We recommend avoiding situations where more than one individual knows the password for a user account for maximum security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====How to list users in a linux system====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
https://linuxize.com/post/how-to-list-users-in-linux/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;How to view users with password&amp;lt;/u&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
You can check &amp;lt;b&amp;gt;/etc/shadow&amp;lt;/b&amp;gt;. The second field starting with &amp;#039;$&amp;#039; means there&amp;#039;s a password.&lt;br /&gt;
 $ cat /etc/shadow&lt;br /&gt;
 .&lt;br /&gt;
 ec2-user:!!:18424:0:99999:7:::&lt;br /&gt;
 testuser:$6$r.P4TVQD$kDta0nGBdoATQh4LRjLljNn7df1BjIoD.elwRT/gFOtBn7BPRNDITuBbJhA4Vrf7Fo/3910szbb60cnqgtfv0/:18470:0:99999:7:::&lt;br /&gt;
&lt;br /&gt;
Or you can use the following commands to verify which users have a password:&lt;br /&gt;
 $ egrep ^[^:]+:[^\!*] /etc/shadow | cut -d: -f1  # to list users with password&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;Working with Groups&amp;lt;/u&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;chgrp&amp;lt;/b&amp;gt; or &amp;lt;b&amp;gt;editgrp&amp;lt;/b&amp;gt; or &amp;lt;b&amp;gt;newgrp&amp;lt;/b&amp;gt;:&lt;br /&gt;
** The &amp;lt;b&amp;gt;chgrp&amp;lt;/b&amp;gt; command changes the definition of a group. The &amp;lt;b&amp;gt;editgrp&amp;lt;/b&amp;gt; command can define a new group and change an existing group. The &amp;lt;b&amp;gt;newgrp&amp;lt;/b&amp;gt; command defines a new group.&lt;br /&gt;
&lt;br /&gt;
* Control of group membership is administered through the &amp;lt;b&amp;gt;/etc/group&amp;lt;/b&amp;gt; file. Shows a list of groups and its members. &lt;br /&gt;
* Every user has a default or primary group. &lt;br /&gt;
* A user may access other files in other groups, as long as they are also a member of that group and the access permissions are set. &lt;br /&gt;
* To run programs or create a file in a different group, the user must run the &amp;lt;b&amp;gt;newgrp&amp;lt;/b&amp;gt; command to switch their current group:&lt;br /&gt;
** If the user entering the above command is a member of the finances group in the &amp;lt;b&amp;gt;/etc/group&amp;lt;/b&amp;gt; file, then the current group membership will change. &lt;br /&gt;
** It is important to note that any files created will now be associated with the finances group rather than the user’s primary group. &lt;br /&gt;
 $ newgrp [finances]&lt;br /&gt;
&lt;br /&gt;
* Users may also change their group by using the &amp;lt;b&amp;gt;chgrp&amp;lt;/b&amp;gt; command.&lt;br /&gt;
 $ chgrp [user]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;Creating and Removing Directories&amp;lt;/u&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
To make a directory, use &amp;#039;&amp;lt;b&amp;gt;mkdir&amp;lt;/b&amp;gt;&amp;#039;:&lt;br /&gt;
 $ mkdir [dir]&lt;br /&gt;
 $ mkdir -m a=rwx [dir]          # To make a directory and set the permissions at the same time.&lt;br /&gt;
&lt;br /&gt;
To remove a directory, you can use:&lt;br /&gt;
* &amp;#039;&amp;lt;b&amp;gt;rmdir&amp;lt;/b&amp;gt;&amp;#039; - It removes the directory entry specified by each directory argument, provided it is empty.&lt;br /&gt;
* &amp;#039;&amp;lt;b&amp;gt;rm -r&amp;lt;/b&amp;gt;&amp;#039; -  &amp;#039;rm&amp;#039; typically removes a file but can be used to remove directory even if directory is not empty.&lt;br /&gt;
 $ rmdir [empty dir]&lt;br /&gt;
 $ rm -r [dir]&lt;br /&gt;
 $ rm -rf [dir]               # Be careful with this one!!!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Sudo Permissions====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;Understanding &amp;lt;b&amp;gt;Sudo&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;b&amp;gt;Root&amp;lt;/b&amp;gt; is the &amp;lt;i&amp;gt;superuser&amp;lt;/i&amp;gt; and has the ability to do anything on a system. Therefore, in order to have protection against potential damage, &amp;lt;b&amp;gt;sudo&amp;lt;/b&amp;gt; is used in place of root. &lt;br /&gt;
* &amp;lt;b&amp;gt;Sudo&amp;lt;/b&amp;gt; allows users and groups access to commands they normally would not be able to use. It will allow a user to have administrative privileges without logging in as root. &lt;br /&gt;
Depending on your distro, you may or may not need to install ‘sudo’ package&lt;br /&gt;
** Debian: apt-get install sudo&lt;br /&gt;
** CentOS/redhat: yum install sudo&lt;br /&gt;
* In order to provide a user with sudo ability, their name will need to be added to the &amp;lt;b&amp;gt;sudoers&amp;lt;/b&amp;gt; file. &lt;br /&gt;
** Login as root (&amp;lt;b&amp;gt;su&amp;lt;/b&amp;gt;), and enter the command &amp;lt;b&amp;gt;visudo&amp;lt;/b&amp;gt;:&lt;br /&gt;
** After you have given you user account sudo privileges, save the sudoers file and log out as root. You can now run visudo like so, sudo visudo.&lt;br /&gt;
 $ sudo visudo&lt;br /&gt;
* If you lose access to sudo, you can add user to a group that has sudo privileges such as the ‘wheel’ group using &amp;lt;b&amp;gt;usermod&amp;lt;/b&amp;gt;:&lt;br /&gt;
 $ usermod -aG [group] [user]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;How to remove user from a group&amp;lt;/u&amp;gt;=====&lt;br /&gt;
To remove a user from a group, use the gpasswd command with the -d option as follows.&lt;br /&gt;
 # gpasswd -d [user] [group]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;How to allow user to run sudo without password&amp;lt;/u&amp;gt;=====&lt;br /&gt;
 sudo visudo&lt;br /&gt;
 .&lt;br /&gt;
 ## Same thing without a password&lt;br /&gt;
 %wheel ALL=(ALL)       NOPASSWD: ALL&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Chmod====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;Changing Directory and File Permissions&amp;lt;/u&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;lt;b&amp;gt;chmod&amp;lt;/b&amp;gt; - Change mode; Used to change permissions on files and directories.&lt;br /&gt;
* Maybe used with either letter or numbers ([[#Chmod Octal Format|&amp;lt;b&amp;gt;octal&amp;lt;/b&amp;gt;]]) to set permissions.&lt;br /&gt;
&lt;br /&gt;
Letters used with chmod are:&lt;br /&gt;
:: r = read&lt;br /&gt;
:: w = write&lt;br /&gt;
:: x = execute&lt;br /&gt;
:: x = execute (only if file is a directory)&lt;br /&gt;
:: s = set user or group ID on execution, setuid bit&lt;br /&gt;
:: t = sticky bit&lt;br /&gt;
:: u = current permissions the file has for user&lt;br /&gt;
:: g = current permissions the file has for users in the same group&lt;br /&gt;
:: o = current permissions the file has for others not in the group&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
r - read - permission needed to do a ls inside the directory.&lt;br /&gt;
&lt;br /&gt;
w - write - permissions needed to create a new file (or sub-directory) inside the directory.&lt;br /&gt;
&lt;br /&gt;
x - execute - permission needed to cd into the directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;lt;b&amp;gt;plus&amp;lt;/b&amp;gt; (&amp;lt;b&amp;gt;+&amp;lt;/b&amp;gt;) sign to grant permissions:&lt;br /&gt;
 $ chmod u+r, g+x [file]&lt;br /&gt;
* u is for user&lt;br /&gt;
* r is for read&lt;br /&gt;
* g is for group&lt;br /&gt;
* x is for execute&lt;br /&gt;
* The user was given read permission and the group was given execute permission for the file. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Additional File Permissions: (&amp;lt;b&amp;gt;+t&amp;lt;/b&amp;gt;) &amp;lt;b&amp;gt;Stick Bit&amp;lt;/b&amp;gt;.&lt;br /&gt;
* &amp;lt;b&amp;gt;+t&amp;lt;/b&amp;gt; (sticky bit) means that &amp;lt;u&amp;gt;only the owner or root can delete the file, regardless of which users have write access to this file/directory by way of group membership or ownership&amp;lt;/u&amp;gt;. This is useful when a file or directory is owned by a group through which a number of users share write access to a given set of files. &lt;br /&gt;
 $ chmod +t [file]          # To add sticky bit to file/dir&lt;br /&gt;
 $ chmod -t [file]          # To remove the sticky bit.&lt;br /&gt;
* To change the sticky bit you need to be root or the file owner. The root will be able to delete files regardless of the status of the sticky bit. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;Setg/uid Bit (+s)&amp;lt;/u&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
+s on file:&lt;br /&gt;
* Allows users with permissions to execute a given file the ability to run that file with the permissions of file owner. &lt;br /&gt;
** I.e. if the file ‘work.txt’ was owned by the root user and the marketing group, members of the marketing group could run the work program as if they were the root user. &lt;br /&gt;
* This may pose potential security risks in some cases and executables should be properly evaluated before receiving the +s flag.&lt;br /&gt;
 $ chmod g+s /usr/bin/work.txt&lt;br /&gt;
&lt;br /&gt;
+s on a directory:&lt;br /&gt;
* &amp;lt;b&amp;gt;Files created in +s directories receive the ownership of that directory’s user and group&amp;lt;/b&amp;gt;, &amp;lt;u&amp;gt;rather than the ownership of the user that created the file&amp;lt;/u&amp;gt; and their default group. &lt;br /&gt;
 $ chmod u+s ./Dir     # To set the setuid (user id) for a directory named dir.&lt;br /&gt;
 $ chmod g+s ./Dir     # To set the setguid (group id) option on a directory    &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;Chmod Octal Format&amp;lt;/u&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Octal format&amp;lt;/b&amp;gt; requires calculating the permissions for each portion of the file or directory.&lt;br /&gt;
* &amp;lt;b&amp;gt;r&amp;lt;/b&amp;gt; = 4&lt;br /&gt;
* &amp;lt;b&amp;gt;w&amp;lt;/b&amp;gt; = 2&lt;br /&gt;
* &amp;lt;b&amp;gt;x&amp;lt;/b&amp;gt; = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;OCTAL VALUE || READ || WRITE || EXECUTE&amp;lt;/b&amp;gt;&lt;br /&gt;
     7           r       w        x&lt;br /&gt;
     6           r       w        -&lt;br /&gt;
     5           r       -        x&lt;br /&gt;
     4           r       -        -&lt;br /&gt;
     3           -       w        x&lt;br /&gt;
     2           -       w        -&lt;br /&gt;
     1           -       -        x&lt;br /&gt;
     0           -       -        -&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;PERMISSION STRING || OCTAL CODE || MEANING&amp;lt;/b&amp;gt;&lt;br /&gt;
     rwxrwxrwx             777       Read, write, and execute permissions for all users.&lt;br /&gt;
     rwxrw-rw-             755       Read and execute permissions for all users. The file&amp;#039;s owner also has write permission.&lt;br /&gt;
     rwxr-x---             750       Read and execute permissions for the owner and group. The file&amp;#039;s owner also has write permission. Users who aren&amp;#039;t the file&amp;#039;s owner or members of the group have no access to the file.&lt;br /&gt;
     rwx------             700       Read, write, and execute permissions for the file&amp;#039;s owner only; all others have no access.&lt;br /&gt;
     rw-rw-rw-             666       Read and write permissions for all users. No execute permissions for anybody.&lt;br /&gt;
     rw-rw-r--             664       Read and write permissions for the owner and group. Read-only permission for all others.&lt;br /&gt;
     rw-rw----             660       Read and write permissions for the owner and group. No world permissions.&lt;br /&gt;
     rw-r--r--             644       Read and write permissions for the owner. Read-only permission for all others. &lt;br /&gt;
     rw-r-----             640       Read and write permissions for the owner, and read-only permission for the group. No permission for others.&lt;br /&gt;
     rw-------             600       Read and write permissions for the owner. No permission for anybody else.&lt;br /&gt;
     r--------             400       Read permission for the owner. No permission for anybody else. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Chown====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;Changing File Ownership&amp;lt;/u&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
* By default all files are “owned” by the user who creates them and by that user’s default group. &lt;br /&gt;
* To change the ownership of a file, use the ‘&amp;lt;b&amp;gt;chown&amp;lt;/b&amp;gt;’ command.&lt;br /&gt;
** Whats the difference between &amp;lt;b&amp;gt;chmod&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;chown&amp;lt;/b&amp;gt;?&lt;br /&gt;
*** &amp;lt;b&amp;gt;chmod&amp;lt;/b&amp;gt; changes the user’s/groups permissions on a file.&lt;br /&gt;
*** &amp;lt;b&amp;gt;chown&amp;lt;/b&amp;gt; changes the file’s ownership.&lt;br /&gt;
 $ chown user:group [file]&lt;br /&gt;
 $ chown ardika:finances txt&lt;br /&gt;
&lt;br /&gt;
* To change the ownership of a directory AND all of its contents, use the recursive &amp;lt;b&amp;gt;-R&amp;lt;/b&amp;gt; flag:&lt;br /&gt;
 $ chown -R user:group [dir]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Back Up Permissions of a File====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=====&amp;lt;u&amp;gt;How to Back Up Permissions and Restore&amp;lt;/u&amp;gt;=====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1) Back up the current permissions of the directory, such as /var/www:&lt;br /&gt;
 $ sudo getfacl -R /var/www &amp;gt; /home/ec2-user/wwwvar-perms.txt&lt;br /&gt;
&lt;br /&gt;
2) Change the directory to be world writeable: &lt;br /&gt;
 $ sudo chmod -R o+w /var/www&lt;br /&gt;
&lt;br /&gt;
3) Restore the permissions back:&lt;br /&gt;
 $ cd / &amp;amp;&amp;amp; sudo setfacl --restore=/home/ec2-user/wwwvar-perms.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====How to prevent a user from downloading a file via SFTP/Filezilla====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Just need to remove READ permissions. :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Resetting Root Password====&lt;br /&gt;
----&lt;br /&gt;
You will have to reset the password manually by interrupting grub by using the kernel parameter &amp;lt;b&amp;gt;rd.break&amp;lt;/b&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
1. Boot the system and interrupt the booting process when you&amp;#039;re at the GRUB menu by pressing &amp;#039;e&amp;#039;.&amp;lt;/br&amp;gt;&lt;br /&gt;
2. Add the kernel parameter &amp;lt;b&amp;gt;rd.break&amp;lt;/b&amp;gt; to the Linux kernel line.&amp;lt;/br&amp;gt;&lt;br /&gt;
3. Press &amp;#039;ctrl+x&amp;#039; to boot.&amp;lt;/br&amp;gt;&lt;br /&gt;
4. You will enter the emergency mode prompt (or preboot screen, per Joe) to authenticate to unlock the drive.&amp;lt;/br&amp;gt;&lt;br /&gt;
5. Then run the following commands:&lt;br /&gt;
 # mount -o remount,rw /sysroot&lt;br /&gt;
 # chroot /sysroot&lt;br /&gt;
 # passwd &lt;br /&gt;
 # touch /.autorelabel&lt;br /&gt;
 # exit&lt;br /&gt;
 # logout&lt;br /&gt;
6. A couple of minutes and once done, the system will reboot upon which you can log in as the root user with the new password.&amp;lt;/br&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
Notes:&lt;br /&gt;
* The rd.break parameter interrupts the boot process before the control is passed over to the kernel. At this point, when you run the passwd command to do the password reset, the associated shadow file (&amp;lt;b&amp;gt;/etc/shadow&amp;lt;/b&amp;gt;) is modified with an incorrect SELinux context. The touch &amp;lt;b&amp;gt;/.autorelabel&amp;lt;/b&amp;gt; command creates a hidden file named &amp;lt;b&amp;gt;.autorelabel&amp;lt;/b&amp;gt; under the root directory. On the next boot, the SELinux subsystem will detect this file, and then relabel all of the files on that system with the correct SELinux contexts. On large disks, this process can take a good amount of time.&lt;br /&gt;
	&lt;br /&gt;
Reference: &lt;br /&gt;
[+] https://www.tecmint.com/reset-forgotten-root-password-in-rhel-8/ &lt;br /&gt;
[+] https://learn.redhat.com/t5/Platform-Linux/Unable-to-reset-the-root-password-when-disabling-SELinux/td-p/21082&lt;br /&gt;
[+] https://unix.stackexchange.com/questions/509798/what-does-touch-autorelabel-do-when-we-reset-the-root-password-in-red-hat-en/509801#509801&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
References:&amp;lt;/br&amp;gt;&lt;br /&gt;
[+] https://www.linode.com/docs/tools-reference/linux-users-and-groups/&amp;lt;/br&amp;gt;&lt;br /&gt;
[+] Another really good document: https://access.redhat.com/solutions/1358 &lt;br /&gt;
[+] My doc: https://docs.google.com/document/d/1wWXfDc6wmqrGWKjkB-b6-6AkEcPxL17nzvS3WJUA34A/edit?usp=sharing&lt;/div&gt;</summary>
		<author><name>Ardika Sulistija</name></author>
	</entry>
</feed>