Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want files sent to my server using sftp and scp to be group-writable. How can I do that?

I tried using libpam-umask from http://wiki.debian.org/DebianDesktopHowTo but it didn't work.

EDIT: Is there any way I can troubleshoot pam? Is there a log? Is there any common reason why libpam-umask would not work? Do I have to install something?

share|improve this question

I had similar umask problems: trying to get all files in a directory to be group readable no matter who created them.

I got a bit stuck at first; I could set the sticky bit on the group, so all files had same group, but, at first, could find no way to set permissions consistently and correctly. (The use of a cron job to regularly put it right did not seem satisfactory.)

But then I found the solution. Posix ACLs, you can set in a directory properties(users, groups, permissions/modes) to inherit, setting the default mode for user and group will have the effect that you want.

You will probably need to install it, and new backup tools (the default ones don't always know about ACLs)

as root once:

apt-get install acl

as owner of directory (the 3rd line sets the default mode to the current mode for all directories in $dir):

chmod -R ug+rwX 
find $dir -type d -print0 | xargs -0 -i{}  bash -c "getfacl --access {} | setfacl -d -M- {}"
share|improve this answer

I think PAM reads the default umask from /etc/login.defs as of Debian 6.0, but I do not currently have access to a system to check on.

share|improve this answer
The comments in this file (on lenny) warn that the setting is only used by login, and that in general one should use the pam_umask module. – Gilles Feb 17 '11 at 7:41
Right, on Squeeze I believe the comment says that pam_umask now reads the value from login.defs. – Arrowmaster Feb 17 '11 at 16:15
I edited /etc/login.defs and it didn't work – JoelFan Feb 18 '11 at 2:51
@JoelFan: default is #UseLogin no in Debian. So that's why it wouldn't work. – 0xC0000022L Mar 11 '11 at 13:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.