2022-04-10 19:06:19 +00:00
|
|
|
import ./make-test-python.nix ({ lib, ... }: {
|
|
|
|
name = "user-home-mode";
|
|
|
|
meta = with lib.maintainers; { maintainers = [ fbeffa ]; };
|
|
|
|
|
|
|
|
nodes.machine = {
|
|
|
|
users.users.alice = {
|
|
|
|
initialPassword = "pass1";
|
|
|
|
isNormalUser = true;
|
|
|
|
};
|
|
|
|
users.users.bob = {
|
|
|
|
initialPassword = "pass2";
|
|
|
|
isNormalUser = true;
|
|
|
|
homeMode = "750";
|
|
|
|
};
|
2024-07-09 21:09:09 +00:00
|
|
|
users.users.carol = {
|
|
|
|
initialPassword = "pass3";
|
|
|
|
isNormalUser = true;
|
|
|
|
createHome = true;
|
|
|
|
home = "/users/carol";
|
|
|
|
};
|
2022-04-10 19:06:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
machine.wait_for_unit("multi-user.target")
|
|
|
|
machine.wait_for_unit("getty@tty1.service")
|
2022-06-04 04:22:03 +00:00
|
|
|
machine.wait_until_tty_matches("1", "login: ")
|
2022-04-10 19:06:19 +00:00
|
|
|
machine.send_chars("alice\n")
|
2022-06-04 04:22:03 +00:00
|
|
|
machine.wait_until_tty_matches("1", "Password: ")
|
2022-04-10 19:06:19 +00:00
|
|
|
machine.send_chars("pass1\n")
|
|
|
|
machine.succeed('[ "$(stat -c %a /home/alice)" == "700" ]')
|
|
|
|
machine.succeed('[ "$(stat -c %a /home/bob)" == "750" ]')
|
2024-07-09 21:09:09 +00:00
|
|
|
machine.succeed('[ "$(stat -c %a /users)" == "755" ]')
|
|
|
|
machine.succeed('[ "$(stat -c %a /users/carol)" == "700" ]')
|
2022-04-10 19:06:19 +00:00
|
|
|
'';
|
|
|
|
})
|