I am trying to create a container using the feature introduced in TrueNAS Community 25.04.
I created the Container with no issue and was able to use the buily in terminal to work with it. I really wanted to use an external terminal for ease, however, I cannot figure out the correct configuration and steps to expose an SSH port to my LAN.
Steps I have taken so far (condensed a bit):
- Basic setup of Arch Container w/ proxy of port 27272 to 22 using the new Container system
- Install, start and enable openssh / sshd service
- Disable IPv6 support for UFW to prevent ip6_tables failure for missing kernel module
- Open port tcp/22 using ufw
- Confirmed port was open and service was running
- Looked for the port to be open on my TrueNAS server but only saw it open on IPv6 it seems
I cannot access ssh on my LAN after taking these steps, and I can’t seem to find any good information out there yet on using this interface.
Help appreciated!
For anyone who might see this post in the future, looking into LXC containers helped me get a handle on things. I suggest if you run into any issues to search LXC documentation/posts for hints.
In this case there were a few things I ran into…
- root does not have a password and by default cannot be connected to by SSH (you can assign a password and allow this via sshd_config if desired)
- No users are set up by default, so, ideally, you should set up a user that has limited access and adjust your sshd_config (/etc/ssh/sshd_config for me) as needed
- Make sure you always restart your sshd.service after any changes
systemctl restart sshd.service
- You can access your container via the macvlan created IP directly on your LAN, or if you use a proxy it should show up on the relevant port on the TrueNAS server
Might be some obvious stuff, but hopefully someone finds this information useful. The best thing was to know this was an LXC container and to look for resources with that in mind.
I’m not sure if there is a smoother way to handle this, but another thing I ran into was working in a dataset mounted to the container.
To make this function corrected I needed to (in TrueNAS):
- Assign an appropriate user / group to the dataset
- Ensure the group had the desired access level (write access in my case) in the dataset. Both of these steps done in the datasets management dashboard.
Then (In the container):
- Make sure the created user in my container had a matching user id or group id (you can define a group with the same group id and then use that)
- You can use
ls -la to see the currently assigned user / group to the folder. If you only see the id number itself, that indicates you are missing a named version of that id in the container.
- In my case, I created a group to match the group I created in TrueNAS and matched the group ID based on the
ls -la output
- Last, make sure you log out and back in to ensure the changes apply