Ssh automagically knocks at server door: Difference between revisions

From Wurst-Wasser.net
Jump to navigation Jump to search
No edit summary
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== The issue ===
=== The issue ===
I secured my server with knockd. So I need to knock on his door (ports) in order to start an [[ssh]]-session.
I secured my server with [[knockd]]. So I need to knock on his door (ports) in order to start an [[ssh]]-session.
* The usage
* The usage
** first I started a shell script that did the knocking
** first I started a shell script that did the knocking
**then I had to launch ssh
**then I had to launch ssh


This was annyoing. There hat to be a way to do this in one step. And it is.
This was annyoing. There had to be a way to do this in one step. And it is. :-)
 


=== The solution ===
=== The solution ===
Add this to <tt>.ssh/config</tt>:
Add this to <tt>.ssh/config</tt>:
  ProxyCommand /bin/bash -c '~/bin/knock.sh; sleep 1; exec nc %h %p'
  ProxyCommand /bin/bash -c '~/bin/knock.sh; sleep 1; exec nc %h %p'
----
* More…
** A simple knocking-script for [[Linux]] can be found here: [[Raspberry Pi WebCam with 3G (Solarcam)#knock.sh]]
** [[Ssh connect through another host]]


[[Category:Linux]]
[[Category:Linux]]

Latest revision as of 09:28, 22 May 2023

The issue

I secured my server with knockd. So I need to knock on his door (ports) in order to start an ssh-session.

  • The usage
    • first I started a shell script that did the knocking
    • then I had to launch ssh

This was annyoing. There had to be a way to do this in one step. And it is. :-)

The solution

Add this to .ssh/config:

ProxyCommand /bin/bash -c '~/bin/knock.sh; sleep 1; exec nc %h %p'