当前位置:网站首页>sftp创建
sftp创建
2022-07-22 03:53:00 【栓独爱青春】
部分来源于网上 整合
1.创建用户并指定用户目录,下面以创建用户名sentweb为例
useradd -d /home/www/xx -s /sbin/nologin -M sentweb
2.设置密码
passwd sentweb
输入密码 ***
3.用户授权。
chmod 755 /home/www/xx
chown root /home/www/xx
chown -R sentweb /home/www/xx
4.修改配置,限制访问路径
vim /etc/ssh/sshd_config
末尾加入:
Match User sentweb #指定适用的用户,如何指定用户组改为Match Group
ChrootDirectory /home/www/sentweb.zhdingli.com #要求此目录的有上级目录所属用户必须为root,且权限为755
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp #指定sftp命令,ssh不可以登录
这部不生效就换为
修改sshd_config文件
vim /etc/ssh/sshd_config
#Subsystem sftp /usr/libexec/openssh/sftp-server 注释掉这一行
增加以下配置
Subsystem sftp internal-sftp
Match User xx
xx为设置的用户名
后期修改路径 增加去etc/passwd 里面修改就ok了
5.重启sshd服务器
systemctl restart sshd.service
6.使用winSCP登录
文件协议:sftp
主机名:xx.xx.xx.xx 端口号(ssh端口):22
用户名:sentweb 密码:***
tip:删除用户
userdel -r <用户名>
边栏推荐
- String和char[]互转的思考
- Basic knowledge of nb-iot
- Codeforces Round #719 (Div. 3)
- SOC custom IP core -- breathing lamp
- PPy HSA conductive polymer polypyrrole PPy material BSA white rice nanoparticles / albumin coated nano lipid carrier BSA NLC
- Codeforces Round #719 (Div. 3)
- 什么是单片机?单片机的组成部分有哪些?
- SSTI simple summary and ciscn 2019 southeast China]double secret
- 为什么我们开发的系统会有并发Bug,并发Bug根源到底是什么?
- Docker数据管理案例——MySQL数据持久保存
猜你喜欢
随机推荐
Evening Sky
Program environment and pretreatment
Preloading and lazy loading of DOM
【解决】npm ERR! code E401
The principle of distributed transaction is simple, and it is full of holes
JVM内存模型:虚拟机栈
第七讲 管道、环境变量与常用命令
Jd-h5 development
Android面试:2022请收好这份网易Android开发和抖音电商Android工程师的面经
JVM经典面试20问
NB-IOT可以应用在哪些领域
PPy-HSA导电聚合物聚吡咯PPy物质BSA白米纳米粒/白蛋白包覆纳米脂质载体BSA NLC的研究制备
SSTI简单总结和CISCN 2019华东南]Double Secret
Learning notes of line segment tree
M using similink simulation module to realize dynamic simulation of multipath channel
Linux environment
【精讲】Es6的数组的扩展方法,对象的扩展方法,字符串扩展方法,?. 对象层级深
Glide 源码解析
DOM style operation
SoC 自定义 IP 核--呼吸灯