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 in linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

It is believed that many inexperienced people have no idea about how to build SFTP service in linux. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

SFTP build process:

1. Create a SFTP group

$groupadd sftp

Information about using the cat / etc/group command group after creation

$cat / etc/group

2. Create a sftp user mysftp and join the created sftp group, and change the password of the mysftp user.

$useradd-g sftp-s / bin/false mysftp $passwd mysftp

3. Create a new / data/sftp/mysftp directory and specify it as the home directory for mysftp group users

$mkdir-p / data/sftp/mysftp $usermod-d / data/sftp/mysftp mysftp # modify the mysftp user's home directory to / data/sftp/mysftp

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

$vi / etc/ssh/sshd_config

Comment out the following line with the # symbol

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

And add the following lines at the end of the file and then save

Subsystem sftp internal-sftp

Match Group sftp

ChrootDirectory / data/sftp/%u

ForceCommand internal-sftp

AllowTcpForwarding no

X11Forwarding no

5. Set directory permissions

$chown root:sftp / data/sftp/mysftp $chmod 755 / data/sftp/mysftp

6. Create a new directory for sftp user mysftp to upload files. The owner of this directory is mysftp, all groups are sftp, and the owner has write permission. All groups have no write permission.

$mkdir / data/sftp/mysftp/upload $chown mysftp:sftp / data/sftp/mysftp/upload $chmod 755 / data/sftp/mysftp/upload

7. Close selinux and restart the sshd service, and then test

# shut down selinux$setenforce 0setenforce:SELinux is disabled# and restart sshd service $systemctl restart sshd.service

Verify on another server, sftp user name @ ip address

2. Project local path selects the address of the local project. Project name needs to have the same name as the local directory, and Next

3. The remote server address is 10.17.11.251. After filling in the personal account password, you can click Test Connection to test whether the connection is normal. Remember to check the Don't check HTTP connection to server,Next below

4. Select the root directory of the remote server target project, and then click the Project Root above. If the directory does not exist, contact the administrator to create it. Next

5 、 finish

6. The remote SFTP connection has been created.

When synchronizing the project, select the target directory or file, and right-> Deployment- > Upload to..., select the corresponding remote server. You can also use the shortcut key Ctrl+Alt+Shift+X

Check Tools- > Deployment- > Automatic Upload to automatically synchronize the remote server after each local modification and save.

After reading the above, have you mastered how to build SFTP services in linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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

Internet Technology

Wechat

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

12
Report