sshd

来自百合仙子's Wiki
跳转到导航 跳转到搜索

生成 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 起始目录。

参见

外部链接

参考资料