Description: Here I have explained how to configure FTP and SFTP in centos
Procedure:
Procedure:
Setup FTP on Centos
[root@localhost ~] # wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-6.noarch.rpm
[root@localhost ~] # rpm -ivh epel-release-7-6.noarch.rpm
- Enable epel repository by using below command
[root@localhost ~] # wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-6.noarch.rpm
[root@localhost ~] # rpm -ivh epel-release-7-6.noarch.rpm
- Install ftp by using below command
- Open /etc/vsftpd/vsftpd.conf to configure ftp server. Made below changes in server
anonymous_enable=NO
local_umask=022
chroot_local_user=YES #(this property used to limit the users to their home directories.)
local_enable=YES
write_enable=YES
- Enable and start service
[root@localhost ~] # systemctl start vsftpd
[root@localhost ~] # systemctl enable vsftpd
- Verify installation by browse ftp://IP_ADDR
Setup SFTP on Centos
Description: SFTP is the FTP service built into Secure Shell [SSH]
- SFTP Directory: The First thing you need to create a directory to host your FTP data.
# chmod 701 /data
- Create SFTP user and group: Now we are creating user and group to access ftp
# useradd -g sftp_users -d /data -s /sbin/nologin USERNAME
Where USERNAME is the name of user. Now set password to user
# passwd USERNAME
- Create new user SFTP directory: We will create new directory to store data and assigned permission to user.
# chown -R root:sftp_users /data/USERNAME
# chown -R username: sftp_users /data/USERNAME/upload
- Configure sshd configuration file and add below content to the end of file.
Match Group sftp_users
ChrootDirectory /data/%u
ForceCommand internal-sftp
- Save and close file. Restart ssh service for effect.
- Check user by login using sftp USERNAME@IP_ADDR
No comments:
Post a Comment