Virtual hosts user management

I have an Ubuntu LAMP stack where different sites are hosted.

I want to create users so that can S/FTP to a specific directory of a single domain.

Anyone can point me in the right direction? A linode library article perhaps?



[Edit] Like Musfuut pointed out, I forgot to mention the flavor of linux I'm using. Ubuntu ;)

6 Replies

You don't mention your distro but here is a link from the library regarding debian and ubuntu.

I just recently set up a jailed sftp for our web designer to have access to "his" content.

It isn't too too hard to set up.

Thanks Musfuut!

That looks like it should do the trick.

I've been looking on the library but I think I was missing a…search criteria.



Hehe don't worry about it! I find myself lost at the library too sometimes. :)

Good luck!


Now, the way I read this is that I am creating a user and giving access to the user through sftp to that users home directory and that's it.

The thing is that I want my user to be able to manage the files inside the public_html of a domain, let's say:


I'm not sure this accomplishes the same thing.

Yep, basically you create a new user, if you don't want them to be able to log in to the shell edit their line in /etc/passwd and change their /bin/bash to /bin/false

Then have your directory


you make sure root owns srv, www, and

The user needs to own public_html and the files inside of it

then edit /etc/ssh/sshd_config per the instructions

set their chroot directory to /srv/www/

When they log in they will be resticted to and whatever folders are inside of it, including public_html.

Hope this helps, write back if you have any more questions. :)

ok, i see what you mean.

I also just ended up on this thread, which is quite explanatory as well.

One question. I need to have some directories (cache, logs) to be owned by the www-data user so my app can write to them. So, if I change the ownership of then I need to later reassign those back to the www-data user, right?


Please enter an answer

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] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct