1

I'd like to have an alias to run a command right after login through ssh on a computer, basically doing the following:

$ ssh my_server
$ bash

Because I always want to use the bash terminal once logged in. One stone, two birds; that would save me some time considering how much I'm using it.

Thank you.

Edit: I found that the following works:

 $ ssh my_server -t bash
Liam
  • 593
  • 6
  • 15

2 Answers2

0

You want ssh -t hostname bash -li to get an interactive login shell

glenn jackman
  • 238,783
  • 38
  • 220
  • 352
0

Use one of the following:

To execute one command:

ssh user@host ls or ssh -t user@host

where -t: Force pseudo-tty allocation.

To execute a script:

ssh user@host 'bash -s' < localscript.sh

More info

Community
  • 1
  • 1
idobr
  • 1,537
  • 4
  • 15
  • 31
  • In my case, `-t` alone is not enough I need to add `bash` to get what I want. Thank you for the input ;) – Liam Jan 31 '14 at 18:17