当前位置:网站首页>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 .
边栏推荐
- Mipi interface, DVP interface and CSI interface of camera [easy to understand]
- ES6数组去重的三个简单办法
- 实现一个Prometheus exporter
- 机械设备行业数字化供应链集采平台解决方案:优化资源配置,实现降本增效
- Specification of lumiprobe reactive dye indocyanine green
- 寶,運維100+服務器很頭疼怎麼辦?用行雲管家!
- Lake shore optimag superconducting magnet system om series
- MATLAB中subplot函数的使用
- 【Go ~ 0到1 】 第五天 7月1 类型别名,自定义类型,接口,包与初始化函数
- bean的生命周期核心步骤总结
猜你喜欢

Chinese and English instructions human soluble advanced glycation end products receptor (sRAGE) ELISA Kit
![[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](/img/5c/b0030fd5fbc07eb94013f2699c2a04.png)
[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

Solidity - 合约结构 - 错误(error)- ^0.8.4版本新增

Dom4J解析XML、Xpath检索XML

微服务大行其道的今天,Service Mesh是怎样一种存在?

11. Users, groups, and permissions (1)

MySQL common graphics management tools | dark horse programmers

Lake shore optimag superconducting magnet system om series

kubernetes命令入门(namespaces,pods)

ACM mm 2022 video understanding challenge video classification track champion autox team technology sharing
随机推荐
Team up to learn! 14 days of Hongmeng equipment development "learning, practicing and testing" practical camp, free of charge!
案例分享:QinQ基本组网配置
Qfile read / write file operation in QT
Lake Shore—OptiMag 超导磁体系统 — OM 系列
The best landing practice of cave state in an Internet ⽹⾦ financial technology enterprise
华为游戏初始化init失败,返回错误码907135000
Chinese and English instructions human soluble advanced glycation end products receptor (sRAGE) ELISA Kit
Improve yolov5 with gsconv+slim neck to maximize performance!
Digital business cloud: from planning to implementation, how does Minmetals Group quickly build a new pattern of digital development?
【Go ~ 0到1 】 第四天 6月30 defer,结构体,方法
[pytorch record] automatic hybrid accuracy training torch cuda. amp
【Go ~ 0到1 】 第五天 7月1 类型别名,自定义类型,接口,包与初始化函数
精益思想:来源,支柱,落地。看了这篇文章就懂了
Create your own NFT collections and publish a Web3 application to show them (Introduction)
Lumiprobe 自由基分析丨H2DCFDA说明书
Huawei cloud experts explain the new features of gaussdb (for MySQL)
Lake Shore 连续流动低温恒温器传输线
【pytorch记录】模型的分布式训练DataParallel、DistributedDataParallel
组队学习! 14天鸿蒙设备开发“学练考”实战营限时免费加入!
如何使用物联网低代码平台进行个人设置?