How To Install Chroot Vsftpd FreeBSD

What is VsFTPd?

Vsftpd is a GPL licensed FTP server for UNIX systems, including Linux. It is secure and extremely fast. It is stable. Don't take my word for it, though. Below, we will see evidence supporting all three assertions. We will also see a list of a few important sites which are happily using vsftpd. This demonstrates vsftpd is a mature and trusted solution.

We assume you have a FreeBSD server that online and running smoothly.

Install VsFTPd

Login as root

[code]$/usr/ports/ftp/vsftpd
$make install clean[/code]

Configure VsFTPd
[code]$vi /usr/local/etc/vsftpd.conf

## Edit the configuration like below

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
ftpd_banner=Welcome to Athena ftp service
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
secure_chroot_dir=/usr/local/share/vsftpd/empty

## save and exit[/code]

Added user into vsftpd.chroot_list
[code]$vi /etc/vsftpd.chroot_list

...

sentono
testing
....[/code]

Note : User Sentono and Testing is in chroot list so these user can't cd into the other directory or user can only write, read and access personal home directory

Example : /usr/home/sentono

If user is don't listed in chroot_list, user can see home directory like /usr/home and other directory.

Setting VsFTPd to running with Inetd
[code]$vi /etc/inetd.conf

## add this line in the end of this file

ftp stream tcp nowait root /usr/local/libexec/vsftpd vsftpd

## save this file[/code]

Restart Inetd Services
[code]$/etc/rc.d/inetd restart[/code]

Why we need to restart inetd?
This is because vsftpd is configure to running with inetd or not standalone

If you want to configure vsftpd standalone you need to add listen=yes in /usr/local/etc/vsftpd.conf

[code]$vi /usr/local/etc/vsftpd.conf

...
listen=yes
...

## save this file[/code]

Start VsFTPd services
[code]$/usr/local/libexec/vsftpd &
[1] 6519[/code]

Added  VsFTPD services in /etc/rc.local so when your server restart, your vsftpd services will automatically up and running again.

[code]$vi /etc/rc.local

/usr/local/libexec/vsftpd &

## save this file [/code]

 

 

Facebook Fans