SSH from Windows to Linux without entering a password

74,144

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 -vss for more verbosity).

Share:
74,144

Related videos on Youtube

Peter Mortensen
Author by

Peter Mortensen

Updated on September 17, 2022

Comments

  • Peter Mortensen
    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 and id_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
    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
    Redi about 9 years
    Please try to link to text-based tutorials instead of videos.
  • Jen
    Jen over 8 years
    The blog link is broken. Try this one: tecmint.com/ssh-passwordless-login-with-putty
  • Ramhound
    Ramhound almost 8 years
    The blog link broken is the exact reason answers should be more then a link.
  • badjr
    badjr over 6 years
    Note: (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
    Blisterpeanuts over 5 years
    Also, 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
    PYK over 4 years
    Despite 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
    Eduardo almost 4 years
    The blog link is not broken, at least not anymore...
  • XuMuK
    XuMuK over 3 years
    But before you must run ssh-keygen command
  • cdsaenz
    cdsaenz about 3 years
    THIS 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.