I am shelling into my Mac (ssh) and get logged in with the wrong userid. There are three unprivileged user accounts on the system, and when I log in, I give my password, and whoami gives me either of the other unprivileged user accounts. (And I can't write to files I own, etc.)
I can workaround to access my account by su [my username], but I'm puzzled. Any suggestions?
Best Answer
ssh
can get confused if your short name is different between the two machines. You can check what your short name is on each machine withwhoami
. To go to a particular account, usessh jhayward@mymac
. If you still have trouble, usessh -v jhayward@mymac
. You may see things like checking~/.ssh/config
. If you want to avoid typingjhaward@
all of the time, you can make (or add to) the file~/.ssh/config
with the linesediting each line for your particular case (the
Host
is your nickname, theHostname
is the IP address, or mymac.local or whatever you currently use forssh
).Then you can just use
ssh mymac
.If you still have trouble, post some output from
ssh -v
but be careful to not post anything private (like IP addresses).