Skip to main content

How To Setup FTP server on centos 7 ( VSFTP )

From : http://www.krizna.com/centos/setup-ftp-server-centos-7-vsftp/
FTP server is used to exchange files between computers over network . This guide helps you to setup ftp server on centos 7 . This guide contains configuration steps for both FTP and SFTP as well as user creation . Here i've used VSFTP package which is secure and less vulnerable .
1. FTP Server
2. SFTP Server
3. User creation

Setup FTP server on centos 7

Step 1 » Update your repository and install VSFTPD package .
[root@krizna ~]# yum check-update
[root@krizna ~]# yum -y install vsftpd

Step 2 » After installation you can find /etc/vsftpd/vsftpd.conf file which is the main configuration file for VSFTP.
Take a backup copy before making changes .
[root@krizna ~]# mv /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.orgNow open the file and make changes as below
[root@krizna ~]# nano /etc/vsftpd/vsftpd.confFind this line anonymous_enable=YES ( Line no : 12 ) and change value to NO to disable anonymous FTP access.
anonymous_enable=NOUncomment the below line ( Line no : 100 ) to restrict users to their home directory.
chroot_local_user=YESand add the below lines at the end of the file to enable passive mode and allow chroot writable.
allow_writeable_chroot=YES
pasv_enable=Yes
pasv_min_port=40000
pasv_max_port=40100

Step 3 » Now restart vsftpd service and make it start automatically after reboot.
[root@krizna ~]# systemctl restart vsftpd.service
[root@krizna ~]# systemctl enable vsftpd.service

Step 4 » Add FTP service in firewall to allow ftp ports .
[root@krizna ~]# firewall-cmd --permanent --add-service=ftp
[root@krizna ~]# firewall-cmd --reload

Step 5 » Setup SEinux to allow ftp access to the users home directories .
[root@krizna ~]# setsebool -P ftp_home_dir on
Step 6 » Now create an User for ftp access. Here /sbin/nologin shell is used to prevent shell access to the server .
[root@krizna ~]# useradd -m dave -s /sbin/nologin
[root@krizna ~]# passwd dave
Now user dave can able to login ftp on port 21 .
You can filezilla or winscp client for accessing files.
Setup ftp server centos 7

SFTP server

SFTP ( Secure File Transfer Protocol ) is used to encrypt connections between clients and the FTP server. It is highly recommended to use SFTP because data is transferred over encrypted connection using SSH-tunnel on port 22 .
Basically we need openssh-server package to enable SFTP .
Install openssh-server package, if its not already installed.
[root@krizna ~]# yum -y install openssh-server
Step 7 » Create a separate group for FTP access.
[root@krizna ~]# groupadd ftpaccess
Step 8 » Now open /etc/ssh/sshd_config file and make changes as below.
Find and comment the below line ( Line no : 147 ).
#Subsystem sftp /usr/libexec/openssh/sftp-serverand add these lines below.
Subsystem sftp internal-sftp
Match group ftpaccess
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp

Step 9 » Now restart sshd service.
[root@krizna ~]# systemctl restart sshdNow your SFTP server is configured and ready .

User creation

Step 10 » Create user jack with /sbin/nologin shell and ftpaccess group
[root@krizna ~]# useradd -m jack -s /sbin/nologin -g ftpaccess
[root@krizna ~]# passwd jack
Now assign root ownership for the home directory for chroot access and modify permission.
[root@krizna ~]# chown root /home/jack
[root@krizna ~]# chmod 750 /home/jack
Create a directory www inside home directory for writing and modify ownership .
[root@krizna ~]# mkdir /home/jack/www
[root@krizna ~]# chown jack:ftpaccess /home/jack/www

Now jack can use both ftp and sftp services . He can upload files in www directory .
Setup ftp server centos 7
If you are going to use FTP and SFTP together in the same server, you should follow above steps while creating users . For existing users add them to ftpaccess and make below changes.
[root@krizna ~]# usermod dave -g ftpaccess
[root@krizna ~]# chown root /home/dave
[root@krizna ~]# chmod 750 /home/dave
[root@krizna ~]# mkdir /home/dave/www
[root@krizna ~]# chown dave:ftpaccess /home/dave/www

Popular posts from this blog

Include dbase on PHP 5.3 Centos 5.7

I want to enable dbase on PHP 5.3. And i found website that have information about it. Environment : OS : CentOS 5.7 Final Web Server : httpd-2.2.3-53 PHP : php53-5.3.3-1.el5_6.1 Programming Language : gcc Download package from php.net [root@compare] # wget http://pecl.php.net/get/dbase-5.0.1.tgz Extract package [root@compare] # tar -zxvf dbase-5.0.1.tgz Prepare the build environment for a PHP extension and compile [root@compare] # cd dbase-5.0.1 [root@compare] # phpize [root@compare] #./configure [root@compare] # make [root@compare] # make install copy dbase.so to http modules [root@compare] # cp /root/php/dbase-5.0.1/modules/dbase.so /usr/lib64/httpd/modules/ Message error if dbase.so not compatible or not installed correctly [Wed Oct 26 20:15:28 2011] [error] [client 192.168.1.254] PHP Fatal error: Call to undefined function dbase_open() in /var/www/html/compare/impdbf.php on line 19 That's all Source : http://www.myee.web.id/index.php/howto.html

Free Stuff

I have free stuff that can i share with you. The free stuff is free magazine, free domain, free hosting, free rapidshare link generator and free money. 1. Free Magazine. You can get free magazine for you to read. There are many topics that can you choose. These are the topics that can you choose : Agri c ulture Automotive Biotechnology & Pharmaceuticals Computers Construction Education Engineering Executive & Management Finance Food & Beverage Government Healthcare Human Re sources Industrial & Manufacturing Internet Information Technology IT - Data Management IT - Security IT - Software & Development IT - Storage Insurance Mechanical / Machine Meetings & Travel Multimedia Network / Communications Purchasing & Procurement Retail Sales & Marketing Small & Medium Business Telecom & Wireless Trade/Professional Services Transportation & Logistics Utility & Energy Many topics

Rapidshare Premium Link Generator

Rapidshare Premium LINK Generator . Rapidshare.com is one of the biggest site that allow you to upload and share files with vary sizes. From rapidshare, you also can download files that another person upload the re. There are 2 kinds of user can download from rapidshare. First, free user, this user have limit features from rapidshare. Limit bandwidth, limit connection, etc. Second, premium user. Premium user have many features that free user doesn't have. If you want to be a premium user, you have to buy it from the web. You can use this link to buy premium account or from reseller that near you. But if you have not enough money to buy it, you can use Rapidshare Premium Link Generator . This is a website that give free service for anyone to generate rapidshare link from free to premium, so anyone can download with premium feature. <br><br>I