我(尝试)管理一组用作服务器的Mac Mini。我最近需要更改其所有密码,因此我通过SSH并运行了该命令,这是在这些计算机上创建新用户帐户时所使用的命令:
sudo dscl . passwd /Users/administrator thePassword
不幸的是,这并没有像我在现有用户上使用时所想的那样-新密码不是thePassword
,因此我无法访问sudo
。man dscl
有这样说:
密码
Usage: passwd user_path [new_pasword | old_password new_pasword]
Changes a password for a user. The user must be specified by full path,
not just a username. If you are authenticated to the node (either by
specifying the -u and -P flags or by using the auth command when in
interactive node) then you can simply specify a new password. If you are
not authenticated then the user's old password must be specified. If
passwords are not specified while in interactive mode, you will be
prompted for them. Passing these passwords on the command line is inher-
ently insecure and can cause password exposure. For better security do
not provide the password as part of the command and you will be securely
prompted.
因此,看起来我在运行该先前命令时应该已经提供了用户的旧密码,但是我没有提供。我知道我输入了什么密码,但我仍然可以通过SSH访问计算机。如果我能弄清命令的作用,就可以知道我在帐户上设置的密码。