我试图在Mac OS中运行Hadoop,但出现以下错误,
$ hstart
WARNING: Attempting to start all Apache Hadoop daemons as chaklader in 10 seconds.
WARNING: This is not a recommended production deployment configuration.
WARNING: Use CTRL-C to abort.
Starting namenodes on [localhost]
localhost: Permission denied (publickey,password,keyboard-interactive).
Starting datanodes
localhost: Permission denied (publickey,password,keyboard-interactive).
Starting secondary namenodes [macs-MacBook-Pro.local]
macs-MacBook-Pro.local: Permission denied (publickey,password,keyboard-interactive).
2018-08-14 13:59:34,949 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Starting resourcemanager
Starting nodemanagers
localhost: Permission denied (publickey,password,keyboard-interactive).
我调查了Google并找到了类似的帖子。我提到权限被拒绝是错误,并且我没有正确设置passwordless ssh
。例如,ssh localhost
不应要求输入密码。
我运行ssh localhost
,但确实要求输入密码。作为解决该问题的方法,提到了执行命令
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
我这样做了,然后当我运行ssh localhost
时,要求我输入passphrase
(比密码)。
$ ssh localhost
Enter passphrase for key '/Users/chaklader/.ssh/id_rsa':
Last login: Tue Aug 14 14:03:30 2018 from ::1
原始问题未解决。提到了另一条执行命令chmod og-wx ~/.ssh/authorized_keys
的帖子,在我完成之后,它仍然保持不变。
我试图检查id_rsa
内的内容并找到信息
$ cat ~/.ssh/id_rsa.pub
ssh-rsa
AAAAB3NzaC1yc2EAAAADAQABAAABAQDB/1Ryk4mB2/9rxpvF21JWKBOyx+hgo572zp9ZNcLmj1FcNN9saJ0AfYcmkILowEoCKgzOCbAvapd+JsPomPMsuKD37AGvfF88YWAjKPYOg3wo5JMwIp/CEyk349satGWUy+Q99288iJcS5NKkhLEN1bMOyIpgbFFxmpCdFXNSl9UfeCN4oyndWJzmnHkI6C9mu4BWibcW3PkKkwI2HVPop14m3jRjHJvmwGzRQxp/bjUVRqSZ52KTuVMYRrCsKdd048tBHOK0ujjshpBCoedtFoXt3xP0B78WZyvgFr2Pj9DrgdFI+T7gkJUv4xbmtKfCOZR7yFVwoUtgAF5k/FC1 chaklader@macs-MacBook-Pro.local
$ cat ~/.ssh/authorized_keys
ssh-rsa
AAAAB3NzaC1yc2EAAAADAQABAAABAQDB/1Ryk4mB2/9rxpvF21JWKBOyx+hgo572zp9ZNcLmj1FcNN9saJ0AfYcmkILowEoCKgzOCbAvapd+JsPomPMsuKD37AGvfF88YWAjKPYOg3wo5JMwIp/CEyk349satGWUy+Q99288iJcS5NKkhLEN1bMOyIpgbFFxmpCdFXNSl9UfeCN4oyndWJzmnHkI6C9mu4BWibcW3PkKkwI2HVPop14m3jRjHJvmwGzRQxp/bjUVRqSZ52KTuVMYRrCsKdd048tBHOK0ujjshpBCoedtFoXt3xP0B78WZyvgFr2Pj9DrgdFI+T7gkJUv4xbmtKfCOZR7yFVwoUtgAF5k/FC1 chaklader@macs-MacBook-Pro.local
已检查远程登录
我调试并获取信息,
$ ssh -v localhost
OpenSSH_7.5p1, LibreSSL 2.5.4
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 52: Applying options for *
debug1: Connecting to localhost [::1] port 22.
debug1: Connection established.
debug1: identity file /Users/chaklader/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/chaklader/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/chaklader/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/chaklader/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/chaklader/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/chaklader/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/chaklader/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/chaklader/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.5
debug1: match: OpenSSH_7.5 pat OpenSSH* compat 0x04000000
debug1: Authenticating to localhost:22 as 'chaklader'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:R9cek2xWHJN6rgvBKr4JZMKisZbifnxvPoSzIb5z5Ik
debug1: Host 'localhost' is known and matches the ECDSA host key.
debug1: Found key in /Users/chaklader/.ssh/known_hosts:2
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/chaklader/.ssh/id_rsa
debug1: Server accepts key: pkalg rsa-sha2-512 blen 279
密钥生成如下,
ssh-keygen -t rsa
这里错过了什么?
我找到了另一种生成密钥的方法,
ssh-keygen -t dsa -P ” -f ~/.ssh/id_dsa
我应该尝试这种方法吗?
答案 0 :(得分:1)
在RSA密钥上使用密码短语的好处当然是,如果有人以某种方式获得了您的私钥,它将为您提供一定的保护(密码短语应阻止他们使用它)。尽管这是一个好主意,但它违反了“无密码” ssh登录的目的。如果每次使用密钥时都必须输入密码,那么并非没有密码就可以辩护。如果某人能够访问私钥,则您可能会认为他们将拥有对该私钥所在计算机的完全访问权限,或者您对密钥不小心。
关于私钥,您可以使用一些'safeguarding' measures;实际上,最重要的事情是仅在需要的地方保留私钥,而不要将私钥放在您的计算机周围。