In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1: create user groups, users, and set passwords
Groupadd sftp
Useradd-g sftp-s / sbin/nologin-M sftp1
Passwd sftp1
2: create the sftp root directory (created under root users)
Mkdir / home/sftp/uploads
one
3: edit the sftp configuration file
Vim / etc/ssh/sshd_config
one
Add at the end (be sure to put the addition at the end, or restart sshd with an error):
Subsystem sftp internal-sftp # # specifies the use of sftp services to use the internal-sftp that comes with the system
Match Group sftp # # users who match sftp groups. If you want to match multiple groups, separate them with commas.
ChrootDirectory / home/sftp/uploads/ # # sftp home directory assigned to / home/sftp/uploads/
ForceCommand internal-sftp # # specify sftp command
AllowTcpForwarding no # # users cannot use port forwarding
X11Forwarding no # # users cannot use port forwarding
You can test whether the configuration file is correct through sshd-t, and correct if there is no input.
4: set home directory permissions
Chown root:sftp / home/sftp/uploads/ folder owner must be root, user group may not be root
The permission of chmod 744 / home/sftp / / cannot exceed 755, otherwise it will cause login error, which can be 755.
5: restart sshd
Systemctl restart sshd
one
6: log in to sftp (linux/Windows)
Sftp sftp1@ip address
one
At this point, the logged-in user only has permission to view the home directory and its subdirectories, and cannot delete, upload, download, or rename files.
7: create a folder for sftp1
Mkdir / home/sftp/uploads/test1
Chown sftp1:sftp / home/sftp/uploads/test1
Chmod 744 / home/sftp/uploads/test1
8: restart sshd
9: log in to sshd and execute the ls command to view the files in the current directory. You can see a test1 folder. Only when cd enters the test1 folder can you upload local files to the test1 folder or download files from the test1 folder to the local directory. (ignore the test2 folder, which I set up for sftp2 users)
Delete the file an in the ~ directory to the test1 file:
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.