problem with umask.
Brought to you by:
xystrus
From: Ajay S. <ss...@am...> - 2003-10-24 04:00:17
|
I'm playing around with the umask and it seems like it's only applied on the files that it only reduces permissions and it won't increase them. Example: The umask is 022, the local file is 777, when you upload it, the file will become 755 on the server. Good! If the local file is 600 and you upload it then the file on the server will remain 600. Bad. I want to force the file to be group writable with a umask of 002 but this won't work if people are keeping their local files 600. Some output of what I'm talking about is below, I've also include the log entries so that you can see that the umask is being set correctly: Good: [ssharma@ajay ssharma]$ chmod 0777 test.sql [ssharma@ajay ssharma]$ ls -l test.sql -rwxrwxrwx 1 ssharma ssharma 38356 Apr 24 11:14 test.sql [ssharma@ajay ssharma]$ sftp us...@ho... Connecting to host.amntv.com... us...@ho...'s password: sftp> put test.sql Uploading test.sql to /home/user/test.sql sftp> ls -rwxr-xr-x 0 1000 1000 38356 Oct 22 11:50 test.sql sftp> Bad: [ssharma@ajay ssharma]$ ls -l test.sql -rw------- 1 ssharma ssharma 38356 Apr 24 11:14 test.sql [ssharma@ajay ssharma]$ sftp us...@ho... Connecting to host.amntv.com... us...@ho...'s password: sftp> put test.sql Uploading test.sql to /home/fosdick/test.sql sftp> ls -l test.sql -rw------- 0 1000 1000 38356 Oct 22 11:49 test.sql And here's what a connection looks like in the log: Oct 22 11:49:08 host sshd(pam_unix)[18646]: session opened for user user by (uid=1000) Oct 22 11:49:08 host rssh[18647]: setting log facility to LOG_USER Oct 22 11:49:08 host rssh[18647]: allowing scp to all users Oct 22 11:49:08 host rssh[18647]: allowing sftp to all users Oct 22 11:49:08 host rssh[18647]: setting umask to 022 Oct 22 11:49:08 host rssh[18647]: line 40: configuring user user Oct 22 11:49:08 host rssh[18647]: setting user's umask to 022 Oct 22 11:49:08 host rssh[18647]: allowing scp to user user Oct 22 11:49:08 host rssh[18647]: allowing sftp to user user Oct 22 11:49:08 host rssh[18647]: chrooting user to /var/www/clients.amntv.com/chroot/ Oct 22 11:49:08 host rssh[18647]: chroot cmd line: /usr/libexec/rssh_chroot_helper "/var/www/clients.amntv.com/chroot" 2 "/home/user" /usr/libexec/openssh/sftp-server Oct 22 18:49:08 host rssh_chroot_helper[18647]: new session for user, UID=1000 Oct 22 11:49:25 host sshd(pam_unix)[18646]: session closed for user user If this is the way that umask is supposed to work then please correct me. I'm certainly no unix expert so I could very well be wrong. Thanks, Ajay |