How do I change permissions/ownership of a file using FTP/SSH with Plesk?

This article applies to 123 Reg servers running Plesk.

Please note: this article was originally created for our previous generation of Virtual Private Servers. As such, these instructions may not be relevant to our current generation of Virtual Private Servers.

File permissions can be changed in a variety of ways; the easiest is via FTP. Once you are FTP’d into the your server, your FTP client will have an option for changing the permission of a file. Typically you will right-click on a file and then have a option to change the permissions.

In order change the ownership of a file, you will need to utilize sFTP. You can use an sFTP client to get into the server as user ‘root’ over the ssh port (22 or 8888 by default). The sFTP client will have the same options as an FTP client but will also allow you to change the ownership and group permissions of a file.

If you are able to access the server via ssh (as root), then the following commands will be used to update the permissions and ownerships of a file.

</>

Permissions:
chmod (permissions) filename

</>

Ownership:
chown user:group filename

Examples:

a) Modify permissions: To modify the permissions of a file use the chmod command.

</>

servint:# ls -la filename.php
-rwxrwxrwx 1 0 2010-11-29 08:34 filename.php

servint:# chmod 644 filename.php

servint:# ls -la filename.php
0 -rw-r–r– 1 0 2010-11-29 08:34 filename.php

Note the permissions changed from -rwxrwxrwx (777) to -rw-r–r– (644).

b) Modifying ownerships: To modify the ownership of a file use the chown command.

</>

servint:# ls -la filename.php
0 -rw-r–r– 1 root root 0 2010-11-29 08:34 filename.php

servint:# chown user:group filename.php

servint:# ls -la filename.php
0 -rw-r–r– 1 nobody root 0 2010-11-29 08:34 filename.php

servint:# chown nobody:nobody filename.php

servint:# ls -la filename.php
0 -rw-r–r– 1 nobody nobody 0 2010-11-29 08:34 filename.php

Note that the first variable after shown is the user then a colon followed by the group.