当前位置:网站首页>Contos 7 set up SFTP to create users, user groups, and delete users
Contos 7 set up SFTP to create users, user groups, and delete users
2022-07-01 19:23:00 【Infinitesimal pawn】
1、 Add new users and set up profiles
# establish sftp System user and disable ssh Sign in
useradd -s /sbin/nologin sftp1
# Set or modify sftp1 Sign in
echo "[email protected]" |passwd --stdin sftp1
# To configure sshd_config
vi /etc/ssh/sshd_config
Find the following line , use # The symbols are annotated .
# Subsystem sftp /usr/libexec/openssh/sftp-server
# Add the following lines to the last side of the file
Subsystem sftp internal-sftp
# Match users
Match User sftp1
ChrootDirectory /data/sftp/sftp1
ForceCommand internal-sftp
AllowTcpForwarding no # Not necessary
X11Forwarding no # Not necessary
# Set up Chroot The directory permissions ( must ), The user directory, group directory and data root directory should be set to 755 jurisdiction , Not too high , Otherwise, we may report Permission denied It's abnormal
mkdir -p /data/sftp/sftp1
chown root:root /data/sftp/sftp1
chmod 755 /data -R
# establish SFTP The directory that users can write to after logging in upload
mkdir /data/sftp/sftp1/upload
chown sftp1 /data/sftp/sftp1/upload
# to upload And subordinate Document Authorization 777, Otherwise, we may report Permission denied It's abnormal
chmod 777 /data/sftp/sftp1/upload -R
# Restart sshd service :
systemctl restart sshd.serviceFinally using flashfxp Enter account sftp1 , password : [email protected] Log in .
2、 Add user groups and users and set up profiles
# Create user group sftp And new users sftp1
groupadd sftp
adduser sftp1
# Add users to user groups
useradd -G sftp -s /sbin/nologin sftp1
# Set the user password
passwd [email protected]
# Disable this user shell Sign in
usermod -s /bin/false sftp1
# Set up sshd_config
vi /etc/ssh/sshd_config
Find the following line , use # The symbols are annotated .
# Subsystem sftp /usr/libexec/openssh/sftp-server
# find Subsystem sftp This business , Modified into :
Subsystem sftp internal-sftp
Match Group sftp
UsePAM yes
# use chroot Assign the user's root directory to %h,%h On behalf of the user home Catalog , So the user It can only be active in the user directory . Also available %u,%u On behalf of user name
ChrootDirectory /data/sftp/%u
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no
# Set up Chroot The directory permissions ( must ), User directory sftp1 And group directory sftp And the data root directory data Must be set to 755 jurisdiction , Not too high , Otherwise, we may report Permission denied It's abnormal
mkdir -p /data/sftp/sftp1
chown root:root /data/sftp/sftp1
chmod 755 /data -R
# establish SFTP The directory that users can write to after logging in upload
mkdir /data/sftp/sftp1/upload
chown sftp1 /data/sftp/sftp1/upload
# to upload And subordinate Document Authorization 777, Otherwise, we may report Permission denied It's abnormal
chmod 777 /data/sftp/sftp1/upload -R
# Restart sshd service :
systemctl restart sshd.service
Finally using flashfxp Enter account sftp1 , password : [email protected] Log in .
3、 Delete the user and re create the user
# If you already have users , Remove
userdel sftp1
rm -rf /home/sftp1
rm -rf /var/spool/mail/sftp1
# newly build sftp Group 、 Specific users sftp1
groupadd sftp
adduser sftp1
useradd -G sftp -s /sbin/nologin sftp1
passwd [email protected]
# modify ssh The configuration file
vi /etc/ssh/sshd_config
Find the following line , use # The symbols are annotated .
#Subsystem sftp /usr/libexec/openssh/sftp-server
Subsystem sftp internal-sftp
UsePAM yes
# use chroot Assign the user's root directory to %h,%h On behalf of the user home Catalog , So the user It can only be active in the user directory . Also available %u,%u On behalf of user name
ChrootDirectory /data/sftp/%u
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no
# Set up Chroot The directory permissions ( must ), The user directory, group directory and data root directory should be set to 755 jurisdiction , Not too high , Otherwise, we may report Permission denied It's abnormal
mkdir -p /data/sftp/sftp1
chown root:root /data/sftp/sftp1
chmod 755 /data -R
# establish SFTP The directory that users can write to after logging in upload
mkdir /data/sftp/sftp1/upload
chown sftp1 /data/sftp/sftp1/upload
# to upload And subordinate Document Authorization 777, Otherwise, we may report Permission denied It's abnormal
chmod 777 /data/sftp/sftp1/upload -R
# restart ssh
service sshd restart
Finally using flashfxp Enter account sftp1 , password : [email protected] Log in .
边栏推荐
- PMP是被取消了吗??
- 组队学习! 14天鸿蒙设备开发“学练考”实战营限时免费加入!
- Redis 实现限流的三种方式
- SuperOptiMag 超导磁体系统 — SOM、SOM2 系列
- Taiaisu M source code construction, peak store app premium consignment source code sharing
- AI training speed breaks Moore's law; Song shuran's team won the RSS 2022 Best Paper Award
- 机械设备行业数字化供应链集采平台解决方案:优化资源配置,实现降本增效
- Yyds dry inventory ravendb start client API (III)
- 学习笔记-JDBC连接数据库操作的步骤
- 【直播预约】数据库OBCP认证全面升级公开课
猜你喜欢

Cdga | if you are engaged in the communication industry, you should get a data management certificate

C-end dream is difficult to achieve. What does iFLYTEK rely on to support the goal of 1billion users?

Junit单元测试框架详解

Once the SQL is optimized, the database query speed is increased by 60 times

毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?

Is PMP cancelled??

XML语法、约束
![[pytorch record] automatic hybrid accuracy training torch cuda. amp](/img/a5/cf1eb2801380cf2887dfd532d3eb1e.jpg)
[pytorch record] automatic hybrid accuracy training torch cuda. amp

How to use the low code platform of the Internet of things for personal settings?

Solidity - 算术运算的截断模式(unchecked)与检查模式(checked)- 0.8.0新特性
随机推荐
精益思想:来源,支柱,落地。看了这篇文章就懂了
Superoptimag superconducting magnet system - SOM, Som2 series
nacos配置文件发布失败,请检查参数是否正确的解决方案
论文泛读【FiLM: Visual Reasoning with a General Conditioning Layer】
Write it down once Net travel management background CPU Explosion Analysis
洞态在某互联⽹⾦融科技企业的最佳落地实践
[quick application] there are many words in the text component. How to solve the problem that the div style next to it will be stretched
M91快速霍尔测量仪—在更短的时间内进行更好的测量
透过华为军团看科技之变(六):智慧公路
Bao, what if the O & M 100+ server is a headache? Use Xingyun housekeeper!
太爱速M源码搭建,巅峰小店APP溢价寄卖源码分享
JS find the next adjacent element of the number in the array
2. Create your own NFT collections and publish a Web3 application to show them start and run your local environment
Gameframework eating guide
C-end dream is difficult to achieve. What does iFLYTEK rely on to support the goal of 1billion users?
苹果产品在日本全面涨价,iPhone13涨19%
MySQL common graphics management tools | dark horse programmers
Redis 实现限流的三种方式
Viewing the whole ecology of Tiktok from a macro perspective
【AGC】如何解决事件分析数据本地和AGC面板中显示不一致的问题?