Запуск Sh Сценарий Post Login через S SH / Консоль - PullRequest
0 голосов
/ 06 марта 2020

Мне нужно запустить скрипт bash для всех пользователей при получении входа в систему, либо в локальной консоли, либо в S SH.

Я знаю о ~ / .profile, однако мне это нужно запускать, если пользователь обходит профиль при входе в систему с помощью «noprofile». По сути, он должен работать в каждом возможном контексте.

Существует ли определенная папка / файл, которая запускается каждый раз, когда пользователь успешно входит в систему, в которую я могу войти?

1 Ответ

0 голосов
/ 11 марта 2020

Согласно комментарию Сорина. Успешно выполнено по следующей ссылке:

https://manpages.ubuntu.com/manpages/precise/en/man8/sshd.8.html

ПРОЦЕСС ВХОДА В систему После успешного входа в систему sshd выполняет следующие действия:

       1.   If the login is on a tty, and no command has been specified, prints last login
            time and /etc/motd (unless prevented in the configuration file or by
            ~/.hushlogin; see the FILES section).

       2.   If the login is on a tty, records login time.

       3.   Checks /etc/nologin; if it exists, prints contents and quits (unless root).

       4.   Changes to run with normal user privileges.

       5.   Sets up basic environment.

       6.   Reads the file ~/.ssh/environment, if it exists, and users are allowed to change
            their environment.  See the PermitUserEnvironment option in sshd_config(5).

       7.   Changes to user's home directory.

       8.   If ~/.ssh/rc exists, runs it; else if /etc/ssh/sshrc exists, runs it; otherwise
            runs xauth.  The “rc” files are given the X11 authentication protocol and cookie
            in standard input.  See SSHRC, below.

       9.   Runs user's shell or command.
...