Manually generating your SSH key in macOS
To open the macOS Terminal, follow these steps:
- In Finder, choose Utilities from the Applications folder.
- Find Terminal in the Utilities listw.
- Open Terminal.
Generating an SSH key
An SSH key consists of a pair of files. One is the private key, which should never be shared with anyone. The other is the public key. The other file is a public key which allows you to log into the containers and VMs you provision. When you generate the keys, you will use ssh-keygen
to store the keys in a safe location so you can bypass the login prompt when connecting to your instances.
To generate SSH keys in macOS, follow these steps:
- Enter the following command in the Terminal window.
ssh-keygen -t rsa
This starts the key generation process. When you execute this command, the
ssh-keygen
utility prompts you to indicate where to store the key. - Press the ENTER key to accept the default location. The
ssh-keygen
utility prompts you for a passphrase. - Type in a passphrase. You can also hit the ENTER key to accept the default (no passphrase). However, this is not recommended.
You will need to enter the passphrase a second time to continue.
After you confirm the passphrase, the system generates the key pair.
Your private key is saved to the id_rsa
file in the .ssh
directory
In MAC, open the folder: ~/.ssh
# cd ~/.ssh
then open the the file “id_rsa”, copy the content.
pbcopy < ~/.ssh/id_rsa
Paste the key in below section 1 (private key)
pbcopy < ~/.ssh/id_rsa.pub
Paste the key in below section 3 (public key)
In section 2, Passphrase, provide the password that you provided while generating the key.
Finally Save it.
You will see something like below:
Now if you try to connect your bluehost server by using your account id & server IP.
My account id is zerin & server ip is: 50.87.172.132
so, I am going to type in terminal:
ssh zerin@50.87.172.132
It will ask me:
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Provide Yes
Then it will ask me bluehost server account password, provide it, you will be logged in server.
if you get error message that “Host key verification failed.“, then open /Users/zerin/.ssh/known_hosts file, find by 50.87.172.132, then delete the line, then try again.
There are 0 comments