When using SSH, you can perform many different tasks. One of the more common tasks is to change file permissions of either files or folders. While you can also do this from within the cPanel, it is much easier to do it in SSH if you are already there. Below we describe and demonstrate how to do this.
To change permissions of a file or folder, you use the chmod command. You use the command, followed by the three digit permission structure you want to assign. Then, type the name of the file or folder you are changing. The basic command structure is shown below:
chmod ### file/folder
Now it is time for a demonstration. Below we will change the permissions of a file named testfile.txt from 644 to 755.
user5@example.com [~/public_html]# pwd
/home/user5/public_html
user5@example.com [~/public_html]# ls -alh
total 8.0K
drwxr-xr-x 2 user5 user5 4.0K Dec 7 18:43 ./
drwx--x--x 10 user5 user5 4.0K Dec 6 08:16 ../
-rw-r--r-- 1 user5 user5 0 Dec 7 18:43 file1.txt
-rw-r--r-- 1 user5 user5 0 Dec 7 18:43 testfile.txt
-rw-r--r-- 1 user5 user5 0 Dec 7 18:43 file3.txt
user5@example.com [~/public_html]# chmod 755 testfile.txt
user5@example.com [~/public_html]# ls -alh
total 8.0K
drwxr-xr-x 2 user5 user5 4.0K Dec 7 18:43 ./
drwx--x--x 10 user5 user5 4.0K Dec 6 08:16 ../
-rw-r--r-- 1 user5 user5 0 Dec 7 18:43 file1.txt
-rwxr-xr-x 1 user5 user5 0 Dec 7 18:43 file2.txt*
-rw-r--r-- 1 user5 user5 0 Dec 7 18:43 file3.txt
As you can see, testfile.txt's permissions were changed from 644 to 755.
n/a Points
|
2018-01-07 9:09 pm
Nice tutorial. But filenames do not match and therefore was a bit confusing. |
Email: | support@WebHostingHub.com | Ticket: | Submit a Support Ticket |
---|---|---|---|
Call: |
877-595-4HUB (4482) 757-416-6627 (Intl.) |
Chat: | Click To Chat Now |
We value your feedback!
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
new! - Enter your name and email address above and we will post your feedback in the comments on this page!