How do a check what startup scripts are run after I ssh into a machine?
2 Answers
In a nutshell..
System wide with RHEL/CentOS, the initialization scripts are contained within /etc/rc.d
, which is System V style initialization.
Others, such as Slackware, use BSD style initialization.
The scripts are started by init, which is configured in /etc/inittab
.
On the user level, it is going to be unique to your shell. With bash
, the default shell in most Linuxes, an interactive shell is going to use both /etc/profile
and ~/.bash_profile
. Non-interactive will use ~/.bashrc
.
There are a lot of details here and if you want a particular answer, you will need to clarify.
-
From the man page: "When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist." Apr 5, 2010 at 21:27
-
"When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable." Apr 5, 2010 at 21:36
-
Good info, I won't edit but feel free. I didn't feel like spending the time to create such a verbose response.– WarnerApr 5, 2010 at 21:40
The sshd(8)
man page as well as the man page of the shell in use tell which files are looked at upon login.