User rc File

The shell script /etc/sshrc is invoked by the SSH server for each incoming SSH connection. "Arbitrary Actions with /etc/sshrc" You may define a similar script in your account, ~/.ssh/rc (SSH1, OpenSSH) or ~/.ssh2/rc (SSH2), to be invoked for every SSH connection to your account. If this file exists, /etc/sshrc isn't run.The SSH rc file is much like a shell startup file (e.g., ~/.profile or ~/.cshrc), but it executes only when your account is accessed by SSH. It is run for both interactive logins and remote commands. Place any commands in this script that you would like executed when your account is accessed by SSH, rather than an ordinary login. For example, you can run and load your ssh-agent in this file: ["Loading Keys with ssh-add"]

# ~/.ssh/rc, assuming your login shell is the C shell if ( ! $?SSH_AUTH_SOCK ) then eval `ssh-agent` /usr/bin/tty | grep 'not a tty' > /dev/null if ( ! $status ) then ssh-add endif endif


Like /etc/sshrc, your personal rc file is executed just before the shell or remote command requested by the incoming connection. Unlike /etc/sshrc, which is always processed by the Bourne shell ( /bin/sh), your rc file is processed by your account's normal login shell.