Server connections outside the network!
1.ping gateway (can pass the next step)
2.ping www.baidu.com
not, please check the dns
vim /etc/resolv.conf
nameserver 114.114.114.114
The server has two external network ports, attention in the allocation of
** CentOS7 安装SFTP操作教程**
-
View openssh version (openssh version must be greater than 4.8p1)
SSH -V -
Creating sftp group
groupadd sftp -
Creating sftp user
useradd -g sftp -s / sbin / nologin -M sftp
passwd sftp
password -
Create a directory
mkdir -p / the Data / SFTP / mysftp
the usermod -d / the Data / SFTP / SFTP mysftp - Modify sshd_config
vim / etc / SSH / sshd_config
commentedSubsystem sftp /usr/libexec/openssh/sftp-server
最后添加
Subsystem sftp internal-sftp
Match Group sftp
ChrootDirectory /data/sftp/mysftp
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no
- Set Chroot directory permissions
chown root: SFTP / the Data / SFTP / mysftp
chmod 755 / the Data / SFTP / mysftp
After completion of the above, you can see the landing.
- Settings can be written directory
mkdir / Data / SFTP / mysftp / Upload
chown SFTP: SFTP / Data / SFTP / mysftp / Upload
the chmod 755 / Data / SFTP / mysftp / Upload
Close SELinux:
Vim / etc / SELinux / config
file is modified to SELINUX = enforcing SELINUX = disabled, then save
Execution:
setenforce 0
service sshd restart
或
systemctl restart sshd.service
Test
sftp [email protected]