Category: General Linux

How to set file and folder permissions for FTP users in CentOS & Redhat Linux

To check the current permissions use the following command when you are at the relevant top folder:

ls -l

This will output something similar to this:

drwxrwxr-x 13 ftpuser apache 4096 Dec  9 16:09 folder1
drwxrwxr-x 10 ftpuser apache 4096 Jan  5 16:55 folder2
drwxrwxr-x  5 ftpuser apache 4096 Oct  5 13:14 folder3
drwxr-xr-x  2 root    root   4096 Jan  4 10:35 folder4

To set /folder4 the same as the other folders, so that ‘ftpuser’ owners the folder and allow any member of apache group to access files inside, run the following command: (when logged on as root).

chown ftpuser:apache /var/www/html/folder4

now that same command: ls – l reveals the following:

drwxrwxr-x 13 ftpuser apache 4096 Dec  9 16:09 folder1
drwxrwxr-x 10 ftpuser apache 4096 Jan  5 16:55 folder2
drwxrwxr-x  5 ftpuser apache 4096 Oct  5 13:14 folder3
drwxr-xr-x  2 ftpuser apache 4096 Jan  4 10:35 folder4

Finally to change the permissions to allow write access:

chmod -R 755 folder4

Or

chmod -R 775 folder4

Depending if you need the Apache group to write to the folder or not. (755 is more restrictive but adequate for most applications)

Tags:

Linux

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.