Accessing remote linux machine from MacOS with key

There is a scenario where I have to access a remote linux machine via MacOS. Login mechanism is allowed though key and not a password. I have provided a PPK file which I can use for authentication purpose.

PPK File Not Supported by MacOS
The PPK file is not directly supported by MacOS terminal, rather we need a PEM(.pem) file for authentication. So first we need to convert this *.ppk file to *.pem file then after the same will be used for authentication purpose.

We need to install PuTTYgen (windows) first. Normally it comes with installer of PuTTY but if not installed, check this link- PuTTYgen

Converting  a .ppk file to a .pem file
  1. Start PuTTYgen. Under Actions, choose Load, and then navigate to your .ppk file.
  2. Choose the .ppk file, and then choose Open.
  3. Clear the Key passphrase and a Confirm passphrase fields.
  4. Note: The passphrase is used to encrypt the key and is an extra layer of protection. If your private key is discovered, it can't be used, because the passphrase is required to log in. Using a passphrase makes automation difficult, because human intervention is needed to log in to an instance, or copy files to an instance.
  5. Choose Conversions from the menu at the top of the PuTTY Key Generator, and then choose Export OpenSSH Key.
  6. For the PuTTYgen warning Are you sure you want to save this key without a passphrase to protect it?, choose Yes.
  7. Name the file and add the .pem extension.






Now our PEM file has been created. Copy this file to your MacOS, open terminal in Mac and follow below instructions-

Run the following command to change the file permissions to 600 to secure the key. You can also set them to 400. This step is required:

MacBook01:kumar$ chmod 600 newkey.pem

Now follow the below command to connect-

MacBook01:kumar$ ssh -i newkey.pem -p 1009 oracle@103.189.0.198

Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-87-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

199 packages can be updated.
120 updates are security updates.

New release '18.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


*** System restart required ***
Last login: Thu Apr 18 15:52:02 2019 from 182.75.116.138
oracle@103.189.0.198:~

Comments

Popular posts from this blog

Oracle SOA Suite- Implementing Email Notification

Oracle SOA Suite 12c- PKIX path building failed & unable to find valid certification path to requested target

Migration of Oracle SOA Suite Composite from 11g to 12c