How to use a Mac ssh key in Putty (Windows)? - windows

I have generated a ssh key in the terminal of my Mac. How can I use this private key in Putty on my Windows pc? I don't want to generate a new ssh key for each computer.

To convert an id_rsa file to an id_rsa.ppk, you can use puttygen from putty's web site.
Choose File->Load Private Key
Enter the private key password if applicable
Press the button Save private key.
The converted key would be saved as "id_rsa.ppk".

Related

How do I create a bash script to allow me to log into multiple clients on a network without having me enter the password everytime?

I'm on my network but want to be able to quickly log onto multiple clients on it without having to type SSH username#ipaddress everytime and then be prompted for a password. They all have the same password, is there a way for this to be automated? tips and knowledge are greatly appreciated
ssh-keygen
will create your public/private key pair in the ~/.ssh directory. You can enter for every prompt. Please be aware that you should not share ~/.ssh/id_rsa (the generated private key) with anyone. Consider it your password.
The following command will upload your public key to each host in question:
ssh-copy-id username#ipaddress
The above command copies your ~/.ssh/id_rsa.pub (the public key) to the ~/.ssh/authorized_keys file on the remote box. You will be prompted for your password, but that should be the last time.
Once you have copied your public key, you should be able to log in after that without a password.
ssh username#ipaddress

How to create a .ppk private key file usnig ssh-keygen [duplicate]

Is there a way to convert PEM files to PPK files? (you may guess that Amazon EC2 gives me a PEM file, and I need to use the PPK format for SSH connectivity).
Use PuTTYGen
Creating and Using SSH Keys
Overview
vCloud Express now has the ability to create SSH Keys for Linux servers. This function will allow the user to create multiple custom keys by selecting the "My Account/Key Management" option. Once the key has been created the user will be required to select the desired SSH Key during the “Create Server” process for Linux.
Create and Use SSH Keys
Create keys
Navigate to “My Account”
Select “Key Management”
Create New Key.
During the key creation process you will be prompted to download your private key file in .PEM format. You will not be able to download the private key again as it is not stored in vCloud Express.
The “Default” checkbox is used for the API.
Deploy server and select key
Connect
SSH (Mac/Linux)
Copy .PEM file to the machine from which you are going to connect.
Make sure permissions on .PEM file are appropriate (chmod 600 file.pem)
Connect with ssh command: ssh vcloud#ipaddress –i privkey.pem
Putty (Windows)
Download Putty and puttygen from - here
Use puttygen to convert .PEM file to .PPK file.
Start puttygen and select “Load”
Select your .PEM file.
Putty will convert the .PEM format to .PPK format.
Select “Save Private Key” A passphrase is not required but can be used if additional security is required.
Connect with Putty.
Launch Putty and enter the host IP address. If connecting to the 10.X private address you must first establish an SSL VPN connection.
Navigate to Connection/SSH/Auth
Click “Browse” and select the .PPK file you exported from puttygen.
Click “Open.” When connection comes up enter username (default is vcloud).
Instructions copied from here
I'm rather shocked that this has not been answered since the solution is very simple.
As mentioned in previous posts, you would not want to convert it using C#, but just once. This is easy to do with PuTTYGen.
Download your .pem from AWS
Open PuTTYgen
Click "Load" on the right side about 3/4 down
Set the file type to *.*
Browse to, and Open your .pem file
PuTTY will auto-detect everything it needs, and you just need to click "Save private key" and you can save your ppk key for use with PuTTY
Enjoy!
If you have Linux machine just install puttygen in your system and use use below command to convert the key
pem to ppk use below command:
puttygen keyname -o keyname.ppk
Below command is use to convert ppk to pem not pem to ppk
puttygen filename.ppk -O private-openssh -o filename.pem
Download puttygen
Then open puttygen
click load
Set the file type to . all files
Save PrivateKey
and then u can just save any name that file became an ppk file
To SSH connectivity to AWS EC2 instance, You don't need to convert the .PEM file to PPK file even on windows machine, Simple SSH using 'git bash' tool. No need to download and convert these softwares - Hope this will save your time of downloading and converting keys and get you more time on EC2 things.
Convert .pem file to .ppk for Windows 10
You need to do following:
1. Download PuTTYGen with Pageant.
2. Press "load" button and select your ".pem" file.
3. Press "save private key" button and save your ".ppk" file.
4. Open Pageant and press "add key" button. Just all. Keep running Pageant in background.
5. Now login through SSH or SFTP without selecting password field.
Save YourPEMFILE.pem to your .ssh directory
Run puttygen from Command Prompt
a. Click “Load” button to “Load an existing private key file”
b. Change the file filter to “All Files (.)
c. Select the YourPEMFILE.pem
d. Click Open
e. Puttygen shows a notice saying that it Successfully imported foreign key. Click OK.
f. Click “Save private key” button
g. When asked if you are sure that you want to save without a passphrase entered, answer “Yes”.
h. Enter the file name YourPEMFILE.ppk
i. Click “Save”
PuTTYgen for Ubuntu/Linux and PEM to PPK
sudo apt install putty-tools
puttygen -t rsa -b 2048 -C "user#host" -o keyfile.ppk
I used a trial version of ZOC Terminal Emulator and it worked. It readily accepts the Amazon's *.pem files.
The trick is though, that you need to specify "ec2-user" instead of "root" for the username - despite the example shown in the EC2 console, which is wrong! ;-)
sudo yum install putty
sudo apt-get install putty-tools
To convert your .pem file to a .ppk file
sudo puttygen pemKey.pem -o ppkKey.ppk -O private
To convert a .ppk file to a .pem file
sudo puttygen ppkkey.ppk -O private-openssh -o pemkey.pem
I had the same issue with PuttyGen not wanting to import an openSSH private key. I tried everything and what I found out was the old version of PuttyGen did not support importing OpenSSH. Once I downloaded the latest Putty, puttygen then allowed it to import the openssh private key just fine. I now have a hole in the side of my desk for pounding my head against it for the past hour.

Generate SSH key on windows via command to specify email address

I have generated my keys using PuttyGen but need to be able to specify exactly the email address used with the following command but this doesn't work as I get an 'is not recognized as an internal or external command error'
ssh-keygen -t rsa -C "joebloggs#mycompany.com"
Can anyone assist in running this command on Windows 10?
You can use PuTTYgen to generate a key with those settings.
For the key type -t rsa you have to select SSH-2 RSA
and for the email / comment -C "joebloggs#mycompany.com" you have to set the Key comment field to joebloggs#mycompany.com
After clicking Generate your can get your public key from the Public key for pasting into OpenSSH authorized_keys file field (this is the same as id_rsa.pub when generated with ssh-keygen)
If you also need the private key to be saved in OpenSSH format just go to Conversions > Export OpenSSH key (this is the same as id_rsa when generated with ssh-keygen)

How to generate key on git bash

I use this command on git bash
`$ ssh-keygen -t rsa -C "eu.json#gmail.com"`
After that, these line of text show.
`'Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/jayson/.ssh/id_rsa):'.`
There is no other line of text shown and stuck there, I wait for long time and still nothing happen not like the video that i follow, I need to use it on laravel homestead.
You are supposed to click ENTER (twice if you don't want a passphrase associated to the private key).
That will validate the file to be saved.
/c/Users/jayson/.ssh/id_rsa (private key)
/c/Users/jayson/.ssh/id_rsa.pub (public key)

Pageant seem to have interference, does not work at all

I have a server setup with my public key and adding my private key to putty allows me to connect to the server properly. When I use pageant however, it doesn't work. My research showed that the event log with pageant running should look something like:
....
Pageant is running. Requesting keys.
Pageant has X SSH-2 keys
Trying Pageant key #0
....
however, my event log looks like
...
Pageant is running. Requesting keys.
...
It seems like pageant isn't responding to putty's key request. Any help in this would be appreciated.
Thanks
Seems like if you have a default private key configured like this guy did
Then it can break the pageant keys, it simply doesn't try to use them!
plink -v root#xx.xx.xx.xx fails
Reading private key file "D:\.ssh\id_rsa.ppk"
Pageant is running. Requesting keys.
Pageant has 1 SSH-2 keys
Configured key file not in Pageant
Using username "root".
Offered public key
Server refused our key
Server refused our key
plink -v -i x root#xx.xx.xx.xx which disables the default key
Unable to use key file "x" (unable to open file)
Pageant is running. Requesting keys.
Pageant has 1 SSH-2 keys
Using username "root".
Trying Pageant key #0
Authenticating with public key "key.pem" from agent
You need to see Trying Pageant key #0, #1 ,#2 etc

Resources