Score:2

Umask not working when using SFTP/SCP directories to achieve 755 for directories, 644 for files

cn flag

I'm using EC2 Ubuntu 20.04 and got the umask set to 022. But however, any file/directory creations are landing up with permissions 775 for directories and 664 for files, just like default 002 umask is considered.

Tried many ways and changed the following:

Added "umask 022" in ~/.bashrc
Added "umask 022" in ~/.profile
Added "umask 022" in /etc/profile and /etc/bash.bashrc
Added "session optional pam_umask.so umask=0022" in /etc/pam.d/login

But none of them worked with FileZilla/WinSCP. I read that none of the above are considered for FTP clients. All I wanted to achieve is to create files and directories with 644 and 755 permissions respectively. Appreciate your help!

tr flag
See [SFTP-server uploaded files having wrong rights](https://serverfault.com/q/645150/168875). + So FTP or SFTP, those are two completely different protocols.
Jagadeesh Ch avatar
cn flag
Thanks! Setting up default permissions in Transfer settings worked fine. I got umask "0022" on server too. But new files are still created with 664 (assuming 002?). Touch works fine as expected - 644. Any suggestions?
tr flag
How do you *"create new files"*?
Jagadeesh Ch avatar
cn flag
I was using - By right clicking on remote panel, new > file and then create
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.