• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Configure VSFTPD Chroot Environment in CentOS and RHEL

by admin

vsftpd stands for ‘Very Secure FTP Daemon’, is an FTP server for Unix-like systems, including Linux. When we configure vsftpd, all FTP users can move to other’s directories from their home folders. In this article we will make the changes in the vsftpd server so that user’s are limited to their home directory only. This can be achieved by setting up a vsftpd chroot or jail-like environment.

As shown in the below examples, jack is an FTP user, who can change their directory.

ftp command line

Now Follow below steps to configure chroot or jail like Environment in vsftpd :

Step 1: Edit the config file ‘/etc/vsftpd/vsftpd.conf‘

[root@localhost ~]# vi /etc/vsftpd/vsftpd.conf
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot(). 
chroot_local_user=YES
chroot_list_enable=YES 
# (default follows) 
chroot_list_file=/etc/vsftpd/chroot_list

Save & exit.

Important Notes
1. if you are only uncommenting the line ‘chroot_local_user=YES’. All the local users are chroot() or jailed to their home directory.

2. if we want only selected ftp users restricted to their home directory, then uncomment the line “chroot_list_enable=YES” and ‘chroot_list_file=/etc/vsftpd/chroot_list” and create a file ‘/etc/vsftpd/chroot_list‘ and add the users that we want to chroot.

Step 3: Create a file ‘/etc/vsftpd/chroot_list’

[root@localhost ~]# vi /etc/vsftpd/chroot_list
jack

Users listed in this file will be restricted to their home directory.

Step 4: Start the ftp service using below command.

[root@localhost ~]# service vsftpd restart ; chkconfig vsftpd on 
Shutting down vsftpd:                                      [  OK  ]
Starting vsftpd for vsftpd:                                [  OK  ]
Step:5 Now do  the testing

In case of ‘chroot_local_user=YES‘

ftp command

In case of ‘chroot_list_enable=YES‘ and ‘chroot_list_file=/etc/vsftpd/chroot_list‘. users listed in chroot_list file will be restricted and other users are allowed to change the directory. In My scenario i have two local users Jack & Mark, where jack is listed in chroot_file.

Filed Under: CentOS/RHEL, Linux

Some more articles you might also be interested in …

  1. Understanding the Network interface configuration file /etc/sysconfig/network-scripts/ifcfg-eth#
  2. How to Use Iperf to Test Network Performance in Linux
  3. dracut: command not found
  4. lftp Command Examples in Linux
  5. How to change the Default Log Directory(/var/log) in Rsyslog for CentOS/RHEL 6,7
  6. aa-complain: command not found
  7. CentOS / RHEL 7 : Unable To Start The Samba Service
  8. vgextend Command Examples in Linux
  9. How to Start, Stop and Restart Zimbra Service
  10. Insert into search_tmp… queries never ends

You May Also Like

Primary Sidebar

Recent Posts

  • pw-cat Command Examples in Linux
  • pvs: command not found
  • pulseaudio: command not found
  • pulseaudio Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright