linux ubuntu 启用 ssh sftp

stfp底层使用ssh协议
所以只要启用ssh即可
网上一般的教程支离破碎,难以应用于实际工作
以下给出正确做法

1. 编辑配置文件
vim /etc/ssh/sshd_config

2. 具体内容
PermitRootLogin true
PasswordAuthentication  yes 

3. 重启ssh
service sshd restart

发现有3个错误

Could not load host key: /etc/ssh/ssh_host_dsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key
 * Restarting OpenBSD Secure Shell server sshd                                                                          Could not load host key: /etc/ssh/ssh_host_dsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Could not load host key: /etc/ssh/ssh_host_ed25519_key

解决办法

ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
ssh-keygen -t dsa -f /etc/ssh/ssh_host_ecdsa_key
ssh-keygen -t dsa -f /etc/ssh/ssh_host_ed25519_key

修改登录端口

https://www.cnblogs.com/freeweb/p/5667166.html
etc\ssh\sshd_config
修改port
然后重启ssh服务

相关文章

此处评论已关闭