1

Ubuntu 20.04 VPS

I've read multiple threads on this and still don't get it. I have an FTP user deanhh for ONE of multiple virtual hosts in apache2. There are other FTP users also, for other domains. Deanhh is the owner of his domain's folder. When he creates a folder or creates and uploads a file via FTP he is the owner of the folder/file. That's what I want.

BUT the file has no permissions on it for other. I set umask 0000 on the telnet command line yesterday. Everything worked fine. When deanhh uploaded a file via FTP it inherited the permissions of the folder. Now umask is back to 0022 so when he uploads a new file or creates a folder there are no permissions on it for other.

How do I set it so that when an FTP user creates a folder or uploads a NEW file, they retain ownership AND 'other' has the permissions that were set for 'other' on the folder the file was uploaded to - PERMANENTLY?

1 Answer 1

2

The simplest way would be to edit the /etc/login.defs file. Here's how:

  1. SSH into the server
  2. Open the /etc/login.defs file with sudo:
    sudo {your editor of choice} /etc/login.defs
    
  3. Find the row that starts UMASK. It may be around line 155 and look like this:
    UMASK           022
    
  4. Change 022 to whatever value you prefer
  5. Save the file and exit

The next time a person connects to their account, be it SSH or FTP, the appropriate umask will be applied.

2
  • I did this and just tested it. It didn't work. sudo nano /etc/login.defs UMASK 0000 I logged into FTP as the domain owner and uploaded a new file. ls -l /var/www/deanhh.com -rw------- 1 deanhh deanhh 842 Dec 19 14:59 page21.php
    – kristy1024
    Dec 19, 2021 at 15:00
  • I did this and just tested it. It didn't work. Telnet into VPS as root sudo nano /etc/login.defs UMASK 0000 Saved it and reopened just to make sure. I logged into FTP as the domain owner and uploaded a new file. Then command line: ls -l /var/www/deanhh.com -rw------- 1 deanhh deanhh 842 Dec 19 14:59 TestWrite.php It did not work. There are no permissions for user group or other. Owner group should have rw and other should have r permission. Please let me know how I can solve this problem.
    – kristy1024
    Dec 19, 2021 at 15:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .