Hello everyone,
I have been following the simple formula of using the root Debian PVE system as an SSH jump server to access all of my VMs and LXC containers.
Doing so, I have been using configuration blocks that look like this (for every VM/LXC host):
For example,
In pursuit of a nicer and an easier configuration, I have been looking into ways to use a single configuration block. Initially I tried the following:
However, this would always lead to the erroneous expansion:
... where
(note that the
I tried many things, and ended up settling on something that I am not happy with and only works in
My request is hence specific, which is, can someone help me make this generic SSH configuration work while being more portable?
Note that I am fully aware of the
Hence, if you can come up with an elegant way to use these two subcommands to do what I am trying to do, then please, by all means, go ahead and suggest something. However, please bear in mind that:
1. I want a unified way to SSH into VMs and LXC containers, without having to keep track of which is which.
2. I tend to memorise VMs and LXC containers better using their hostnames, rather than their
3. I would want a way in which I can still use X11 forwarding (
Thanks!
I have been following the simple formula of using the root Debian PVE system as an SSH jump server to access all of my VMs and LXC containers.
Doing so, I have been using configuration blocks that look like this (for every VM/LXC host):
Code:
Host host.proxmox
Hostname host
User root
ProxyJump proxmox
PreferredAuthentications publickey
For example,
host
above can be anything, like jenkins
, n8n
, nextcloud
, etc.In pursuit of a nicer and an easier configuration, I have been looking into ways to use a single configuration block. Initially I tried the following:
Code:
Host *.proxmox
User root
ProxyCommand echo %h | sed 's/\..*$//' | xargs -I _ ssh -W _:%p -l root proxmox
PreferredAuthentications publickey
However, this would always lead to the erroneous expansion:
Code:
debug1: Executing proxy command: exec echo n8n.proxmox | sed 's/\\..*$//' | xargs -I _ ssh -W _:22 -l root proxmox
... where
sed 's/\\..*$//'
is not exactly the same as the intended sed 's/\..*$//'
, leading to a failure in connecting to the host:
Code:
debug1: Authenticating to n8n.proxmox:22 as 'root'
(note that the
.proxmox
suffix in n8n.proxmox
was not removed by sed
as intended)I tried many things, and ended up settling on something that I am not happy with and only works in
zsh
:
Code:
Host *.proxmox
User root
ProxyCommand ssh -W ${${H:-%h}%%.proxmox}:%p -l root proxmox
PreferredAuthentications publickey
My request is hence specific, which is, can someone help me make this generic SSH configuration work while being more portable?
Note that I am fully aware of the
pct enter
and the qm terminal
commands...Hence, if you can come up with an elegant way to use these two subcommands to do what I am trying to do, then please, by all means, go ahead and suggest something. However, please bear in mind that:
1. I want a unified way to SSH into VMs and LXC containers, without having to keep track of which is which.
2. I tend to memorise VMs and LXC containers better using their hostnames, rather than their
vmid
in Proxmox.3. I would want a way in which I can still use X11 forwarding (
-X
) in order to be able to share the clipboard with the host I am SSH'ing to, which to me, is very useful.Thanks!
Last edited: