Question

How to create a limited ftp account?

  • Posted August 15, 2014

Hello So, now I have this problem… I’m able to create a new user and change it’s home folder to where I want:

adduser --no-create-home username
chown username:username /var/www/html/
usermod --home /var/www/html/ username

But now how can I limit this user to see/write only in its home directory (/var/www/html/) and not go above this directory via ftp? Right now the user is able to see everything. Anyone has any ideia? I was not able to find an answear for this using openssh-sftp. I’m using ubuntu 14.04, btw.

Thank you!

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Is there any security issue with containing Group users except myself (mr-admin) in sshd_config this way:

… Match Group users ChrootDirectory %h AllowTCPForwarding no X11Forwarding no ForceCommand internal-sftp

Match User mr-admin ChrootDirectory / AllowTCPForwarding no X11Forwarding no ForceCommand internal-sftp

Hey, I read here: https://www.digitalocean.com/community/tutorials/how-to-set-up-vsftpd-on-ubuntu-12-04

and under step two, you’ll find:

sudo nano /etc/vsftpd.conf

By uncommenting command to chroot_local_user. When this line is set to Yes, all the local users will be jailed within their chroot and will be denied access to any other part of the server.

chroot_local_user=YES

that way, you make boundaries.

where you using the correct port 22 in filezila for the new user?

This comment has been deleted

To limit an SFTP user to their home directory, you can edit /etc/ssh/sshd_config to include:

Match User username
    ChrootDirectory %h
    AllowTCPForwarding no
    X11Forwarding no
    ForceCommand internal-sftp

Then restart ssh:

service ssh restart