Это не имеет ничего общего с Linux, это конфигурация сервера NoMachine, в частности :файл server.cfg, если вы установили:
CreateDisplay 1
DisplayOwner root
Вы будете root в GNOME, ссылка:https://www.nomachine.com/TR04N06814&tn=DisplayOwner
Видимо, я забыл об изменении, которое сделал сам...
Вместо того, чтобы пытаться использовать сценарий оболочки, мы можем написать короткую программу на C, которая позволит нам вернуться к обычному экрану, когда программа остановлена :
#define _GNU_SOURCE 1
#include <stdbool.h>
#include <stdio.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
/* Quick hack; todo: use terminfo instead */
#include <stdlib.h>
static void enter_alt_screen(void)
{
system("tput smcup");
}
static void leave_alt_screen(void)
{
system("tput rmcup");
}
int main(int argc, char **argv)
{
if (argc < 2) {
fprintf(stderr, "Usage: %s command args...", argv[0]);
return 1;
}
if (!isatty(fileno(stdout))) {
/* not a terminal; act normally */
execvp(argv[1], argv+1);
}
enter_alt_screen();
const pid_t child = fork();
switch (child) {
case -1:
leave_alt_screen();
perror("fork");
return 1;
case 0:
/* child */
execvp(argv[1], argv+1);
leave_alt_screen();
perror("exec");
return 1;
}
int status;
while (waitpid(child, &status, WCONTINUED) == child) {
if (WIFSTOPPED(status)) {
leave_alt_screen();
} else if (WIFCONTINUED(status)) {
enter_alt_screen();
} else if (WIFSIGNALED(status)) {
leave_alt_screen();
signal(WTERMSIG(status), signal(SIGTERM, SIG_DFL));
raise(WTERMSIG(status));
} else if (WIFEXITED(status)) {
leave_alt_screen();
return WEXITSTATUS(status);
}
}
return 1;
}