Hello, I am unable to login via SSH using ssh keys with an alternate users. In my /home/altuser/.ssh/authorized_keys
file, I have pasted my Public SSH Key.
SSH only works as root user (using ssh keys). When I try to log in I get Permission denied (publickey)
error. What could be causing this? How can I log in with an alternate user using ssh keys?
Have you created the altuser
Linux account? It's not enough to just have a home directory there, you need to add an entry into the /etc/passwd
file.
Here's a wiki page showing how to add a user with sudo
privileges. You can ignore the sudo
parts if altuser
does not need sudo
.
You also need to ensure that both the .ssh directory and the authorized_keys file have appropriate permissions (0700 and 0600) and user ownership .
2 Likes
Yes, I installed the shadow package and used the useradd -m -s /bin/bash testuser
command. Are you sure openwrt's ssh server checks keys in /home/altuser/.ssh/authorized_keys
file? Does it use some other directory for validation instead?