vsftpd: chrooting user to other directory than home?

Posted on 2005-05-04
Last Modified: 2013-12-15
Does anyone know how to jail a user (NOT virtual) into another directory or subdirectory of home?

Question by:laureen
    LVL 10

    Expert Comment

    LVL 10

    Expert Comment

    LVL 4

    Expert Comment

    What do you mean? Do you want to keep the user in its chroot jail i.e. in its home directory or another directory that is not its home directory?

    If you want to keep the user limited to its home directory only then. Just do add following line in your vsftpd.conf file.


    This will place all the local users in the jail of their home directory. Their root directory is their home directory.
    You can also place the selected users in the home directory jail and others not. For more details on doing this see the man pages of vsftpd.conf.


    LVL 1

    Author Comment

    i have read the vsftpd.conf man pages very carefully but i didn't find any solution for my problem.
    here a short example of what i want to do:

    user "jack" has homedir "/home/jack" in /etc/passwd
    and i want to jail him to "/home/jack/xxx"

    is this possible with vsftpd without patching?

    btw: i'm using fedora 3 with vsftpd 2.0.1

    LVL 7

    Accepted Solution

    Bit tricky but can be done

    for eg:
    User jack needs to be locked in directory /home/jack/ftp_home

    open /etc/vsftpd/vsftpd.conf

    and add this line  


    Once this is done open /etc/passwd
    and edit the line


    change it to


    restart vsftpd .

    Note: This does not effect any other services. User normally gets his home directory .

    If enabled, along with chroot_local_user , then a chroot() jail location may be specified on a per-user basis. Each user's jail is derived from their home directory string in /etc/passwd. The occurrence of /./ in the home directory string denotes that the jail is at that particular location in the path.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
    Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now