1

Is it possible to ssh login into a server automatically after that I open ConEmu? I am basically trying to run a macro immediately after that the task loads the command line.

2
  • And what have you tried? conemu.github.io/en/GuiMacro.html
    – Maximus
    Oct 18, 2015 at 9:54
  • I haven't tried any. I am trying to understand how do I run a macro (or a set of commands) automatically immediately after the task startup? Oct 18, 2015 at 23:16

2 Answers 2

1

First of all, hardcoding logins/passwords is a bad approach.

Much better would be using ssh-agent.

But, of course, it's possible to use GuiMacro to type anything in the created console.

Well, supposing that bash.exe is available through %PATH%, you may create the Task using the following command:

bash.exe -c 'ConEmuC -Silent -GuiMacro Print "login" -GuiMacro Keys Enter -GuiMacro Print "password" -GuiMacro Keys Enter ; ssh your-server'

Bash makes me crazy... instead of simple -GuiMacro Print "login\npassword\n" you shall use four -GuiMacro blocks... I failed to let bash pass quotes properly as ConEmuC arguments.

0
1

I do this

  1. Install Cygwin and Openssh
  2. Use a ssh key and authorized key on the server.

Create a .bat file with the code below in it

@echo off

C:
chdir C:\cygwin64\bin

bash.exe --login -i -c "ssh [username]@[domain] -p [port] -D [port]"

Create a ConEmu Startup Tasks

cmd /k RenameTab "MyTabName" & "C:\[path]\MyBatFile.bat"

I also pin ConEmu to the TaskBar, and use this task in the Jump List

2
  • Thanks a lot, this seems to be a simple and clean way to perform a series of commands at once, doing it in one line seems difficult to read. Do you happen to know where I can find the list of console commands I can use and the explanation? For example, what does -i -c -p -D mean? Is the order important? Oct 21, 2015 at 9:50
  • 1
    basically google for: "man bash" and "man ssh". You can also type "man bash" or "man ssh" into your linux terminal and it will bring up a local copy of the manual which explains what the arguments do Oct 22, 2015 at 15:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .