Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Apr 2010
    Posts
    12

    Default SFTP/FTPS and permissions

    I'm currently running php with suphp, and generally I'm very happy about it, but due to security concerns, I'm trying to tighten the security of the client/server connections, I've tried both SFTP and FTPS, but
    • SFTP: When I connect with SFTP instead of landing in /home/username I land in /, that's more of a nuisance than anything else, but it'd be nice to have a fix for it. Plus all the newly created files have 0666 permissions (dirs are 0777)
    • FTPS: Works like a charm if I set it as Explicit, but new files are 0664 and new folders are 0775.

    Now, the problem lies in the fact that suphp kinda doesn't want files to have permissions higher than 0644 (0755 for folders), is there a way to configure this setting in a clean way? Would it be possible for you people to implement such a configuration natively in the next updates (so ppl that use suphp don't have to do it manually on each server)?

    I forgot to mention I'm running Pure-FTPd, dunno if the other daemon is better for this.

  2. #2
    Member
    Join Date
    Apr 2010
    Posts
    12

    Default Re: SFTP/FTPS and permissions

    for SFTP I've been able to fix it on some clients, but for some reason there's this line in /etc/bashrc
    Code:
    if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
            umask 002
    else
            umask 022
    fi
    setting umask to 002 for normal users, meaning that the aforementioned problem with FTPS occurs. Any reason why this should be happening?

  3. #3
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,891
    cPanel/Enkompass Access Level

    Root Administrator

    Question Re: SFTP/FTPS and permissions

    Quote Originally Posted by Daniele.Gri View Post
    I'm currently running php with suphp, and generally I'm very happy about it, but due to security concerns, I'm trying to tighten the security of the client/server connections, I've tried both SFTP and FTPS, but
    • SFTP: When I connect with SFTP instead of landing in /home/username I land in /, that's more of a nuisance than anything else, but it'd be nice to have a fix for it. Plus all the newly created files have 0666 permissions (dirs are 0777)
    • FTPS: Works like a charm if I set it as Explicit, but new files are 0664 and new folders are 0775.

    Now, the problem lies in the fact that suphp kinda doesn't want files to have permissions higher than 0644 (0755 for folders), is there a way to configure this setting in a clean way? Would it be possible for you people to implement such a configuration natively in the next updates (so ppl that use suphp don't have to do it manually on each server)?

    I forgot to mention I'm running Pure-FTPd, dunno if the other daemon is better for this.
    When you connect via SFTP who are you logging in as?
    Fav cPlinks this week: Blog - cPanel & WHM 11.32 we love it! | cPanel University study for it! | Attracta is coming! we want this!

  4. #4
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,304
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: SFTP/FTPS and permissions

    The lines in /etc/bashrc are not default part of any CentOS installation:

    Code:
    root@host [~]# grep -i mask /etc/bashrc
    root@host [~]#
    These values were added by someone. You could try commenting them out otherwise to see the results, but they were not added by cPanel.

    I did find those lines in the csh files, but csh isn't the default shell on most systems:

    In /etc/csh.login file:

    Code:
    # Set umask consistently with bash for loginshells (csh.login sourced
    # after csh.cshrc unlike with bash profile/bashrc scripts and umask
    # might be modified in profile.d csh scripts)
    if ($?loginsh) then
      if ($uid > 99 && "`id -gn`" == "`id -un`") then
          umask 002
      else
          umask 022
      endif
    endif
    In /etc/csh.cshrc file:

    Code:
    # By default, we want this to get set.
    # Even for non-interactive, non-login shells.
    if ($uid > 99 && "`id -gn`" == "`id -un`") then
        umask 002
    else
        umask 022
    endif
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads & Tags
Similar threads

  1. Difference between SFTP and FTPS Accounts?
    By wyattbiker in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 07-05-2011, 02:30 PM
  2. can restrict Domain Owner to SFTP and FTPs only ?
    By frn.linux in forum New User Questions
    Replies: 1
    Last Post: 09-27-2010, 05:10 PM
  3. Need help on enabling SFTP or FTPS
    By danielk in forum New User Questions
    Replies: 2
    Last Post: 12-30-2009, 05:00 AM
  4. how to activate ftps for my users
    By Radio_Head in forum Themes and Branding
    Replies: 2
    Last Post: 06-19-2003, 05:30 AM
  5. annon ftps
    By TheVoice in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 07-25-2002, 09:16 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube