I've been following this tutorial "Limiting Access with SFTP Jails on Debian and Ubuntu" and whilst I've had no errors setting it up, I've had issues on Ubuntu 10.04LTS logging in as a user on a virtualhost. I've changed my SSH port to 22022, and enter all the credentials when attempting to login.

I ran these commands to add a user to the virtualhost:

# useradd -d /srv/www/[domain] [username]
# passwd [username]
# usermod -G filetransfer [username]
# chown [username]:[username] /srv/www/[domain]/public_html

I should add that this is the only time I've setup the user they have no other /home directories or such. The directory that does exist is at /srv/www/example.com/public_html

When I try using a desktop package such as cyberduck to login to the site, I keep getting a "Login failed with this username or password". I am completely lost as what to do next...

The reason why I'm trying this method is because I want my clients to use SFTP and not FTP to upload files to their websites. Any help or direction is appreciated.

  • Have you looked at the logs on your system? For example, /var/log/auth.log might provide some information as to why the authentication is denied. Alternatively, /var/log/syslog or /var/log/messages might have information relating to a configuration error on the SFTP subsystem. – David Feb 6 '11 at 0:10
  • Thanks for the tip, I managed to find out the issue: "User sftpuser from not allowed because not listed in AllowUsers". Seems as though I should add the "filetransfer" usergroup to the Allowed users list - maybe you could give some direction on how to do that? – 0xDonut Feb 6 '11 at 0:24
  • I actually have "Match group filetransfer ChrootDirectory %h..." listed in /etc/ssh/sshd_config. I wonder why the group isn't getting any special treatment.. – 0xDonut Feb 6 '11 at 0:37

Try this:

  • Install MySecureShell http://sourceforge.net/projects/mysecureshell/
  • Create users with:

    useradd -d /srv/www/[domain] -s /bin/MySecureShell [username]

    Here it goes the passwd, mkdir and chown

  • Check MySecureShell at /etc/ssh/sftp_config, be sure you have this line

    Home $HOME

  • Check the other configurations like download/upload bandwidth limit or connections limits.

  • Be sure you can access the public_html directory by apache user or whatever user runs apache server. Maybe you can do:

    chown -R [username]:apache /srv/www/[domain]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.