Thursday, February 24, 2022

How To Setup an SFTP server on Rocky Linux 8.5

 in This Tutorial you will Learn " How To setup an SFTP server on Rocky Linux 8.5
"SFTP (SSH File Transfer Protocol) is a secure file transfer protocol. It runs over the SSH protocol.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; hostname ; hostname -I ; dnf groupinstall "Development Tools" -y

cat /etc/passwd
groupadd  sftp_users ; usermod -G sftp_users -s /sbin/nologin debs
gedit /etc/ssh/sshd_config &>/dev/null
Subsystem sftp internal-sftp

# add Below lines at the end of file
Match Group sftp_users
X11Forwarding no
AllowTcpForwarding no
ChrootDirectory %h
ForceCommand internal-sftp

systemctl restart sshd ; systemctl status sshd
chmod 755 /home/debs ; chown root /home/debs ; chgrp -R sftp_users /home/debs
mkdir -p /home/debs/upload ; chown debs. /home/debs/upload/
firewall-cmd --add-service=ssh ; firewall-cmd --runtime-to-permanent
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Client : Rocky Linux
cat /etc/system-release ; sestatus ; hostname ; hostname -I
dnf -y install openssh-clients
sftp [username@(hostname or IP address)]  
sftp debs@192.168.1.20
_________________________________________________________________________________________


No comments:

Post a Comment