Find us on facebook

Showing posts with label FTP. Show all posts
Showing posts with label FTP. Show all posts

Jul 2, 2015

Install VSFTP in CentOS 6

Check what ports are standard for a given service
cat /etc/services | grep ftp

View running service
netstat -antlp | grep ftp

Install vsftpd on your virtual private server in the command line:
sudo yum install vsftpd

Install the FTP client, so that we can connect to an FTP server:
sudo yum install ftp

Open up the configuration file:

sudo vi /etc/vsftpd/vsftpd.conf
anonymous_enable=NO (vsftpd will not allow anonymous, unidentified users to access the VPS's files)

local_enable=YES

chroot_local_user=YES (all the local users will be within their chroot and will be denied access to any other part of the server.)

Add following lines to end of the file
pasv_enable=YES
pasv_min_port=64000
pasv_max_port=64321
port_enable=YES

Restart vsftpd:
sudo service vsftpd restart

To vsftpd runs at boot, run chkconfig:
chkconfig vsftpd on


Jul 1, 2015

FTP Connection refused error

Verify that ftp server installed:

Debian Linux
$ dpkg -l | grep -i "ftp"
Output:
ii  ftpd                           0.17-21                       FTP server

OR:
$ dpkg -l | grep -i ftp

Red Hat/Novell Suse/Fedora Linux:
# rpm -qa | grep -i "*ftp*"

If you have the ftp package installed it will return output. If the ftp package is not installed, it will notify or not give any output. If not installed, Install FTP server.

Red Hat/Fedora Linux install vsftpd server :
# up2date vsftpd

Fedora Linux:
# yum install vsftpd

Debian Linux:
# apt-get install vsftpd

Next configure vsftpd by modifying /etc/vsftpd.conf file.

Is ftp server running (is port 21 open)?
Login to server using ssh and telnet port 21 (to see port is open or not):
$ telnet localhost 21

Next run netstat -tulpn command to see if port 21 is in open:
$ netstat -tulpn | grep :21

Output:
tcp        0      0 0.0.0.0:21             0.0.0.0:*               LISTEN

OR :
$ netstat -a | grep ftp
Output:
tcp        0      0 *:ftp                   *:*                     LISTEN

If port is not open, start ftp server /service.
RedHat/Fedora Linux :
# service vsftpd start

Debian Linux:
# /etc/init.d/vsftpd start

FTP user permissions
File /etc/ftpusers - list of users disallowed use vsftpd server access.

Security or Firewall
Check iptables firewall/tcpd does not block access to ftp server. Run following command on ftp server
# iptables -L -n

Use iptables rules to open port 21. Make sure file /etc/hosts.deny (TCPD wrappers) does not block access to port 21 for your ftp host.