SSH then change Shell SSH then change Shell bash bash

SSH then change Shell


SSH usually executes the command you pass it as an argument and then disconnects. You'll need three options set to get your interactive session to work:

  • ssh -t will force the pseudo-tty allocation necessary for you to interact with the remote command you're asking SSH to run
  • bash -l will start an interactive login shell
  • csh -l -c will start an interactive login shell in csh, and then execute the command that follows

To just launch a different shell (i.e., your default is csh, and you want to launch bash):

ssh -t <user>@<server> "bash -l"

To pickup the csh environment first, we start the interactive shell, and then pass the command to switch to bash:

ssh -t <user>@<server> 'csh -l -c "bash"'