CentOS 7 FTP server setup

ftpI needed FTP access to my VPS since there was a WordPress update and I didn’t feel like it to do it manually: FTP / SFTP / SCP to your server and do the update from there. Fortunately installing and configuring it is easy. After configuration you can immediately login with an admin user that is already present on the system.

What has to be said though, that FTP is from the beginning a HUGE attack vector for hackers. You have to be sure you are securing it or else you will get hacked. This is not something to make you scared, it’s something to make you aware.

Here we go.

Setup FTP

I’m root. Also, I’m using vsftpd (Very Secure File Transport Protocol Daemon) since it is, uh, secure. I should say I’ve looked at a couple of candidates but this one seems simple, trustworthy, secure and proven. So without testing a lot of software, I’m going to roll with this one.

Install and edit the configuration file

# yum install vsftpd ftp
# vi /etc/vsftpd/vsftpd.conf

Then edit the following lines so that they look like this.

# ## Disable anonymous login ##

## Uncomment ##

## Add at the end of thisĀ  file ##

Restart and enable this shizzle.

# systemctl enable vsftpd
# systemctl start vsftpd

Firewall and SELinux

As always you should do your firewall and SELinux settings to make it work.

# firewall-cmd --permanent --add-port=21/tcp
# firewall-cmd --permanent --add-service=ftp

Restart and set SELinux.
# firewall-cmd --reload
# setsebool -P ftp_home_dir on

Done. Use just one of your local Linux users (local Linux users on the server that is) to connect to your server. You can use a client or on some systems the standard connect to server functionality. There surely is enough software to choose from.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.