The issue I am facing:
Pi-Hole is up and running fine and I can login to the web interface. Today was the first time I wanted to update, but I couldn't remember if or how I ever accessed Pi-Hole through SSH.
Note: Both the LXC container and the user in that container actually running Pi-Hole are named pihole. Sorry if this makes it confusing..
First thing I tried was SSHing into the host machine that is running the LXC container with Pi-Hole:
SSHed into the host machine
I am now root@host (i.e. I'm root of the system that's running the container)
Run lxc-attach -n pihole
I am now root@pihole (i.e. I'm root of the container with Pi-Hole on it)
pihole is not a recognized command
So, as root@pihole, I try switching to the user running Pi-hole (imaginatively named pihole):
su pihole
"This account is currently not available."
Odd. At this point I want to SSH into Pi-Hole without first going through the host of the container. I should be able to do this since the LXC container has a IP I know, but I don't have the password handy. So I change it while being root@pihole (passwd pihole).
Now that I know the password, I try to SSH into pihole@[IPofLXC]
Could not chdir to home directory /home/pihole: No such file or directory
This account is currently not available.
Connection to [IPofLXC] closed.
Appreciate any help! Otherwise my unupdatable system will slowly rot away...
Details about my system:
Turris Omnia with a LXC Container (Debian Bookworm)
What I have changed since installing Pi-hole:
Don't think anything of significance changed
That real pihole user only exists for running the pihole-FTL daemon (EDIT: not for ssh access):
$ ps -o uid,user,gid,group,pid,cmd -C pihole-FTL
UID USER GID GROUP PID CMD
999 pihole 995 pihole 31873 /usr/bin/pihole-FTL -f
It doesnt need a password to be set for that.
Besides this user not having a home folder, you would not be able to login with it bc the shell for that user is set to /usr/sbin/nologin:
Wow, that was fast! Thanks, that makes sense.. I didn't see the user/group shown in Settings -> System is under the header FTL Information, oops.
So now I know that this is definitely not an issue with Pi-Hole itself, but I'd be grateful if someone could help me SSH into the Pi-Hole. I can't find any info about this problem online.
I thought maybe I just... forgot about the user that's running it, but none of the users that cat /etc/passwd returns seem appropriate
Is the following scenario likely? When I installed Pi-Hole, I 1) created a user named pihole and 2) ran the Pi-Hole installer script under that user which overwrote that user somehow? Is that even technically possible?
I have another Pi-Hole installation running on a Raspberry Pi 0, where I simply used Raspberry Pi OS and the default pi user, so I'm not a complete beginner and shouldn't have messed up the installation itself.
They all have no shell except the root user.
But that one isnt allowed to SSH in on most distros OOTB:
$ man sshd_config
[..]
PermitRootLogin
Specifies whether root can log in using ssh(1). The
argument must be yes, prohibit-password,
forced-commands-only, or no. The default is
prohibit-password.
If this option is set to prohibit-password (or its dep‐
recated alias, without-password), password and key‐
board-interactive authentication are disabled for root.
If this option is set to forced-commands-only, root lo‐
gin with public key authentication will be allowed, but
only if the command option has been specified (which
may be useful for taking remote backups even if root
login is normally not allowed). All other authentica‐
tion methods are disabled for root.
If this option is set to no, root is not allowed to log
in.
I have no experience with LXC containers but if the adduser command is available when you attach as the root user, you could try create a new user name thats able to login via SSH with below:
adduser <NEW_USERNAME>
Yes it could I think
EDIT: Does below folder exist?
That might indicate the user already existed before you installed Pi-hole.
I just added the user "pi" and it works! There is apparently no /home/pihole, which makes it seem like I installed Pi-Hole without ever using the terminal somehow
I'm always amazed by how supportive FOSS communities are. You guys rock for taking a few minutes out of your day to help total strangers!