나는 또는 users.users.root.hashedPassword = "*";
같은 것을 설정하려고 시도했습니다.sudo passwd -d root
user { 'root':
password => '*',
require => Package[ruby-shadow],
}
존재하다인형, 하지만 나중에도 이전 비밀번호를 sudo nixos-rebuild switch
계속 사용할 수 있습니다 .su -
답변1
mutableUsers
다음 으로 설정해야 합니다 false
.사용자 암호.
users = {
#normal users declaration here
mutableUsers = false;
extraUsers = {
root = {
hashedPassword = "*";
};
user = {
hashedPassword = "user-password";
};
};
};
맨페이지:man configuration.nix
users.users.<name?>.hashedPassword
Specifies the hashed password for the user. The options
hashedPassword, password and passwordFile controls what password is
set for the user. hashedPassword overrides both password and
passwordFile. password overrides passwordFile. If none of these
three options are set, no password is assigned to the user, and the
user will not be able to do password logins. If the option
users.mutableUsers is true, the password defined in one of the
three options will only be set when the user is created for the
first time. After that, you are free to change the password with
the ordinary user management commands. If users.mutableUsers is
false, you cannot change user passwords, they will always be set
according to the password options.
새로운 세대를 테스트하기 위해 레이블을 설정할 수 있습니다( 레이블이 지정됨 noroot
).
nixos-rebuild switch -p noroot -I nixos-config=/etc/nixos/configuration.nix