How to Change File Permissions Using SSH

Setting the correct file permissions makes your website files and emails more secure. Follow the steps below on how to change the file permission via SSH connection. The sample filename is testvd.html and its current file permission is 755The goal of this article is to change it to file permission 644 

Note: SSH connections are only allowed in Vodien Virtual Private Servers and Dedicated Servers .

Step 1. Connect to SSH via Windows or connect to SSH via Mac OSx 

Step 2. Enter the code below to enter the directory or to connect to a specific directory. See the line labeled 1 in the image below.

Command Prompt for Changing File Permissions via SSH

Code = cd space + forward slash [/] + directory name 

cd /home/public_html/test

As shown on the code above, the directory name in this example is home/public_html/test 

Step 3. Enter the code below to see the list of files in the current directory. See line labeled 2 in the image above. 

ls -alh

Step 4. Enter the code to change the file permission. See line labeled in the image above. 

Code = chmod + space new file permission space file name

chmod 644 testvd.html

As shown on the code above, the new file permission is 644 and the file to modify is testvd.html 

As shown on lines numbered 3 and 5, the file permissions have changed from 755 to 644. The file permissions are the details inside the box. There are three users on each directory: 

  • Owner 
  • Group 
  • World  

Users are separated with dash/es as shown in the box below.

rw-r—r--

Each permission mode has a corresponding number as follows: 

  • Read (r) – 4 
  • Write (w) – 2  
  • Execute (x) – 1  

The permission modes on a user are added if there is more than one. So, the file permission showing in the box above is 644. File permission 644 is the default working permission for website files and 755 for folders.  

Feel free to contact our Singapore or Australia Support Team if you have further questions. 

(Visited 1,575 times, 1 visits today)

Was this article helpful?

Related Articles