Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to create a new sftp user in Ubuntu 12.04.4 and am running into some trouble. After creating the first sftp user, I document the commands for later user and then delete the user and try again just to make sure I have documented the commands correctly. I got it working the first time via following commands:

chown root:root /var/www
chmod -R 755 /var/www
adduser newuser --gecos "" --disabled-password --home /var/www
addgroup globalsftp
usermod -G globalsftp newuser
echo "newuser:password" | chpasswd
cd /var/www && find -name '*' -type d -exec chown -R newuser:globalsftp {} \;

This is what I have at the end of my sshd_config file

Match Group globalsftp
PasswordAuthentication yes
ChrootDirectory /var/www
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp

The first Time I create the user and connect, everything worked fine, I could create new files in the chowned subdirectories of /var/www but directly in /var/www which is what I wanted. But After I deleted the user and tried again, whenever I try to connect via Filezilla, I get this message:

Unable to connect
Connection reset by peer

Because I deleted the user that it worked with I no longer have any working sftp users. I have checked my auth.log and have found nothing useful.

I would greatly appreciate your help.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.