How to use the SSH chmod command
Learning how to use the SSH chmod command is essential whenever you need to edit the permissions of your files and directories. The topic of ownership and permissions is vast, but you do not need all of it to get started. In this article, we will show you how to use the SSH chmod command with simple, practical examples so you can set the right permissions with confidence.
How to use the SSH chmod command
In short, chmod (change mode) sets who can read, write, and execute a file or folder. To get started, connect to your account over SSH, then run the examples below.
Basic chmod usage with numbers
First, the most common method uses three digits for the owner, group, and everyone else. For example, 644 is typical for files and 755 for directories:
chmod 644 myFile.txt
chmod 755 myDirectoryEach digit is a sum: read is 4, write is 2, and execute is 1. So 6 means read and write, while 7 means read, write, and execute.
Set permissions with symbols
Next, you can also change a single permission using symbols. Use + to add and - to remove, followed by x (execute), r (read), or w (write):
chmod +x myScript.sh
chmod -x index.phpApply permissions to a whole folder
Finally, add the -R (recursive) flag to apply the same permissions to a directory and everything inside it. Use this carefully, because it affects every file at once:
chmod -R 755 myDirectoryBecause incorrect permissions can expose or break your website, always double-check the values before you apply them, especially on public folders.
Need more help?
Master the basic Linux commands with examples on a SSH shared hosting account, or get full root control with a JetHost VPS. Both include free SSH access and full Linux terminal support, so you can run the SSH chmod command directly on your server today.


