SSH from Windows to Linux without entering a password
Solution 1
You have to run an authentication agent on Windows.
For example, Pageant, used in combination with PuTTY (graphical SSH client) or Plink (its command line equivalent).
You'll need to tell Pageant your SSH server's public key. After that it will deal with your server's authentication requests while running in the background.
Solution 2
You need Pageant.
See the video Password-less login with PuTTY and Pageant. And/or the blog post Howto: Passwordless SSH authentication with PuTTY.
Solution 3
I used this:
c:\> type c:\users\my_name\.ssh\id_rsa.pub | ssh [email protected] "cat >> ~/.ssh/authorized_keys"
Solution 4
Try Plink (part of PuTTY)
plink -v [email protected] -pw yourpw "some linux command"
Solution 5
Setting up SSH key authentication can be a bit tricky. It sounds like you're covering all your bases. One thing that often catches people off guard - you need to make sure the .ssh
directory and its contents are owned by you and are read/writeably only by you.
Make sure to run this (on all your .ssh
directories):
chmod -R 700 on ~/.ssh
If that doesn't work, turn on verbose logging by adding -v
to your ssh
command (you can add up to three -vs
s for more verbosity).
Related videos on Youtube
Peter Mortensen
Updated on September 17, 2022Comments
-
Peter Mortensen over 1 year
I am trying to use ssh/scp from Windows to Linux without having to enter a password.
This is what I have done, and it doesn't seem to work:
- generated public and private keys using Putty Key Generator (on Windows)
- saved the files as
id_rsa.pub
andid_rsa
- copied them into
~/.ssh
- added id_rsa.pub to the Linux box in
~/.ssh/authorized_keys
- I then try to
ssh
to the Linux box from Windows and I still have to enter a password
Am I missing something?
-
Kshitij Aggarwal over 14 years+1 for a correct response, but you're better off using a public/private key pair than a password.
-
Redi about 9 yearsPlease try to link to text-based tutorials instead of videos.
-
Jen over 8 yearsThe blog link is broken. Try this one: tecmint.com/ssh-passwordless-login-with-putty
-
Ramhound almost 8 yearsThe blog link broken is the exact reason answers should be more then a link.
-
badjr over 6 yearsNote: (This wasn't obvious to me.) When opening Pageant, it will open as an icon in the notification area in the bottom right. Right click it, and click Add Key, and select the .ppk file that was generated from puttygen.
-
Blisterpeanuts over 5 yearsAlso, chmod 700 ~/.ssh on the target machine, and chmod 644 ~/.ssh/authorized keys. Once I followed your instructions and set the permissions correctly, it started working for me.
-
PYK over 4 yearsDespite the alternative, with plink you can't have a normal terminal with it, for example: the arrow keys wont work for the bash history
-
Eduardo almost 4 yearsThe blog link is not broken, at least not anymore...
-
XuMuK over 3 yearsBut before you must run
ssh-keygen
command -
cdsaenz about 3 yearsTHIS THIS! I used this tutorial to create the key, etc, at: chrisjhart.com/Windows-10-ssh-copy-id but I got all kind of errors, tried converting via puttygen.. All I needed was the chmod.