CentOS Icon CentOS Logo
CentOS Text
   
  
www.centos.org Forum Index
   CentOS 6 - Software Support
  CentOS 6 + OpenSSH 5.3 (SFTP file permissions) umask is not working for me.

 

 Bottom   Previous Topic   Next Topic
  •  Rate Thread
      Rate this Thread
      Excellent
      Good
      Average
      Bad
      Terrible
Poster Thread
  •  mckain
      mckain
CentOS 6 + OpenSSH 5.3 (SFTP file permissions) umask is not working for me.
#1
Newbie
Joined: 2012/5/14
From
Posts: 2
Hey everyone,

I've been trying to set umask 002 to my sftp users, I already tried setting the umask in the following files:

/etc/ssh/sshd_config:


  Subsystem sftp    /usr/libexec/openssh/sftp-server            #works
    #Subsystem sftp /usr/libexec/openssh/sftp-server -u 0002              #failed
    #Subsystem sftp /bin/sh -c ‘umask 0002; /usr/libexec/openssh/sftp-server’ #failed
    #Subsystem       sftp    /opt/sftp-server-wrapper.sh                      #failed
    #Subsystem   sftp    /bin/bash -c ‘umask 0002; /usr/libexec/openssh/sftp-server’ #failed



/etc/pam.d/sshd:

(session    optional     pam_umask.so umask=0002)



I know that if you are using a newer version for OpenSSH you can use the '-u' option, so I tried to upgrade it but yum says that there is no newer version for OpenSSH and I don't want to install it manually haha because I don't know if at the this will resolve my issues.

Do you know how to set umask to sftp with OpenSSH 5.3?

Here are some details:

* CentOS 6
* OpenSSH 5.3

Also,

I tried to set the umask to /etc/pam.d/login too like this:

session    optional     pam_umask.so developers umask=0002


I restarted the sshd service after that but, nothing happened, everytime I login with my ftp account and upload a file I still got the rw-rw-r permissions.

I've been researching over the web about this issue but there is no info about this.

I just need to set the permissions or umask for my users to 775,

I would appreciated some help!

Thank you in advance!
Posted on: 2012/5/15 16:30
Create PDF from Post Print
Top
  •  gerald_clark
      gerald_clark
Re: CentOS 6 + OpenSSH 5.3 (SFTP file permissions) umask is not working for me.
#2
Professional Board Member
Joined: 2005/8/5
From Northern Illinois, USA
Posts: 6184
Looks like it is working to me.
0002 is masking out write for others.
Posted on: 2012/5/15 16:53
Create PDF from Post Print
Top
  •  mckain
      mckain
Re: CentOS 6 + OpenSSH 5.3 (SFTP file permissions) umask is not working for me.
#3
Newbie
Joined: 2012/5/14
From
Posts: 2
Hey gerald,

Thank you for your answer, but now, what are your configuration details?

I've been playing with this issue for over 40 hrs, this is so frustrating :S

Thank you!
Posted on: 2012/5/15 17:39
Create PDF from Post Print
Top
  •  pschaff
      pschaff
Re: CentOS 6 + OpenSSH 5.3 (SFTP file permissions) umask is not working for me.
#4
Moderator
Joined: 2006/12/13
From Tidewater, Virginia, North America
Posts: 18773
According to BZ#657059 and the 6.1 Technical Notes umask should work, but they are sketchy on the details.

The Deployment Guide OpenSSH chapter mentions local_umask.
_________________
Phil

Recommended reading: FAQ & Readme first ; Search hint: google "your topic site:centos.org"; Smart Questions
Posted on: 2012/5/15 19:30
Create PDF from Post Print
Top
  •  detlef
      detlef
Re: CentOS 6 + OpenSSH 5.3 (SFTP file permissions) umask is not working for me.
#5
Newbie
Joined: 2012/5/17
From Dortmund, West-Germany
Posts: 1
Hi mckain,

sorry, but you are right...
The entry in /etc/pam.d/sshd is the one which works!

Your comment is right:
(session optional pam_umask.so umask=0002)
I restarted the sshd service after that but, nothing happened, everytime I login with my ftp account and upload a file I still got the rw-rw-r permissions.

But you got this permissions, because you set the umask to 0002, that´s happend.

umask=0002 -rw-rw-r-- permissions
umask=0022 -rw-r--r-- permissions

Without your entry you will upload files with -rw-r----- permissions.

Don´t worry, be happy!
You help me so much for my same problem, that´s the solution!
Posted on: 2012/5/17 21:55
Create PDF from Post Print
Top
 Top   Previous Topic   Next Topic

 


 You cannot start a new topic.
 You can view topic.
 You cannot reply to posts.
 You cannot edit your posts.
 You cannot delete your posts.
 You cannot add new polls.
 You cannot vote in polls.
 You cannot attach files to posts.
 You cannot post without approval.




"Linux" is a registered trademark of Linus Torvalds. | All other trademarks are property of their respective owners. | All other content is Copyright @ 2004-2009 by the CentOS Project or "each individual contributor (forums, comments, etc.) unless otherwise assigned".| Theme based on a theme by 7dana.com