Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I SSH into a server, I see the MOTD then I am in BASH. What command is running that takes care of displaying the MOTD and then starts the shell?

share|improve this question

That's generally /bin/login, but ssh is usually a special case — unless UseLogin yes is specified in the sshd_config, it does the session setup itself. Much of the session is actually managed via PAM, though.

/etc/motd is often printed by /etc/profile or a script sourced from there; it's read by your login shell.

share|improve this answer
Say you are using a different shell, does ssh figure out which shell to run? – RyanTM May 7 '11 at 0:43
The shell comes from /etc/passwd or LDAP (or other directory service such as NIS), along with information like your home directory, numeroc user ID, and group memberships. You may be able to determine where by inspecting /etc/nsswitch.conf, and see your entry with getent passwd $USER. – geekosaur May 7 '11 at 0:48

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.