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
Related
This question already has answers here:
Run a batch file when Pageant finishes loading SSH keys
(2 answers)
Closed 2 years ago.
I'm trying to create simple Windows batch script that will manage connectivity to our client. That includes some tunnels using plink.exe and socks chain. Each hop requires ssh key authentication for which I'm using pageant.exe.
I have each piece scripted out as needed, except the pageant part, where I struggle. Facts encountered:
If I only start pageant.exe it will start pageant agent without any SSH key loaded and script will continue right away. Then I can run pageant.exe my_key.ppk to add the key into pageant and passphrase will be prompted, however script will continue meanwhile as well, so script will continue to plink part which will fail, because user will not provide passphrase till that time.
I've been looking into pageant docs and found some CLI switches like -l that supposedly should list loaded keys, that however does not seems to work on Windows version. Seems like windows version is only accepting arguments in form of .ppk files
I'd like to basically make some kind of "wait" function until user will provide passphrase. Is there any way how to either list loaded keys directly from pageant or any generic method asking Windows environment for SSH keys?
Pageant has -c switch, which you can use to pass a command to be executed after a private key is loaded:
You can arrange for Pageant to start another program once it has initialised itself and loaded any keys specified on its command line. This program (perhaps a PuTTY, or a WinCVS making use of Plink, or whatever) will then be able to use the keys Pageant has loaded.
You do this by specifying the -c option followed by the command, like this:
C:\PuTTY\pageant.exe d:\main.ppk -c C:\PuTTY\putty.exe
Though in general Pageant is a tool for an interactive use, not for scripting. For scripting, use -i switch of Plink to provide a private key for authentication.
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)
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".
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)
my machine setup is as follows:
windows 7, Git for windows,Git Bash, openSSH 1.6 installed via cygwin.
I followed the instructions on https://help.github.com/articles/generating-ssh-keys
But I still have to login in everytime I push something.
I guess my setup is messed up... any help is very much appreciated.
To be able to use key-based authentication (instead of HTTP basic-auth), you have to use the SSH-Protocol. On Github, the URLs look like this:
git#github.com:username/repository.git
Once you use key authentication, you can use the common SSH tools to manage the connections. One of these tools is the SSH agent which will decrypt your private key once after loading and keep it in main memory while it is running. This allows new SSH sessions to use this key without having to bother you with a password-question.
You can add a private key to the current SSH agent session by running
ssh-add /path/to/key
If you want to remove the passphrase and it annoys you then enter:
ssh-keygen -p
enter the old passphrase and when asks for the new one, just leave it empty.
I now got it working kinda...
At first I uninstalled the ssh package from cygwin since git for windows ships with ssh.
like Holger said I had to add the key to the ssh-agent but from the git bash I was not able to add it. It worked like this:
eval 'ssh-agen.exe'
ssh-add ~/.ssh/id_rsa
After this I was able to push without entering a passphrase.
The only problem got left is that I have to add the key after every system reboot...
ANy ideas how to fix this?
These instructions are for Windows 7 and above.
Create a filename named .bashrc in your home directory (so full file path is C:\Users\XYZ\.bashrc where XYZ is your windows user name
In the file add these two lines. Note: change location of private key file if not at ~/.ssh/id_rsa
eval `ssh-agent`
ssh-add ~/.ssh/id_rsa
Open Git Bash application and you should be prompted with asking for your key's password