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?


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.

  • 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 clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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