Wednesday, October 26, 2016

sFTP access issues on Ubuntu



I've setup sFTP access on an Ubuntu 9.10 Karmic server but i'm having what i think are permission issues.



With the sFTP account i've created it logs in automatically to:





/srv/www/domain.com/




However, i'm only actually able to upload to:




/srv/www/domain.com/public_html





This is not workable as i need to create directories etc parallel to public_html. I appreciate this is something i've probably done wrong as its patched together from a few help files.



I followed these instructions to create a group for sFTP access, i then created a user and then mod'ed their home directory using:




usermod -d /srv/www/domain.com newuser




Let me know if there's any other information you need to troubleshoot this.




OUTPUT OF COMMANDS



> ls -al /srv/www/domain.com/ | grep public_html
drwxr-xr-x 2 newuser newuser 4096 2010-08-24 12:38 public_html

> ls -al /srv/www/ | grep domain.com
drwxr-xr-x 5 root root 4096 2010-08-24 12:21 domain.com

> groups newuser

newuser : newuser filetransfer

> ls -ld /srv/www/domain.com/
drwxr-xr-x 5 root root 4096 2010-08-24 12:21 /srv/www/domain.com/

Answer



You are using the ChrootDirectory directive of OpenSSH.



This will only work if the home directory of the respective user is owned by root:root and is not world or global writable (ie. has the permission mask 0755 but not 0770). sshd will issue a warning in your auth.log (or the destination of syslog facility AUTH) otherwise.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...