在Linux系统中,我们可以通过以下步骤来添加SFTP用户:
我们需要创建一个新的系统用户。可以使用以下命令来创建用户:
```bash
sudo adduser newuser
```
接下来,我们需要为新用户设置密码:
sudo passwd newuser
编辑sshd配置文件,通常在`/etc/ssh/sshd_config`中,添加以下配置:
Match User newuser
ForceCommand internal-sftp
PasswordAuthentication yes
ChrootDirectory /path/to/sftp/directory
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no
重启SSH服务以使配置生效:
sudo systemctl restart sshd
新的SFTP用户就已经添加成功了。
希望以上步骤能够帮助你成功添加SFTP用户到Linux系统中。如果有任何问题,欢迎留言。