itermocil icon indicating copy to clipboard operation
itermocil copied to clipboard

SSH

Open danielzev opened this issue 8 years ago • 9 comments

Hey Tom, great app!

I'm trying to run my commands starting with an SSH into a remote box. then from there, change directories and eventually run a top or tail a log file.

so my YML file is something like this:

windows:
  - name: Test
    root: ~/
    layout: even-horizontal
    panes:
      - commands:
        - ssh username@host
        - sudo su - someotheruser
        - tail -f somefile
      - commands:
        - ssh username@host
        - sudo su - someotheruser
        - top

Though the 2nd and 3rd command execute on my shell before SSH'ing into the remote box. Now I understand why this would be tricky, though is there a way to do this?

danielzev avatar Jun 07 '16 16:06 danielzev

I am trying to do same thing. I can't find other way to do this. If you are only tail the file, you can try this:

ssh username@host tail -f somefile

duqcyxwd avatar Jun 07 '16 16:06 duqcyxwd

That would be great if we could do it. I want to ssh into several servers and then attach to a tmux session on each. I tried both approaches above with no success.

wshayes avatar Aug 30 '16 14:08 wshayes

Does this have a solution yet? I read about the applescript workaround in another issue, but is there an easier way to do it? @TomAnthony

TDA avatar Sep 16 '16 17:09 TDA

I'm also running into this issue. I would like to be able to ssh into my vagrant box as part of my itermocil start up script using the command 'vagrant ssh', however it seems that the commands that follow the ssh call are run before the SSH is established.

This would be a great addition to what is already such a useful tool :)

- commands:
        - vagrant ssh
        - . venvs/myproject/bin/activate
        - cd /vagrant/

benje avatar Nov 17 '16 10:11 benje

Stumbled across this solution for queuing commands after another has completed.. which uses another package (thanks @TomAnthony) https://github.com/TomAnthony/itermocil/issues/3 However it still doesn't seem to work with SSH connections.

panes:
      - commands:
        - vagrant ssh; q -t
        - q; . venvs/myproject/bin/activate
        - q; cd /vagrant/ 

benje avatar Nov 17 '16 10:11 benje

a not so elegant solution. You can pass a list of command to ssh

benzen avatar Jun 29 '17 19:06 benzen

For tailing i prefer @duqcyxwd 's solution.. If i want to login as root in a remote machine i do

ssh -t  <<machine ip>> "sudo -i"

kishaningithub avatar Nov 07 '17 14:11 kishaningithub

It's possible with this command: ssh -t [host] "[command 1] && [command 2]; bash"

Jeromearsene avatar Apr 25 '18 14:04 Jeromearsene

I know this is extremely old, but I wanted to run a command and then to continue to interact on the remote server, and I found a solution here: https://serverfault.com/a/158091

To add interactivity, run bash -l after your initial command. It worked for my use case

raman325 avatar Oct 10 '19 04:10 raman325