Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 6 down vote accepted

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 with whoami. To go to a particular account, use ssh jhayward@mymac. If you still have trouble, use ssh -v jhayward@mymac. You may see things like checking ~/.ssh/config. If you want to avoid typing jhaward@ all of the time, you can make (or add to) the file ~/.ssh/config with the lines

Host mymac
Hostname 1234.1234.1234
User jhaward

editing each line for your particular case (the Host is your nickname, the Hostname is the IP address, or mymac.local or whatever you currently use for ssh).

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).

share|improve this answer

Are you using ssh -l user host to ensure that the correct user name is passed through to the sshd on the receiving machine? Also, do check ~/.ssh/config for any overrides assuming you are using a command line ssh.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.