ssh 配置的一些问题

1. ssh启动错误:no hostkeys available— exiting

  1. 在 hadoop 伪分布配置安装的教程里

http://dblab.xmu.edu.cn/blog/2441-2/

在“安装SSH、配置SSH无密码登陆”这一步,启动 ssh 时,

sudo /etc/init.d/ssh start

出现了问题:

no hostkeys available— exiting
  1. 解决办法(使用 root 权限运行):
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key

2. ssh localhost,出现 Permission denied (publickey)

  1. 登录普通用户的时候运行:
ssh loalhost

出现错误:

localhost: Permission denied (publickey).
  1. 解决办法
cd ~/.ssh/                     			# 若没有该目录,请先执行一次ssh localhost
ssh-keygen -t rsa              			# 会有提示,都按回车就可以
cat ./id_rsa.pub >> ./authorized_keys  	# 加入授权
  1. 再次运行:
ssh localhost

结果:

zhiyong@LAPTOP-OC4RD91F:/home/zhiyong$ ssh localhost
Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 4.4.0-19041-Microsoft x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Mon Nov 16 14:54:10 CST 2020

  System load:    0.52      Processes:             14
  Usage of /home: unknown   Users logged in:       0
  Memory usage:   42%       IPv4 address for eth1: 192.168.0.76
  Swap usage:     0%


6 updates can be installed immediately.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable


*** System restart required ***
Last login: Mon Nov 16 12:16:37 2020 from 127.0.0.1
hadoop@LAPTOP-OC4RD91F:~$



3.这样,搭建伪分布式的 Hadoop 环境的 ssh 配置就可以搭配好了

你可能感兴趣的:(linux,linux,ssh)