I can write in /var/www/html through the terminal in ssh, but to create a file by sftp through Filezilla, the file created have permissions 000.

How do I fix this? My problem is with these permissions, I want to create files by sFTP (filezilla) and I can not at all.

I'm using Ubuntu 14.04 with Nginx and FastCGI and HHVM (I'm testing).

Print Screen Filezilla File List



  • Can you show the file permissions of html dir in /var/www? I wonder if you are missing the sticky bit. chmod +s /var/www/html ls -l /var/www/html
    – devnull
    Commented Jan 17, 2015 at 17:35
  • Edited the question and added the 2 images. Now you can see file list /var/www and /var/www/html
    – D3F4ULT
    Commented Jan 17, 2015 at 17:42
  • what is ubuntu 4.14 ? did you mean 14.04 ? Commented Jan 17, 2015 at 18:29
  • LOL - Ubuntu 14.04 ***, fix it.
    – D3F4ULT
    Commented Jan 17, 2015 at 18:33

1 Answer 1



I came across this post, see if this helps: https://serverfault.com/questions/228396/how-to-setup-sshs-umask-for-all-type-of-connections

Add these lines to: /etc/pam.d/sshd

# Setting UMASK for all ssh based connections (ssh, sftp, scp)
session    optional     pam_umask.so umask=0027

You might also need to add them to: /etc/pam.d/login

Edit: /etc/ssh/sshd_config and add the -u flag to set the umask value.

Subsystem sftp /usr/lib/openssh/sftp-server -u 0002

Restart ssh to have the changes take affect:

service ssh restart
/etc/init.d/ssh restart
  • I had done this, I tried again and it still fails.
    – D3F4ULT
    Commented Jan 17, 2015 at 18:13
  • See if the above helps out, I'm believe something in your setup is setting a umask of 0777 which creates files with an octal permission value of 0000: no permissions to read, write or execute.
    – devnull
    Commented Jan 17, 2015 at 18:27
  • I still can not, I'll keep trying until I succeed. This is very strange and bizarre because I've done it other times and never had this strange problem.
    – D3F4ULT
    Commented Jan 23, 2015 at 20:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .