# ssh connection with non-standard shell

## alex.blackbit

hi,

can i open a (open)ssh connection and execute a shell on the remote computer?

i tried with

```
$ ssh host zsh
```

but that does not work. i want to do that on a host that

* is badly configured so that i cannot change my standard shell

* is not administrated by me

* has the shell i want

and i do not like to enter the same command every time i connect if there is a better way.

putty has such feature, so there must be a way. it would be best if there is a option for ssh_config, because the need for this is permanent.

the manpages ssh(1) and ssh_config(5) did not help me.

----------

## desultory

 *alex.blackbit wrote:*   

> but that does not work.

 Please elaborate.

 *alex.blackbit wrote:*   

> and i do not like to enter the same command every time i connect if there is a better way.

 Have you considered using shell scripts?

----------

## bunder

can you run "chsh"?  that should change your default shell...  you wanted zsh, so you would enter "/bin/zsh".

cheers

----------

## alex.blackbit

@bunder: as i wrote in my initial post, the system is not configured correctly, so chsh does not work. that's why i am searching for such a hack.

@desultory: yes, you are right, it is a possibility to start my shell from .bashrc (bash is the default shell on that system), but that's not exactly what i want to do.

is there really no way to start a non-standard shell on a ssh connection?!?! i cannot believe it.

----------

## desultory

 *desultory wrote:*   

>  *alex.blackbit wrote:*   but that does not work. Please elaborate.

 In what way does it fail?

 *alex.blackbit wrote:*   

> @desultory: yes, you are right, it is a possibility to start my shell from .bashrc (bash is the default shell on that system), but that's not exactly what i want to do.

 I was referring to using scripts on the client side, not the server side.

----------

## alex.blackbit

with "fail" i meant that just nothing happens. no error messages, no prompt. nothing. when i hit ctrl+c i get "Killed by signal 2", that's all.

how would such a clientside script look like?

----------

## desultory

 *alex.blackbit wrote:*   

> with "fail" i meant that just nothing happens. no error messages, no prompt. nothing. when i hit ctrl+c i get "Killed by signal 2", that's all.

 It is working, though no virtual terminal is being allocated, this can be verified by running commands in the shell. To rectify the problem the -t option can be used to force a virtual terminal to be allocated.

 *alex.blackbit wrote:*   

> how would such a clientside script look like?

 

```
#!/bin/sh

exec ssh -t host zsh
```

----------

## alex.blackbit

thank you very much, desultory, you were totally right.

i didn't even try to enter anything in this situation, because i didn't thought this could work, but actually entering "ls" gave back the right results... that's a list with "\n"s, because ls things that the output is not a normal terminal   :Smile: 

and the "-t" option does what i want, the script you provided is not necessary. a simple

```
$ ssh -t host zsh
```

gives me my shell.

the last question is: is there a way to set that option in the ~/.ssh/config file for a specified host?

----------

## desultory

 *alex.blackbit wrote:*   

> the last question is: is there a way to set that option in the ~/.ssh/config file for a specified host?

 Not that I know of, that is why a wrapper would potentially be useful, though the general form would be slightly more complex than the example I posted.

----------

