Access Rights on Linux


Often when we want to modify a file on Linux we have to use the command $ sudo gedit file, extract $ sudo tar zxvf file.tar.gz -C /opt, for easy access to the /var/www folder typing the command $ sudo chmod -R 777 /var/www/. The sudo and chmod commands are done because these files and folders can only be accessed by root or in other words we are limited by file/file permissions.

Below is a list of files that appear when typing the command $ ls -l, visible file access rights along with users and groups. rwx file permissions exist only on unix/linux filesystems and do not apply on windows filesystems.


– = file
l = link
d = directory
r = read
w = write
x = execute

There are 3 rwx segments, the first segment is for User, the second segment is for Group and the third segment is for Other.
User = who owns/creates the file.
Group = a combination of several Users.
Other = Users who are not registered in the Group or system, can also be called Public.

From the information above, the readme.txt file is owned by User=musa with Group=musa. The readme.txt file can be read, written, and executed by the User, Group and Other, which means that anyone can modify it with full access.

Changing File/Folder Permissions
r = 4
w = 2
x = 1

sudo chmod 777 file_folder
The file is set to full access (read, write, execute) for all (user, group, other). Use sudo if the file/folder is owned by root.

chmod -R 777 file_folder
Additional -R (recursive), all files and sub-folders are set to access rights

chmod 755 file_folder
Files are set to rwx for users, rx for groups and others

In addition to using numbers, changing file permissions can also use letters.
u = user
g = group
o = other
a = all

chmod a+x files
Files can be executed by all. Usually the file that is set to x is a .sh script file, the file cannot be executed before the execute permissions are enabled.

chmod ow file
Remove the write option for Other

chmod a+rw file
Install read write options for all be it User, Group or Other

chown user_baru file_folder
Changing User Files/Folders

Changing Group Files/Folders
chown user:group_baru file_folder

good luck

Support this blog by donating via Trakteer.id, PayPal, or Jenius Pay $musaamine.

Related Posts:

  • How to Sync Files with Unison
  • How to Install L2TP/IPsec VPN Server on Ubuntu 20.04How to Install L2TP/IPsec VPN Server on Ubuntu 20.04
  • How to Install MySQL 5.5 on Ubuntu 18.04How to Install MySQL 5.5 on Ubuntu 18.04
  • How to Install EPrints 3.4 on Ubuntu 20.04How to Install EPrints 3.4 on Ubuntu 20.04
  • How to install DSpace 6 on Ubuntu 20.04How to install DSpace 6 on Ubuntu 20.04

.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *