I set public key authentication on my rpi and disabled password login in the sshd_config file. There are two users:
userA is my main user. In addition there are two computers (
I created diffrent keys for both computers as usual.
pc1 should be able to log in to both users. So I added his public key to both user's authorized_keys file.
pc2 shall not be able to log in to
userA. That's why I added his public key only to
userB's authorized_keys file.
Now if I try to log in from
$ ssh userA@hostname the permission is denied like I wanted, while log in to
userB is allowed. Everything works greate so far.
But when I log in from
userB an run
$ su userA I'm still able to access
userA by just enter the password.
Is there a possibility to avoid this? I don't want
pc2 to be able to log in on
userA at all.