Important Linux File permissions Cheat Sheet

Linux File Permissions

The chmod utility modifies the access mode of the file. Its abbreviation is change mode. In this blog, I will share the Linux File Permissions cheat sheet that you can use to play with file permission. chmod is important to command in Linux and is useful so that other users outside the system cannot access files if a certain port is open. If some wrong permission is applied on file and if it is accessible then there may be an attack on the server which can lead to the stopping of the server. Below I have shared the right permission to be used in WordPress and similarly you can figure it out for the rest of the file or folder.

0kMulgY

The generic options are as follows:

OptionsDescription
-L If the -R option is specified, all symbolic links are followed.
-PIf the -R option is specified, no symbolic links are followed.  This is the default.
-RRecursively Change the File’s Permissions 

     Only the owner of a file or the super-user is permitted to change the mode of a file.

linux file permissions cheat sheet

Owner: This will apply permission to the owner of the file or directory. This permission will not impact another user.

Group: This will apply permission to the group of the file or directory. This permission will also not impact another user.

All User: This permission applies to all users on the system for files or directories.

CommandDescription
chmod u+x fileAdd execute permission for the owner of the file
chmod g+rwAdd read and write permission from the group that owns the file
chmod o-w fileSubtract Permission
chmod u=r,g=rx,o=fileSet Permission to some absolute value
chmod 774 fileNumeric Representation
ValuePermission
0No Permission (—)
1Execute (–x)
2Write(-w-)
3Execute + Write (-wx)
4Read (r–)
5Read and Execute (r-x)
6Read + Write (rw-)
7Read+Write+Execute (rwx)

Correct Permission for WordPress

When you set up WP you (the webserver) may need write access to the files. So the access rights may need to be loose.

chown www-data:www-data  -R * # Let Apache be owner
find . -type d -exec chmod 755 {} \;  # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \;  # Change file permissions rw-r--r--

In Summary, You can understand Linux File Permission as :

linux file permissions cheat sheet

Hope you like our Linux file permissions cheat sheet blog. Please subscribe to InfoHubBlog for more upcoming blog.

Network Troubleshooting Commands for Linux: https://infohubblog.com/network-troubleshooting-commands-for-linux.html

Reference :

https://ubuntu.com/tutorials/command-line-for-beginners#1-overview

1 Trackbacks & Pingbacks

  1. Best OS for Programming - InfoHubBlog

Leave a comment

Your email address will not be published.


*