如何在 OS X 10.8 (Mountain Lion) 上为密码为空的用户启用 ssh 登录?我看到其他人问过这个问题,和我一样,原因也是一样:父母不懂密码。所以“设置密码”不是一个选项。
我找到了将“nullok”添加到各种 PAM 配置文件的参考。没有用。找到 sshd 配置“PermitEmptyPasswords yes”。没有用。
更新信息:已设置公钥/私钥 ssh 密钥对,并在同一台计算机上成功用于我的帐户(有密码)。 ~/.ssh 目录和私钥的文件权限正确。
我对“ssh -vvv”进行了比较,发现一个启用密码的帐户的成功 ssh 与另一个没有密码的 ssh 之间的区别。
54,55c54,55
< debug2: dh_gen_key: priv key bits set: 133/256
< debug2: bits set: 533/1024
---
> debug2: dh_gen_key: priv key bits set: 140/256
> debug2: bits set: 508/1024
67c67
< debug2: bits set: 509/1024
---
> debug2: bits set: 516/1024
79c79
< debug2: key: /Users/rae/.ssh/rae (0x7f9a0241e2c0)
---
> debug2: key: /Users/rae/.ssh/rae (0x7f81e0c1e2c0)
90,116c90,224
< debug1: Authentications that can continue: publickey,keyboard-interactive
< debug2: we did not send a packet, disable method
< debug3: authmethod_lookup keyboard-interactive
< debug3: remaining preferred: password
< debug3: authmethod_is_enabled keyboard-interactive
< debug1: Next authentication method: keyboard-interactive
< debug2: userauth_kbdint
< debug2: we sent a keyboard-interactive packet, wait for reply
< debug2: input_userauth_info_req
< debug2: input_userauth_info_req: num_prompts 1
< debug3: packet_send2: adding 32 (len 14 padlen 18 extra_pad 64)
< debug1: Authentications that can continue: publickey,keyboard-interactive
< debug2: userauth_kbdint
< debug2: we sent a keyboard-interactive packet, wait for reply
< debug2: input_userauth_info_req
< debug2: input_userauth_info_req: num_prompts 1
< debug3: packet_send2: adding 32 (len 14 padlen 18 extra_pad 64)
< debug1: Authentications that can continue: publickey,keyboard-interactive
< debug2: userauth_kbdint
< debug2: we sent a keyboard-interactive packet, wait for reply
< debug2: input_userauth_info_req
< debug2: input_userauth_info_req: num_prompts 1
< debug3: packet_send2: adding 32 (len 14 padlen 18 extra_pad 64)
< debug1: Authentications that can continue: publickey,keyboard-interactive
< debug2: we did not send a packet, disable method
< debug1: No more authentication methods to try.
< Permission denied (publickey,keyboard-interactive).
---
> debug1: Server accepts key: pkalg ssh-dss blen 433
> debug2: input_userauth_pk_ok: fp 6e:02:20:63:48:6a:08:99:b8:5f:12:d8:d5:3d:e1:fb
> debug3: sign_and_send_pubkey: DSA 6e:02:20:63:48:6a:08:99:b8:5f:12:d8:d5:3d:e1:fb
> debug1: read PEM private key done: type DSA
> debug1: Authentication succeeded (publickey).
> Authenticated to cme-mini.local ([192.168.1.5]:22).
> debug2: fd 7 setting O_NONBLOCK
> debug3: fd 8 is O_NONBLOCK
> debug1: channel 0: new [client-session]
> debug3: ssh_session2_open: channel_new: 0
> debug2: channel 0: send open
> debug1: Requesting [email protected]
> debug1: Entering interactive session.
> debug2: callback start
> debug2: client_session2_setup: id 0
> debug2: fd 5 setting TCP_NODELAY
> debug2: channel 0: request pty-req confirm 1
> debug1: Sending environment.
答案1
允许远程登录而无需密码会带来问题。由于您指出教育用户不是一种选择,因此您只能生成 ssh 密钥。这些密钥可以不使用密码,也可以使用密码短语(更容易记住)。
根据指南本网站这很容易做到。