Potentially a real easy question but I was wondering if anybody can kindly provide some advice.
To accomplish a repeating task, I am constantly logging into a remote Solaris server using credentials given to us from our system admin. However, each time I log in, I must change shell (from csh -> bash) as the specific task must be run using BASH.
Although it is not a major problem doing this, I find the changing to bash shell somewhat tedious as I must repeat this task several times a day, and also occasionally may forget to change shells before running the task, etc (also I prefer BASH too so).
Is there a way where I can ssh and change default shell in one line so I can start immediately with the script I want on the remote server? Note, I do not what to change any log in files (like .login or .cshrc) as the remote server & the credentials are shared an not specifically for me. I don't want to change the default shell either on the server either as, again, the server & the credentials are used by several people.
Would anybody have any ideas how to get around such a problem? Any suggestions would be greatly appreciated.
To change your shell use the chsh command: The chsh command changes the login shell of your username. When altering a login shell, the chsh command displays the current login shell and then prompts for the new one.
Go to Connection > SSH and set the Remote command to bash . Note that you won't be able to exit to your default shell, it will just close the connection.
SSH, also known as Secure Shell or Secure Socket Shell, is a network protocol that gives users, particularly system administrators, a secure way to access a computer over an unsecured network. SSH also refers to the suite of utilities that implement the SSH protocol.
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 runbash -l
will start an interactive login shellcsh -l -c
will start an interactive login shell in csh, and then execute the command that followsTo 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"'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With