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

I have a VPS running CentOS5 with Apache 2.2 and mySQL, as well as VSFTPD for ftp. The user liam is a system user.

I want to make the /home/html directory the ftp root for the liam user, so that when the liam user logs in via an ftp client, he sees only the contents of the /home/html directory.

How could I do this?

share|improve this question
    
Is 'liam' a system account or are you using vsFTPd's virtual users? –  Aaron Copley Feb 22 '12 at 16:51
    
A system account –  Liam W Feb 22 '12 at 17:19
add comment

2 Answers

up vote 5 down vote accepted

First, you'll have to make the /home/html directory the home directory of the user liam. To do this, execute the following as root:

# usermod -d /home/html liam

You then need to set chroot_local_user=YES in the vsftpd config file.

There is a security aspect to using this setting, as described in this serverfault question.

share|improve this answer
    
Thanks, this worked :) –  Liam W Feb 22 '12 at 17:45
    
+1 for adding the home dir. I guess that is what I get for trying to answer this on my phone. –  Nic Young Feb 22 '12 at 18:03
    
i will +1 yours if i get my points, because u gave the half of it :] –  burninggramma Feb 22 '12 at 18:04
add comment

If liam is a system account you can enable ch_root to jail the user in the home directory. In your vstpd.conf just change the following lines:

chroot_local_user=YES

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.