sftp Installation (Linux)

- consolidation of the network

1. Check the version openssh
SSH -V
openssh version must be greater than 4.8p1
2. Create a sftp group
groupadd sftp
3. Create a sftp user
useradd -g sftp -s / sbin / nologin -M sftp
passwd sftp
password
4. Create a directory
mkdir -p / Data / SFTP / mysftp
the usermod -d / Data / SFTP / mysftp SFTP
5. The modify the sshd_config
Vim / etc / SSH / the sshd_config
commented
# Subsystem sftp / usr / libexec / openssh / sftp-server
to add back
the Subsystem Internal SFTP SFTP-
Match SFTP Group
the ChrootDirectory / Data / SFTP / mysftp
ForceCommand Internal-SFTP
AllowTcpForwarding NO
X11Forwarding NO
6. The set Chroot directory permissions
chown the root: SFTP / Data / SFTP / mysftp
the chmod 755 / Data / SFTP / mysftp
After completion of the above, you can see the landing.
7. Contents of the settings can be written
mkdir / Data / SFTP / mysftp / Upload
chown SFTP: SFTP / Data / SFTP / mysftp / Upload
the chmod 755 / Data / SFTP / mysftp / Upload
off SELinux:
Vim / etc / SELinux / config
will file SELINUX = enforcing amended as SELINUX = disabled, and then save.
Execution:
setenforce 0
Service sshd restart
or
systemctl restart sshd.service
test
sftp [email protected]

Guess you like

Origin www.cnblogs.com/sung1024/p/11454707.html