Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How do a check what startup scripts are run after I ssh into a machine?

share|improve this question
    
Sorry, do you mean what scripts are run immediately when you ssh in, or which scripts run when the machine starts up? –  Matt Simmons Apr 5 '10 at 19:31

2 Answers 2

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.

share|improve this answer
    
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." –  Dennis Williamson Apr 5 '10 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." –  Dennis Williamson Apr 5 '10 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. –  Warner Apr 5 '10 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.