Install vsftpd
All commands should be run with ‘root’ user. Run the following command in terminal to install vsftpd package:
# yum install vsftpd ftp -y
Configure vsftpd
Edit vsftpd configuration file /etc/vsftpd/vsftpd.conf,
Find the following lines and make the changes as shown below:
## Set to "NO" ## anonymous_enable=NO ## Uncomment ## ascii_upload_enable=YES ascii_download_enable=YES ## Uncomment - Enter your Welcome message - This is optional ## ftpd_banner=Welcome to UNIXMEN FTP service. ## Add at the end of this file ## use_localtime=YES
Start the vsftpd service and make it to start automatically on every reboot:
# service vsftpd start # chkconfig vsftpd on
By default, root user is not allowed to login to ftp server for security purpose. So let us create a testing user called “karsel” with password “password”:
# useradd karsel # passwd karsel
Connecting to FTP server
Now let us try to connect to FTP server itself with user “karsel”:
# ftp 192.168.1.1 Connected to 192.168.1.1 (192.168.1.1). 220 Welcome to UNIXMEN FTP service. Name (192.168.1.1:root): karsel 331 Please specify the password. Password: 500 OOPS: cannot change directory:/home/karsel Login failed. ftp>
Probably you will get an error like “500 OOPS: cannot change directory”.
This is because your SELinux restricts
the user to log in to ftp server. So let us update the SELinux boolean
values for FTP service:
# setsebool -P ftp_home_dir on
Now try again to login to FTP server:
# ftp 192.168.1.1 Connected to 192.168.1.1 (192.168.1.1). 220 Welcome to UNIXMEN FTP service. Name (192.168.1.1:root): karsel 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp>