Thursday, February 02, 2023

How to setup passwordless login to Ubuntu from Mac OS using ssh keys ?

 To set up passwordless login from a Mac OS laptop to an Ubuntu server using SSH keys, you can follow these steps:


Open Terminal on your Mac OS laptop.

Generate a new SSH key pair by running the following command:


ssh-keygen -t rsa


When prompted, accept the default file location and leave the passphrase blank (or enter a passphrase if desired).


Copy the public key to the Ubuntu server by running the following command:


ssh-copy-id <username>@<server_ip_or_hostname>


Replace <username> with the username on the Ubuntu server and <server_ip_or_hostname> with the IP address or hostname of the server.


Log in to the Ubuntu server using SSH to confirm that passwordless login is working:


ssh <username>@<server_ip_or_hostname>


If everything is set up correctly, you should be able to log in to the Ubuntu server without entering a password.