First contact: hp server Z240

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操作教程**
  1. View openssh version (openssh version must be greater than 4.8p1)
    SSH -V

  2. Creating sftp group
    groupadd sftp

  3. Creating sftp user
    useradd -g sftp -s / sbin / nologin -M sftp
    passwd sftp
    password

  4. Create a directory
    mkdir -p / the Data / SFTP / mysftp
    the usermod -d / the Data / SFTP / SFTP mysftp

  5. Modify sshd_config
    vim / etc / SSH / sshd_config
    commented

    Subsystem sftp /usr/libexec/openssh/sftp-server

最后添加
Subsystem sftp internal-sftp
Match Group sftp
ChrootDirectory /data/sftp/mysftp
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no

  1. 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.

  1. 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]

Guess you like

Origin blog.51cto.com/12967094/2460563