So, it's time to get to why we've been doing all this to being with: uploading your real website files to the server and test it. How do we go about doing it?
Now sure, you can connect to the server with the WinSCP tool using your SSH ‘root’ credentials and just upload the files. But in the real world, if you ever need to allow access for another user, this is something you should avoid doing for security reasons.
Ok, first let’s install and configure ProFTPd server:
[root@ServerSuit ~]# yum install proFTPd
We need to create a user for proFTPd server too as it's created by default, as well as add a line to the ‘/etc/hosts’ file to make sure that service will listen through the right interface:
[root@ServerSuit~]# useradd proftpd -s /dev/null [root@ServerSuit~]# echo "<your_server_ip> ServerSuit" >> /etc/hosts
Then you’ll need to edit a few lines in ‘/etc/proftpd.conf’:
User proftpd Group proFTPd ServerName "ServerSuit"
And finally we can start our service:
[root@ServerSuit ~]# service proftpd start Starting proftpd: [ OK ]
Set it to allow to run at boot:
[root@ServerSuit ~]# chkconfig proftpd on
And we need to allow incoming connections to FTP ports 20-21 just the way we did it for HTTP connections before:
[root@ServerSuit ~]# iptables -I INPUT 1 -p tcp --dport 20 -j ACCEPT [root@ServerSuit ~]# iptables -I INPUT 2 -p tcp --dport 21 -j ACCEPT [root@ServerSuit ~]# iptables-save > /etc/sysconfig/iptables
This can get kind of annoying, but fortunately we're almost finished. Lastly, we need is create a user- and password- to login via FTP. We also need to make sure that user will have permissions for his home directory:
[root@ServerSuit ~]# useradd --home-dir /var/www/ServerSuitTheBest \ --shell /sbin/nologin ftp-user [root@ServerSuit ~]# passwd ftp-user [root@ServerSuit ~]# chown ftp-user:ftp-user /var/www/ServerSuitTheBest –R [root@ServerSuit ~]# service proftpd restart
Please note that we provided a parameter “--shell /sbin/nologin”. It ensures that user can’t ever login to server via SSH.
You now able to login via FTP to the server, and you only have access to your website folder!
Wanna make this process easier and make all your problems go away? Well the setup process can get as quick as a click with ServerSuit. All you need is install the basic LAMP software package with ProFTP already included and preconfigured.
Or you can install ProFTPd as separate software package if you didn’t need LAMP stack but still need FTP service on your server! All you need then is create new user at the dashboard, give it home directory and make sure that you check ‘FTP access’ at user properties below.