How to change file permission via SSH?

You may change file permission via SSH. Kindly follow the instructions below.

(Note: For Virtual Private Servers and Dedicated Server Hosting package only.)

Change file permission via SSH

Step 1. Connect to the webspace via SSH.

Step 2. Type in cd in the command line to enter the directory. (Check 1 in the image below.) You may also specify a directory name. cd /home

ls -alh To see the list of files in the current directory. (Number 2 in the image below.)

chmod 000 test.html to change file permission (Number 3 in the image below.)

(000 is only an example of the file permission)

Check the directory listing and see the difference of the file permission. (Number 4 in the image below.)

change file permission via SSH

File Permissions Explained

Each directory has 3 users:

  • Owner
  • Group
  • All user

d – refers to the folder or directory

Permission types:

  • r – permission to read the file (4)
  • w – permission to write on the file (2)
  • x – permission to execute the file (1)

Each user has a set of permission. If the permission is set to rwx, that is equivalent to 7. The first permission is for the owner, second is for the group and the third one is for the user.

So if the permission is 644, it should show drw-r–r–. The hyphen or dash means that the permission type is not used.

(Note: The default working permission for a file is 644 and for a folder is 755.)

Do not hesitate to contact our support team if you have further questions.

change file permission via SSH

(Visited 24 times, 1 visits today)