Accessing a new FreeBSD Jail via SSH
December 08, 2023 —
Nico Cartron
A very short one, mostly for me, as that's the second time it happens to me.
The Problem
After I created a Jail, when trying to ssh using its IP address, I was falling into the "generic" TrueNAS part, not the Jail itself.
I had created the correct user and uploaded my SSH key, but that wouldn't work.
The solution
In both cases, I simply forgot to... ENABLE SSH in the Jail's configuration! :-)
So a
sysrc sshd_enable="YES"
followed by
service sshd start
and next time I ssh'ed, I was in the Jail!
(of course I had to remove the old key in ~/.ssh/known_hosts
).
Why did I still manage to SSH into the box?
By default, OpenSSH will listen on all the interfaces it knows, which includes
the Jails' ones.
Since I hadn't enabled SSH on that Jail, I was falling back into the "parent"
FreeBSD instance.
Tags: FreeBSD