I have two users who are only ftp users I set them up using this guide
I would like to change their default permissions when creating files to 775 instead of 755.
It seems like what I want is umask.
But umask doesn’t have an option to set for another user, only the logged in user (umask 002) and these users do not have ssh login, only ftp access.
So I need some way of changing the umask of these users as root or sudo.
There appears to be ~.profile but I changed the settings in here and it didn’t make a difference
Can anyone explain where I can change the umask for these users?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
In order to change the umask for a user you can use the following command:
sudo chfn -o umask=007 username
Experiment with the umask value in order to suit your needs :)
Hi, robjbrain. If you’re root, i think you can resolve your situation creating a file in /etc/profile.d/with this code:
userumask=$(id -un)
if [ "$userumask" = "user-of-your-interes" ]; then
umask 033 ; or the umask you want to that user
fi
/etc/profile calls the files in /etc/profile.d/ after setting umask with default rules, so your custom rule would take effect. I resolve a similar case with this code, but there is no clear documentation for this use cases.
Regards,
You can try ~/.bashrc beside ~./profile.
- sudo nano /home/user/.bashrc
Add line:
umask 002
Save file, exit and try again.
Also you can try to execute command as another user:
su -c "command" user
In your case:
- su -c "umask 002" user
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.