sudo vi /etc/ssh/sshd_config
Port 22
PasswordAuthentication yes # 开启允许密码登录
启动ssh
$ service ssh restart or /usr/sbin/sshd -d
debug1: sshd version OpenSSH_8.2, OpenSSL 1.1.1f 31 Mar 2020
debug1: Unable to load host key: /etc/ssh/ssh_host_rsa_key
debug1: Unable to load host key: /etc/ssh/ssh_host_ecdsa_key
debug1: Unable to load host key: /etc/ssh/ssh_host_ed25519_key
sshd: no hostkeys available -- exiting.
尝试生成key文件
$ ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
$ ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
没作用
再在启动命令加sudo
$ sudo service ssh restart
* sshd is running
查看用户
cat /etc/passwd
取前使用用户
ssh test@127.0.0.1:22
登陆成功