Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

File structure:

enter image description here

I have a VPS running Debian OS and would like to create user accounts on it.

I want it so that when the user logs in with FTP, everything in var appears to be their home directory and they cannot cd out of it.

For example, when user3 logs in, they have access to everything in var (read, write, execute) but cannot view (cd) user1 or user2's personal stuff.

How would I go about doing this?

I think I have to do this in chroot, but I have no idea how this would work.

share|improve this question
This depends on the FTP software you choose. ProFTPd, Pure-Ftpd, vsftpd, etc. – John T Feb 25 '11 at 1:44
Well, the ftp software I'll have my clients connect to is FileZilla, but don't I set this in Putty? – Kevin Duke Feb 25 '11 at 2:06
Yeah are you sure I can make user accounts via ftp? pretty sure you can't – Kevin Duke Feb 25 '11 at 3:33
Do you want the same username to have a different home directory if they login via shell versus login via ftp? – mpez0 Feb 25 '11 at 13:23
I don't really care as long as they are jailed in sFtp, but it would be nice if they were the same – Kevin Duke Feb 25 '11 at 13:34
up vote 1 down vote accepted

This can be done simply by creating a new user-account for every user with 'adduser' and changing the home (-b default_home) to your servers dir. [to add a password use passwd]

Then install ProFTPd, and set it to work on Defaultroot ~ That should be all.

You should check this link out:

share|improve this answer
Thanks. I created a new user with adduser and it put it in the /home directory. I then cd into /home/demo and typed 'home -b default_home' and it said, command home not found. – Kevin Duke Feb 25 '11 at 4:25
I think I did this wrong, this time I tried useradd -d /home/duke/aa/servers/demo -g users -p demo with password demo, but I still don't know where to set user name.. Can you please spell it out for me, I'm really dumb – Kevin Duke Feb 25 '11 at 4:40
do i need to create a new group and put all the users into this group? – Kevin Duke Feb 25 '11 at 4:54
ok so i got useradd -d /home/duke/aa/servers/demo/var/ -g users demo to create the username demo but how do I assign r/w/e permissions and deny them from going up a dir into other people's stuff – Kevin Duke Feb 25 '11 at 9:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .