sshd
跳转到导航
跳转到搜索
生成 host key
for k in rsa dsa ecdsa ed25519; do ssh-keygen -t $k -f /etc/ssh/ssh_host_${k}_key; done
配置
GatewayPorts- 指定为
clientspecified允许远程端口转发时绑定到非本地地址。默认为no。
仅限 sftp
限制指定用户只能用 sftp,无法使用 shell:[1]
Subsystem sftp internal-sftp
Match User username
ChrootDirectory /srv/sftp
X11Forwarding no
AllowTcpForwarding no
AllowAgentForwarding no
ForceCommand internal-sftp -d /%u
注意 ChrootDirectory 的目标目录要求只有 root 能够写入。-d 选项指定 sftp 起始目录。
参见
外部链接
- {arch}设置 sshd | delectate's blog
- GitHub - janmojzis/tinyssh: TinySSH is small server (less than 100000 words of code)