mirror of
https://github.com/systemd/systemd.git
synced 2026-08-03 06:30:30 +00:00
nologin: extend the /run/nologin descriptions a bit (#8244)
This is an attempt to improve #8228 a bit, by extending the /run/nologin a bit, but still keeping it somewhat brief. On purpose I used the vague wording "unprivileged user" rather than "non-root user" so that pam_nologin can be updated to disable its behaviour for members of the "wheel" group one day, and our messages would still make sense. See #8228.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
c5c07649c2
commit
6e11e7e67d
@@ -67,3 +67,19 @@ int fopen_temporary_label(const char *target,
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int create_shutdown_run_nologin_or_warn(void) {
|
||||
int r;
|
||||
|
||||
/* This is used twice: once in systemd-user-sessions.service, in order to block logins when we actually go
|
||||
* down, and once in systemd-logind.service when shutdowns are scheduled, and logins are to be turned off a bit
|
||||
* in advance. We use the same wording of the message in both cases. */
|
||||
|
||||
r = write_string_file_atomic_label("/run/nologin",
|
||||
"System is going down. Unprivileged users are not permitted to log in anymore. "
|
||||
"For technical details, see pam_nologin(8).");
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to create /run/nologin: %m");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -34,5 +34,6 @@ static inline int write_string_file_atomic_label(const char *fn, const char *lin
|
||||
return write_string_file_atomic_label_ts(fn, line, NULL);
|
||||
}
|
||||
int write_env_file_label(const char *fname, char **l);
|
||||
int fopen_temporary_label(const char *target,
|
||||
const char *path, FILE **f, char **temp_path);
|
||||
int fopen_temporary_label(const char *target, const char *path, FILE **f, char **temp_path);
|
||||
|
||||
int create_shutdown_run_nologin_or_warn(void);
|
||||
|
||||
Reference in New Issue
Block a user