I'm trying to access a Mac remotely (I do have physical access to this Mac) through SSH from a Linux client computer. My goal is to access this Mac from outside the network. Port forwarding is set up on the router. From my client computer I'm able to
ssh user@ip for the public IP and I am able to get into the Mac, so port forwarding is working.
Now I want to set up SSH keys. I've generated SSH keys on my client computer but I wanted to get the SSH Daemon on the Mac setup first. I edited
/etc/ssh_config and set
PasswordAuthentication no. I restarted SSH with these commands:
sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist, then
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist. When I try to SSH in from the client again, it still asks for my password.
I took a look at this post and from the answer I added
UsePAM no to the config file and restarted the service with
launchctl again. I'm still being prompted for a password.
I also tried the solution here. I'm still being prompted for a password.
How do I set up my
ssh_config to so that it doesn't ask for the password and only accepts SSH keys? Am I not restarting the daemon properly? Is there another step I am missing?