Chmod permissions, which are a part of the file permission system, are used for two primary purposes: to limit or control access to specific files by specific users and to control what users and usergroups can do with the ownership of files. The most common of these is the chmod command, which allows a user to change the permission of one or more files. There are other ways to specify permissions as well, such as using the -permissions flag along with the name of the file. This will give the user a list of options to choose from. Here, we’ll look at how to use these two flags to do more than just change permission for single files; in this article, we’ll see how to use these same options for all kinds of users and groups.
Table of Contents
When do you use chmod permissions
When you’re working on a shared server, chmod permissions take a close look at the number of users and groups that have full access to the files you want to set free. By default, it’s set up for ten users and groups. If you increase these values, you can increase the security of your server as well. For instance, if there are five different users and groups with full access to your website’s files, you can grant each of these users and groups chmod permissions for an unlimited number of users and groups.
Restrict access to a file
How can you use this to restrict access to a file? Well, you can start by creating a directory on your server and then telling chmod permissions to change permissions of that directory’s files and directories to the group or users defined in the file. For instance, if you have a PHP file called ‘example. php’, you can create a directory and specify this in the chmod command so that users with that group or user group would have full access. Then, if you want to restrict access of this directory to only those authorized members, you can change permissions on the directory to ‘forbidden’ or ‘readonly’. For instance, if you don’t want anybody to be able to edit the PHP source code, you can create an entry in the chmod command for this purpose.
Obviously, you need to be careful when you’re using the chmod command to control access rights for files.
A JavaScript Widget Calculator
Below is a simple JavaScript for a widget that can help you to refresh your memory in terms of what set of numbers equals to. You can run this script anytime you need to manually change the permission to a file or a directory on your web server of your local Lamp / Xamp server. Please remember that by default all .php files should be chmod to 644 and directories to 755. Occasionally though you will find yourself elevating that 755 to 775 or even 777 in some rare case as some scripts require the full power over to directories for uploads and similar ones.
Digital Designer, blog writer and also a tech enthusiast.
He loves to write content for blogs, podcasts, design websites, logos, brochures, banners and anything that sends a message to an audience.
You can contact Daniele at the link below:





