FTP_centos6
How to configure ftp server on centos 6
ftp userpassword
useradd -d /var/ftp/pub/mail u1
Create a symbolic link relative to the current directory
[root@mail /]# ln -s /home /var/ftp/pub/mail
cd /home
chmod -R 755 home
FTP – File transfer protocol is used to transfer files from one host to another over TCP . Configuring ftp server on linux is safe and secure .
In this article we can see how to configure ftp server on centos 6 . please follow the steps.
Configuring ftp server on Centos 6:
Step 1 » Vsftpd is a lightweight FTP server package for Centos (linux) . Start installing package by issuing below command.
[root@leela ~]# yum -y install vsftpd
Step 2 » After installation, Open the file /etc/vsftpd/vsftpd.conf which is the config file for vsftpd ( I mean FTP server ) .
12 anonymous_enable=YES
15 local_enable=YES
18 write_enable=YES
81 ascii_upload_enable=YES
82 ascii_download_enable=YES
96 chroot_local_user=YE
Replace YES to NO in the below line.
anonymous_enable=NO
Find and Uncomment the below lines
local_enable=YES
write_enable=YES
and uncomment this line to limit the users to their home directories.
chroot_local_user=YES
Step 3 » Create a folder where you want to store FTP data. In my case i’m going to create in / ( root folder ) like below .
[root@leela ~]# mkdir /ftp
Step 4 » Now start creating users for accessing ftp server .
[root@leela ~]# useradd -d /ftp/krizna krizna
[root@leela ~]# passwd krizna
Changing password for user krizna.
New password:
You just created username krizna with home directory /ftp/krizna .
Step 5 » Start vsftpd service by issuing the below command.
[root@leela ~]# service vsftpd start
and type this below command to start ftp server service automatically while booting.
[root@leela ~]# chkconfig --levels 235 vsftpd on
Step 6 » That’s it, Now we can check the FTP access .Create some files in /ftp/krizna folder
[root@leela ~]# touch /ftp/krizna/test
[root@leela ~]# touch /ftp/krizna/test1
[root@leela ~]# touch /ftp/krizna/test2
Enable VSFTPD Log
Edit file = # vi /etc/vsftpd/vsftpd.conf
add below lines
xferlog_file=/var/log/vsftpd.log
xferlog_enable=YES
dirmessage_enable=YES
xferlog_std_format=YES
data_connection_timeout=600
dual_log_enable=YES
# service vsftpd restart
Save and restart vsftpd service.
Now open ftp path in remote machine browser ftp://ftp-server-IP ( ftp://172.16.28.135 ). You can see the created files after authentication.
You can use Filezilla or winscp tools to upload/download files from FTP server.
Troubleshooting :
If you not able to connect ftp server , Disable the firewall ( iptables ) and selinux service on your ftp server .
Disable firewall ( Iptables ) »
[root@leela ~]# service iptables stop
[root@leela ~]# chkconfig iptables off
Disable Selinux » open the file /etc/selinux/config and find the line
SELINUX=enforcing
and replace with
SELINUX=disabled
now reboot the server and try again.
How to chnage default FTP directory for vsftpd
--
Type the following in /etc/vsftpd.conf file:
anon_root=/some/directory/of/your/choice/
e.g.
anon_root=/var/frp/pub/
and set up propper permissions for that directory and its subdiretories.
---
Howto configure VSFTPd allow root login
2. Allow root login
Remove root in /etc/vsftpd/ftpusers and /etc/vsftpd/user_list
[root@localhost ~]# vi /etc/vsftpd/ftpusers
# Users that are not allowed to login via ftpbin
# root
[root@localhost ~]#
[root@localhost ~]# vi /etc/vsftpd/user_list
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# root
[root@localhost ~]#
3. Restart VSFTPd and try to login by root
[root@localhost ~]# /etc/init.d/vsftpd restart
# vi /etc/vsftpd/vsftpd.conf
In vsftpd.conf add:
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
Edit the file to contain a username per row.
# mkdir -p /etc/vsftpd.userlist
# vi /etc/vsftpd.userlist
Allow the user name
How to change FTP home directory in Centos 6
-rw------- 1 root root 131 Sep 5 17:51 ftpusers
-rw------- 1 root root 367 Sep 5 18:04 user_list
-rw-r--r-- 1 root root 10 Sep 6 13:43 vsftpd.userlist
Setting up VSFTPD to allow user to upload.
write_enable=YES
1) Disable anonymous FTP. Comment out the anonymous_enable line in the vsftpd.conf file like this:
# Allow anonymous FTP?
anonymous_enable=NO
# 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_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list
# These directives turn on the User List (/etc/vsftpd/user_list), specify where the list is, and tell vsftp to deny anyone NOT found in the /etc/vsftpd/user_list file.
# The user must also have a local account.
userlist_enable=YES
userlist_file=/etc/vsftpd/user_list
userlist_deny=NO
pam_service_name=vsftpd
tcp_wrappers=YES