Change the permissions of a file in SSH

To change the permissions of a file in SSH, once you have logged in, you can use the CHMOD command. Here are a few common examples of CHMOD:

chmod number filename

chmod 600 example.html - This will give the file read and write permissions by the owner only (-rw-------).
chmod 644 example.html - This will give the file read and write permissions by the owner and read by everyone else (-rw-r--r--).
chmod 700 example.html - This will give the file read, write and execute permissions by the owner only (-rwx------).
chmod 755 example.html - This will give the file read, write and execute permissions by the owner, read and execute permissions by the group and others (-rwxr-xr-x)
chmod 666 example.html - This will give the file read and write permissions by everyone(-rw-rw-rw-) (NOT RECOMMENDED)
chmod 777 example.html - This will give the file read, write and execute permissions by everyone (-rwxrwxrwx) (NOT RECOMMENDED)

Changing the ownership

To change the ownership of a file in SSH, you can use the CHOWN command. e.g: chown owner filename

chown user example.html
chown user:group <directory-name>

chown apache avatars

Leave a Reply