How to enable SSH login on macOS

If you have a reason to log in to your macOS machine, from a remote machine on your network, why not enable the SSH daemon.

How to enable SSH login on macOS If you have a reason to log in to your macOS machine, from a remote machine on your network, why not enable the SSH daemon.

Your macOS-powered laptop or desktop includes the Secure Shell (SSH) client, which allows you to log in to remote servers and desktops that listen for incoming SSH connections. But did you know that you can easily add the SSH daemon to macOS, such that you can also log in to your macOS-powered device from any machine on the same network? 

It's not only possible, it's really quite easy. Let me show you how. 

SEE: Mastermind con man behind Catch Me If You Can talks cybersecurity (TechRepublic download)

The first thing to do is to enable remote login. Open System Preferences and click Sharing. From within the Sharing window, make sure Remote Login is enabled. You might also want to control who can log in, by selecting Only These Users and then adding the users in question. 

I highly recommend against allowing all users to log in with SSH, as that could lead to a security breach. Once you've taken care of that, close out the System Preferences window and then open a terminal window on your Mac. You now need to find out the IP address of your macOS machine. 

To do that issue the command: 

ifconfig | less

You should also copy your SSH public key from the remote machine to the Mac with the command:

ssh-copy-id USER@IP 

Where USER is the Mac username and IP is the IP address of the Mac. 

With that taken care of, you can log in to your Mac, via SSH key authentication, so you don't have to worry that your user password can be sniffed out. 

Finally, to log in to the Mac from a remote machine with SSH, issue the command:

ssh USER@IP

 Again, USER is the username on your Mac and IP is the IP address of your Mac. 

And that's all there is to enabling SSH login to your macOS machine. 

Also see

macoshero.jpg

Image: Apple