1 Answer
1

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?
–
RyanTMMay 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.
–
geekosaurMay 7 '11 at 0:48