chroot/chjail for certain directories

Posted on 2006-05-10
Last Modified: 2013-12-16
I have a project where I need to give some users access via samba, scp and ftp (vsftp).
The dir structure is setup as such.


What I am trying to do is keep everyone of the users inside /var/ftp and not be allowed outside, but allowing them to place items in any of the user directories.

Please help.

Question by:iceman19330
    1 Comment
    LVL 15

    Accepted Solution

    Jailing samba is trivial - you just expose the shares of these directories and that's it, no going outside of them.

    To jail vsftpd users, add:


    to /etc/vsftpd/vsftpd.conf

    and create /etc/vsftpd.chroot_list file. Note that /etc/vsftpd.chroot_list will contain user names of users who are NOT supposed to be jailed, the rest of them will be confined to their home directories. After that, you just change user directories in /etc/passwd to point to /var/ftp/user.... Don't forget to restart vsftpd.

    3rd part of the puzzle, jailing SCP access is explained here:

    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

    Join & Write a Comment

    rdate is a Linux command and the network time protocol for immediate date and time setup from another machine. The clocks are synchronized by entering rdate with the -s switch (command without switch just checks the time but does not set anything). …
    Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

    754 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

    22 Experts available now in Live!

    Get 1:1 Help Now