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

How to build sftp service on CVM

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

The purpose of this article is to share with you about how to build sftp services on CVM. The editor thinks it is very practical, so I hope you can learn something after reading this article. Let's take a look at it with the editor.

Users of CVM want to build a sftp server. Let's introduce the operation instructions for sftp service configuration under Linux based on the sharing of ing by Li Shilong, a blogger in the cloud community.

First check the version of openssh, use the ssh-V command to check the version of openssh, the version must be greater than 4.8p1, the lower version needs to be upgraded.

1. Create a sftpusers group

Groupadd sftpusers

2. Create a sftpusers user who cannot be used to log in to the system.

Useradd-g sftpusers-s / sbin/nologin sftpuserspasswd sftpusers (set password)

3. Create the sftpusers home directory and specify

Mkdir-p / home/Sftpusermod-d / home/Sftp sftpusers

Change the owner to the home directory and authorize the home directory owner must be root, the permission can be 755 or 750

Chown root:root / home/Sftpchmod 755 / home/Sftp

4. Create telecom users, specify home directory and authorize

Useradd-g sftpusers-s / sbin/nologin dianxinpasswd dianxin (set password) usermod-d / home/Sftp/dianxinFTP dianxinchown root:root / home/Sftp/dianxinFTPchmod 755 / home/Sftp/dianxinFTP

5. Create JD.com account, specify home directory and authorize

Mkdir-p / home/Sftp/jingdongFTPuseradd-g sftpusers-s / sbin/nologin jingdongpasswd jingdong (set password) usermod-d / home/Sftp/jingdongFTP jingdongchown root:root / home/Sftp/jingdongFTPchmod 755 / home/Sftp/jingdongFTP

6. Edit the configuration file / etc/ssh/sshd_config

Subsystem sftp / usr/libexec/openssh/sftp-server# comment out this line and add the following 6 lines Subsystem sftp internal-sftpMatch Group sftpusersChrootDirectory% hForceCommand internal-sftpX11Forwarding noAllowTcpForwarding no

Remove the following comments

PermitRootLogin yes (prevent subsequent root non-login systems)

Save and close the file

7. Restart the sshd service

Service sshd restart

8. Create each user data directory and authorize

1.sftpusers user

Mkdir-p / home/Sftp/datachown sftpusers:sftpusers / home/Sftp/datachmod 755 / home/Sftp/data

2.dianxin user

Mkdir-p / home/Sftp/dianxinFTP/dianxinchown dianxin:sftpusers / home/Sftp/dianxinFTP/dianxinchmod 777 / home/Sftp/dianxinFTP/dianxin

3.jingdong user

Mkdir-p / home/Sftp/jingdongFTP/jingdongchown jingdong:sftpusers / home/Sftp/jingdongFTP/jingdongchmod 777 / home/Sftp/jingdongFTP/jingdong

9. Verification

Enter the password in sftpsftpusers@127.0.0.1 and display sftp >, then the sftp is built successfully.

The above is how to build sftp services on CVM. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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