第一步,先安装ssh
sudo apt-get install ssh
第二步,设定密码用户。
ssh-keygen
提示:
Enter file in which to save the key (……/.ssh/id_rsa):
输入用户名,如果是root,则保存的时候会提示存在。也可以设定其他的。
Enter passphrase:填写密码
Enter same passphrase again:再次填写一遍
如果提示失败,则有可能是权限问题。先切换到root权限,重复上面操作。
su root 切换用户
若你想要使用root登录则必须,先给root设定密码,命令:sudo passwd
然后,修改sshd_config文件,路径:/etc/ssh/sshd_config
将PermitRootLogin no 改为yes,重新启动ssh服务
ssh密码默认是root的登录密码。