change FTP directory for user

Currently using Linode 360 Ubuntu 9.10 with LAMP stack. I used the "adduser" command and created a secondary user name.

When I use Filezilla and input the IP address, user, password and port (22), I get the security certificate message. I accept yes and I notice that the IP address is preceded by the moniker SFTP. I'm assuming I am in SFTP mode?

The user name I created has full access to all directories. I only wish the user to have access to the /srv/www/public_html/ folder to upload website files.

How do I change it to where upon bootup in Filezilla, it takes the user to that specific directory instead of full access? I did a full read of the users and groups documentation in the library but didn't see much about changing directories in default FTP/SFTP logins for created users.

2 Replies

Edit your /etc/ssh/sshd_config with the following changes

Set````
Subsystem sftp internal-sftp


Match Group ChrootDirectory /srv/www/public_html/
````

The directory /srv/www/public_html/ must be root owned and not writable by other users or groups (so you might want to set it to /srv/www)

Replacing the with the group of your new user (should be the same as your username) then restart ssh, disconnect and reconnect in filezilla.

Of course that won't stop them from accessing ssh (but it will lock them down)

Have a read of this for more information.

http://manpages.ubuntu.com/manpages/kar … fig.5.html">http://manpages.ubuntu.com/manpages/karmic/en/man5/sshd_config.5.html

I read your reply and saw the web link. Thank you for the info. I used the vim command to edit that file. I scrolled to the bottom of the page page and this is what I saw.

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

I'm a little foggy on your instructions. According to your instructions, I should delete what I have above and use this instead?

Subsystem sftp internal-sftp

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct