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.
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
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.
I do this
- Install Cygwin and Openssh
- 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
cmd /k RenameTab "MyTabName" & "C:\[path]\MyBatFile.bat"
I also pin ConEmu to the TaskBar, and use this task in the