Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

First contact: hp Server Z240

2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The server is connected to the external network!

1.ping gateway (can reach the next step)

2.ping www.baidu.com

Please check dns if you can't.

Vim / etc/resolv.conf

Nameserver 114.114.114.114

This server has two external network ports, so pay attention to it when configuring.

* * CentOS7 installation SFTP operation tutorial * *

View openssh version (openssh version must be greater than 4.8p1)

Ssh-V

Create a sftp group

Groupadd sftp

Create a sftp user

Useradd-g sftp-s / sbin/nologin-M sftp

Passwd sftp

Enter password

Create a catalog

Mkdir-p / data/sftp/mysftp

Usermod-d / data/sftp/mysftp sftp

Modify sshd_config

Vim / etc/ssh/sshd_config

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

Finally add

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 / data/sftp/mysftp

Chmod 755 / data/sftp/mysftp

After the above is done, you can log in and check.

Set the directory that can be written to

Mkdir / data/sftp/mysftp/upload

Chown sftp:sftp / data/sftp/mysftp/upload

Chmod 755 / data/sftp/mysftp/upload

Turn off selinux:

Vim / etc/selinux/config

Change the SELINUX=enforcing in the file to SELINUX=disabled, and then save

Execute:

Setenforce 0

Service sshd restart

Or

Systemctl restart sshd.service

test

Sftp sftp@127.0.0.1

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report