Loading...

Knowledge Base

How To Change File Permissions Using SSH

This article explains how to change file and directory permissions using SSH. It covers the chmod command and its usage for modifying file permissions on a Linux server.

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 755. The goal of this article is to change it to file permission 644.

  1. Connect to SSH via Windows or connect to SSH via Mac OSx.
  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.

    Screenshot of VD File Permission 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.

     
  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

     
  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.

 

 

Loading...