Tag Archives: FTP

Configure FTP server on Linux and create user to access only his home directory

Now i’ll show you how to configure ftp server on oracle linux 5.5 and create user, which can access only his home directory for using ftp, let start.
first we need to install rpm package which is on linux disc. you can mount disk and install package
vsftpd-2.0.5-16.el5_4.1 with command:

rpm -Uvh vsftpd-2.0.5-16.el5_4.1.rpm

after that we need to start ftp server with command:

service vsftpd start

now our ftp server is running.
let’s create user ftpdump which can access only his home directory for file transfer.

mkdir -p /ftp
groupadd ftpdump
useradd –s /bin/bash –d /ftp –g ftpdump ftpdump
passwd ftpdump
chown -R ftpdump:ftpdump /ftp
chmod -R 777 /ftp 

for limit user ftpdump to access only his home directory open vsftpd.conf and add next parameters:

vi /etc/vsftpd/vsftpd.conf

chroot_local_user=NO
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot.list

Then add each user you want to lock to their home directory to the chroot.
I want that ftpdump user access only his home dir, hence i added it in chroot.list

vi /etc/vsftpd/chroot.list

ftpdump

now we can make test, connect ftp with user ftpdump and try to change directory.

C:\Users\user>ftp #.#.#.#
Connected to #.#.#.#.
220 (vsFTPd 2.0.5)
User (#.#.#.#:(none)): ftpdump
331 Please specify the password.
Password:
230 Login successful.
ftp> pwd
257 "/"
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
test.t
226 Directory send OK.
ftp: 111 bytes received in 0.00Seconds 111000.00Kbytes/sec.
ftp> pwd
257 "/"
ftp> cd /u01
550 Failed to change directory.
ftp>

that’s all, good luck.