如何在MacOS中避免"ssh localhost"密码?



我正在配置本地Hadoop集群,但我在密码配置方面遇到问题。

当我打字时

ssh localhost

将显示以下消息:

ssh localhost
key_load_public: invalid format

我已经尝试使用这些命令来替换我以前的授权密钥:

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys

但它没有奏效。

您可以在~/.ssh目录中创建一个.config文件,然后添加凭据。

喜欢这个

// ~/.ssh/config
# SSH Host configuration file
# Default for all
Host *
ForwardAgent no
ForwardX11 yes
ForwardX11Trusted yes
Host <hostname_here>
HostName <ip_address>
User <user_name>

由于您的问题似乎与键更相关,因此您可以尝试使用ssh -i <your key file> username@ip_addr -p <port>

最新更新