SSH from Windows to Linux without entering a password












8















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?










share|improve this question















migrated from stackoverflow.com Jan 15 '10 at 2:28


This question came from our site for professional and enthusiast programmers.























    8















    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?










    share|improve this question















    migrated from stackoverflow.com Jan 15 '10 at 2:28


    This question came from our site for professional and enthusiast programmers.





















      8












      8








      8


      5






      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?










      share|improve this question
















      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?







      windows linux ssh scp






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 '11 at 9:08









      Peter Mortensen

      8,376166185




      8,376166185










      asked Jan 13 '10 at 16:44







      Josh











      migrated from stackoverflow.com Jan 15 '10 at 2:28


      This question came from our site for professional and enthusiast programmers.









      migrated from stackoverflow.com Jan 15 '10 at 2:28


      This question came from our site for professional and enthusiast programmers.
























          8 Answers
          8






          active

          oldest

          votes


















          7














          You need Pageant.



          See the video Password-less login with PuTTY and Pageant. And/or the blog post Howto: Passwordless SSH authentication with PuTTY.






          share|improve this answer





















          • 1





            Please try to link to text-based tutorials instead of videos.

            – a coder
            Mar 30 '15 at 18:43











          • The blog link is broken. Try this one: tecmint.com/ssh-passwordless-login-with-putty

            – Kai Wang
            Dec 15 '15 at 14:14











          • The blog link broken is the exact reason answers should be more then a link.

            – Ramhound
            Jul 11 '16 at 21:45



















          6














          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.






          share|improve this answer


























          • 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.

            – badjr
            Jan 19 '18 at 15:09





















          3














          Try Plink (part of PuTTY)



           plink -v youruser@yourhost.com -pw yourpw "some linux command"





          share|improve this answer



















          • 2





            +1 for a correct response, but you're better off using a public/private key pair than a password.

            – Ted Percival
            Jan 13 '10 at 17:09



















          3














          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|improve this answer

































            2














            I'm assuming your keys are not password protected, and what you're getting is not a request for your key's password.



            ~/.ssh isn't used by putty on the windows side, and putty doesn't have a default private key setting. If you're using a command line ssh client such as cygwin, creating a .ssh directory off of your home would work. From putty, you'll need to configure and save a session.



            From the putty configuration dialog, look at connection -> data, and fill in the auto-login username field. Then go to connection -> ssh -> auth, and set your private key correctly. Then go back to the session dialog, and save this session. You can also set the hostname if you'd like.



            Once you have a saved session, you can use 'putty -load "savedsession"'.






            share|improve this answer
























            • 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.

              – Blisterpeanuts
              Sep 28 '18 at 15:40



















            1














            You may also need to change permissions on your home directory:



            chmod 755 ~





            share|improve this answer































              0














              I have tried a couple of ways of doing this and the first one that worked for me was ssh-copy-id



              #By default this puts keyfile pair in ~/.ssh/id_rsa & ~/.ssh/id_rsa.pub :

              ssh-keygen.exe -t rsa -b 2048
              ssh-copy-id -i ~/.ssh/id_rsa.pub $remoteuser@$remotehost


              # I'm not sure if these two chmod lines are needed on windows but
              # typically ssh refuses to use a private key file
              # if it is less-well protected than this:
              chmod 700 ~/.ssh
              chmod 640 ~/.ssh/id_rsa


              The easiest way to get the ssh tools is to install git for Windows.



              I ran the above commands from the git-installed bash shell. Running ssh-copy-id from powershell somehow didn't work so I ended with this PowerShell script



              Param(
              [Parameter()][string]$keyfile="id_rsa",
              [Parameter()][string]$remotehost,
              [Parameter()][string]$remoteuser
              )
              write-host "# ---------------------------------------------------------------------------------#"
              write-host "# Create an RSA public/private key pair, and copy the public key to remote server #"
              write-host "# #"
              write-host "# https://superuser.com/questions/96051 #"
              write-host "# ssh-from-windows-to-linux-without-entering-a-password/1194805#1194805 #"
              write-host "# #"
              write-host "# ---------------------------------------------------------------------------------#"

              write-host "Keyfile pair will be saved at : ~/.ssh/$keyfile, ~/.ssh/$keyfile.pub"
              write-host "And copied to $remoteuser@$remotehost"
              write-host ""
              write-host "You will need a password for the copy operation."
              write-host ""

              if( -not $(ls ~/.ssh) ) { mkdir ~/.ssh }
              $sshdir=$(get-item ~/.ssh/).Fullname

              #By default this puts keyfile pair in ~/.ssh/id_rsa & ~/.ssh/id_rsa.pub :
              ssh-keygen.exe -t rsa -b 2048 -f "$sshdir$keyfile"
              bash -c "ssh-copy-id -i ~/.ssh/$keyfile.pub $remoteuser@$remotehost"

              # I'm not sure if these two chmod lines work on windows but
              # typically ssh refuses to use a private key file
              # if it is less-well protected than this:
              chmod.exe 700 $sshdir
              chmod.exe 640 "$sshdir$keyfile"





              share|improve this answer

































                0














                I was able to do this exactly from Windows 7 by using the -i option for supplying an identity private key:




                ssh -i X:win-pathtoprivate-key remoteuser@remote.host.com




                except that on the remote host, my authorized keys are in /etc/ssh/authorized_keys/remoteuser and in /etc/ssh/sshd_config, I changed



                #AuthorizedKeysFile     .ssh/authorized_keys
                AuthorizedKeysFile /etc/ssh/authorized_keys/%u


                but I don't know if the SSH remote config should matter.






                share|improve this answer























                  Your Answer








                  StackExchange.ready(function() {
                  var channelOptions = {
                  tags: "".split(" "),
                  id: "3"
                  };
                  initTagRenderer("".split(" "), "".split(" "), channelOptions);

                  StackExchange.using("externalEditor", function() {
                  // Have to fire editor after snippets, if snippets enabled
                  if (StackExchange.settings.snippets.snippetsEnabled) {
                  StackExchange.using("snippets", function() {
                  createEditor();
                  });
                  }
                  else {
                  createEditor();
                  }
                  });

                  function createEditor() {
                  StackExchange.prepareEditor({
                  heartbeatType: 'answer',
                  autoActivateHeartbeat: false,
                  convertImagesToLinks: true,
                  noModals: true,
                  showLowRepImageUploadWarning: true,
                  reputationToPostImages: 10,
                  bindNavPrevention: true,
                  postfix: "",
                  imageUploader: {
                  brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                  contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                  allowUrls: true
                  },
                  onDemand: true,
                  discardSelector: ".discard-answer"
                  ,immediatelyShowMarkdownHelp:true
                  });


                  }
                  });














                  draft saved

                  draft discarded


















                  StackExchange.ready(
                  function () {
                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f96051%2fssh-from-windows-to-linux-without-entering-a-password%23new-answer', 'question_page');
                  }
                  );

                  Post as a guest















                  Required, but never shown
























                  8 Answers
                  8






                  active

                  oldest

                  votes








                  8 Answers
                  8






                  active

                  oldest

                  votes









                  active

                  oldest

                  votes






                  active

                  oldest

                  votes









                  7














                  You need Pageant.



                  See the video Password-less login with PuTTY and Pageant. And/or the blog post Howto: Passwordless SSH authentication with PuTTY.






                  share|improve this answer





















                  • 1





                    Please try to link to text-based tutorials instead of videos.

                    – a coder
                    Mar 30 '15 at 18:43











                  • The blog link is broken. Try this one: tecmint.com/ssh-passwordless-login-with-putty

                    – Kai Wang
                    Dec 15 '15 at 14:14











                  • The blog link broken is the exact reason answers should be more then a link.

                    – Ramhound
                    Jul 11 '16 at 21:45
















                  7














                  You need Pageant.



                  See the video Password-less login with PuTTY and Pageant. And/or the blog post Howto: Passwordless SSH authentication with PuTTY.






                  share|improve this answer





















                  • 1





                    Please try to link to text-based tutorials instead of videos.

                    – a coder
                    Mar 30 '15 at 18:43











                  • The blog link is broken. Try this one: tecmint.com/ssh-passwordless-login-with-putty

                    – Kai Wang
                    Dec 15 '15 at 14:14











                  • The blog link broken is the exact reason answers should be more then a link.

                    – Ramhound
                    Jul 11 '16 at 21:45














                  7












                  7








                  7







                  You need Pageant.



                  See the video Password-less login with PuTTY and Pageant. And/or the blog post Howto: Passwordless SSH authentication with PuTTY.






                  share|improve this answer















                  You need Pageant.



                  See the video Password-less login with PuTTY and Pageant. And/or the blog post Howto: Passwordless SSH authentication with PuTTY.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jul 11 '16 at 21:38









                  Giri

                  51927




                  51927










                  answered Jan 13 '10 at 16:49









                  EduardoEduardo

                  18714




                  18714








                  • 1





                    Please try to link to text-based tutorials instead of videos.

                    – a coder
                    Mar 30 '15 at 18:43











                  • The blog link is broken. Try this one: tecmint.com/ssh-passwordless-login-with-putty

                    – Kai Wang
                    Dec 15 '15 at 14:14











                  • The blog link broken is the exact reason answers should be more then a link.

                    – Ramhound
                    Jul 11 '16 at 21:45














                  • 1





                    Please try to link to text-based tutorials instead of videos.

                    – a coder
                    Mar 30 '15 at 18:43











                  • The blog link is broken. Try this one: tecmint.com/ssh-passwordless-login-with-putty

                    – Kai Wang
                    Dec 15 '15 at 14:14











                  • The blog link broken is the exact reason answers should be more then a link.

                    – Ramhound
                    Jul 11 '16 at 21:45








                  1




                  1





                  Please try to link to text-based tutorials instead of videos.

                  – a coder
                  Mar 30 '15 at 18:43





                  Please try to link to text-based tutorials instead of videos.

                  – a coder
                  Mar 30 '15 at 18:43













                  The blog link is broken. Try this one: tecmint.com/ssh-passwordless-login-with-putty

                  – Kai Wang
                  Dec 15 '15 at 14:14





                  The blog link is broken. Try this one: tecmint.com/ssh-passwordless-login-with-putty

                  – Kai Wang
                  Dec 15 '15 at 14:14













                  The blog link broken is the exact reason answers should be more then a link.

                  – Ramhound
                  Jul 11 '16 at 21:45





                  The blog link broken is the exact reason answers should be more then a link.

                  – Ramhound
                  Jul 11 '16 at 21:45













                  6














                  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.






                  share|improve this answer


























                  • 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.

                    – badjr
                    Jan 19 '18 at 15:09


















                  6














                  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.






                  share|improve this answer


























                  • 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.

                    – badjr
                    Jan 19 '18 at 15:09
















                  6












                  6








                  6







                  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.






                  share|improve this answer















                  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.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 14 '11 at 9:16









                  Peter Mortensen

                  8,376166185




                  8,376166185










                  answered Jan 13 '10 at 16:50









                  Silvio DonniniSilvio Donnini

                  444169




                  444169













                  • 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.

                    – badjr
                    Jan 19 '18 at 15:09





















                  • 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.

                    – badjr
                    Jan 19 '18 at 15:09



















                  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.

                  – badjr
                  Jan 19 '18 at 15:09







                  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.

                  – badjr
                  Jan 19 '18 at 15:09













                  3














                  Try Plink (part of PuTTY)



                   plink -v youruser@yourhost.com -pw yourpw "some linux command"





                  share|improve this answer



















                  • 2





                    +1 for a correct response, but you're better off using a public/private key pair than a password.

                    – Ted Percival
                    Jan 13 '10 at 17:09
















                  3














                  Try Plink (part of PuTTY)



                   plink -v youruser@yourhost.com -pw yourpw "some linux command"





                  share|improve this answer



















                  • 2





                    +1 for a correct response, but you're better off using a public/private key pair than a password.

                    – Ted Percival
                    Jan 13 '10 at 17:09














                  3












                  3








                  3







                  Try Plink (part of PuTTY)



                   plink -v youruser@yourhost.com -pw yourpw "some linux command"





                  share|improve this answer













                  Try Plink (part of PuTTY)



                   plink -v youruser@yourhost.com -pw yourpw "some linux command"






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 13 '10 at 16:50









                  Carlos GutiérrezCarlos Gutiérrez

                  248149




                  248149








                  • 2





                    +1 for a correct response, but you're better off using a public/private key pair than a password.

                    – Ted Percival
                    Jan 13 '10 at 17:09














                  • 2





                    +1 for a correct response, but you're better off using a public/private key pair than a password.

                    – Ted Percival
                    Jan 13 '10 at 17:09








                  2




                  2





                  +1 for a correct response, but you're better off using a public/private key pair than a password.

                  – Ted Percival
                  Jan 13 '10 at 17:09





                  +1 for a correct response, but you're better off using a public/private key pair than a password.

                  – Ted Percival
                  Jan 13 '10 at 17:09











                  3














                  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|improve this answer






























                    3














                    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|improve this answer




























                      3












                      3








                      3







                      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|improve this answer















                      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|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Nov 14 '11 at 9:18









                      Peter Mortensen

                      8,376166185




                      8,376166185










                      answered Jan 13 '10 at 16:57









                      rcw3rcw3

                      1313




                      1313























                          2














                          I'm assuming your keys are not password protected, and what you're getting is not a request for your key's password.



                          ~/.ssh isn't used by putty on the windows side, and putty doesn't have a default private key setting. If you're using a command line ssh client such as cygwin, creating a .ssh directory off of your home would work. From putty, you'll need to configure and save a session.



                          From the putty configuration dialog, look at connection -> data, and fill in the auto-login username field. Then go to connection -> ssh -> auth, and set your private key correctly. Then go back to the session dialog, and save this session. You can also set the hostname if you'd like.



                          Once you have a saved session, you can use 'putty -load "savedsession"'.






                          share|improve this answer
























                          • 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.

                            – Blisterpeanuts
                            Sep 28 '18 at 15:40
















                          2














                          I'm assuming your keys are not password protected, and what you're getting is not a request for your key's password.



                          ~/.ssh isn't used by putty on the windows side, and putty doesn't have a default private key setting. If you're using a command line ssh client such as cygwin, creating a .ssh directory off of your home would work. From putty, you'll need to configure and save a session.



                          From the putty configuration dialog, look at connection -> data, and fill in the auto-login username field. Then go to connection -> ssh -> auth, and set your private key correctly. Then go back to the session dialog, and save this session. You can also set the hostname if you'd like.



                          Once you have a saved session, you can use 'putty -load "savedsession"'.






                          share|improve this answer
























                          • 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.

                            – Blisterpeanuts
                            Sep 28 '18 at 15:40














                          2












                          2








                          2







                          I'm assuming your keys are not password protected, and what you're getting is not a request for your key's password.



                          ~/.ssh isn't used by putty on the windows side, and putty doesn't have a default private key setting. If you're using a command line ssh client such as cygwin, creating a .ssh directory off of your home would work. From putty, you'll need to configure and save a session.



                          From the putty configuration dialog, look at connection -> data, and fill in the auto-login username field. Then go to connection -> ssh -> auth, and set your private key correctly. Then go back to the session dialog, and save this session. You can also set the hostname if you'd like.



                          Once you have a saved session, you can use 'putty -load "savedsession"'.






                          share|improve this answer













                          I'm assuming your keys are not password protected, and what you're getting is not a request for your key's password.



                          ~/.ssh isn't used by putty on the windows side, and putty doesn't have a default private key setting. If you're using a command line ssh client such as cygwin, creating a .ssh directory off of your home would work. From putty, you'll need to configure and save a session.



                          From the putty configuration dialog, look at connection -> data, and fill in the auto-login username field. Then go to connection -> ssh -> auth, and set your private key correctly. Then go back to the session dialog, and save this session. You can also set the hostname if you'd like.



                          Once you have a saved session, you can use 'putty -load "savedsession"'.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jan 18 '10 at 19:31









                          Andrew BAndrew B

                          1335




                          1335













                          • 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.

                            – Blisterpeanuts
                            Sep 28 '18 at 15:40



















                          • 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.

                            – Blisterpeanuts
                            Sep 28 '18 at 15:40

















                          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.

                          – Blisterpeanuts
                          Sep 28 '18 at 15:40





                          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.

                          – Blisterpeanuts
                          Sep 28 '18 at 15:40











                          1














                          You may also need to change permissions on your home directory:



                          chmod 755 ~





                          share|improve this answer




























                            1














                            You may also need to change permissions on your home directory:



                            chmod 755 ~





                            share|improve this answer


























                              1












                              1








                              1







                              You may also need to change permissions on your home directory:



                              chmod 755 ~





                              share|improve this answer













                              You may also need to change permissions on your home directory:



                              chmod 755 ~






                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Aug 4 '10 at 12:18









                              HaydnHaydn

                              111




                              111























                                  0














                                  I have tried a couple of ways of doing this and the first one that worked for me was ssh-copy-id



                                  #By default this puts keyfile pair in ~/.ssh/id_rsa & ~/.ssh/id_rsa.pub :

                                  ssh-keygen.exe -t rsa -b 2048
                                  ssh-copy-id -i ~/.ssh/id_rsa.pub $remoteuser@$remotehost


                                  # I'm not sure if these two chmod lines are needed on windows but
                                  # typically ssh refuses to use a private key file
                                  # if it is less-well protected than this:
                                  chmod 700 ~/.ssh
                                  chmod 640 ~/.ssh/id_rsa


                                  The easiest way to get the ssh tools is to install git for Windows.



                                  I ran the above commands from the git-installed bash shell. Running ssh-copy-id from powershell somehow didn't work so I ended with this PowerShell script



                                  Param(
                                  [Parameter()][string]$keyfile="id_rsa",
                                  [Parameter()][string]$remotehost,
                                  [Parameter()][string]$remoteuser
                                  )
                                  write-host "# ---------------------------------------------------------------------------------#"
                                  write-host "# Create an RSA public/private key pair, and copy the public key to remote server #"
                                  write-host "# #"
                                  write-host "# https://superuser.com/questions/96051 #"
                                  write-host "# ssh-from-windows-to-linux-without-entering-a-password/1194805#1194805 #"
                                  write-host "# #"
                                  write-host "# ---------------------------------------------------------------------------------#"

                                  write-host "Keyfile pair will be saved at : ~/.ssh/$keyfile, ~/.ssh/$keyfile.pub"
                                  write-host "And copied to $remoteuser@$remotehost"
                                  write-host ""
                                  write-host "You will need a password for the copy operation."
                                  write-host ""

                                  if( -not $(ls ~/.ssh) ) { mkdir ~/.ssh }
                                  $sshdir=$(get-item ~/.ssh/).Fullname

                                  #By default this puts keyfile pair in ~/.ssh/id_rsa & ~/.ssh/id_rsa.pub :
                                  ssh-keygen.exe -t rsa -b 2048 -f "$sshdir$keyfile"
                                  bash -c "ssh-copy-id -i ~/.ssh/$keyfile.pub $remoteuser@$remotehost"

                                  # I'm not sure if these two chmod lines work on windows but
                                  # typically ssh refuses to use a private key file
                                  # if it is less-well protected than this:
                                  chmod.exe 700 $sshdir
                                  chmod.exe 640 "$sshdir$keyfile"





                                  share|improve this answer






























                                    0














                                    I have tried a couple of ways of doing this and the first one that worked for me was ssh-copy-id



                                    #By default this puts keyfile pair in ~/.ssh/id_rsa & ~/.ssh/id_rsa.pub :

                                    ssh-keygen.exe -t rsa -b 2048
                                    ssh-copy-id -i ~/.ssh/id_rsa.pub $remoteuser@$remotehost


                                    # I'm not sure if these two chmod lines are needed on windows but
                                    # typically ssh refuses to use a private key file
                                    # if it is less-well protected than this:
                                    chmod 700 ~/.ssh
                                    chmod 640 ~/.ssh/id_rsa


                                    The easiest way to get the ssh tools is to install git for Windows.



                                    I ran the above commands from the git-installed bash shell. Running ssh-copy-id from powershell somehow didn't work so I ended with this PowerShell script



                                    Param(
                                    [Parameter()][string]$keyfile="id_rsa",
                                    [Parameter()][string]$remotehost,
                                    [Parameter()][string]$remoteuser
                                    )
                                    write-host "# ---------------------------------------------------------------------------------#"
                                    write-host "# Create an RSA public/private key pair, and copy the public key to remote server #"
                                    write-host "# #"
                                    write-host "# https://superuser.com/questions/96051 #"
                                    write-host "# ssh-from-windows-to-linux-without-entering-a-password/1194805#1194805 #"
                                    write-host "# #"
                                    write-host "# ---------------------------------------------------------------------------------#"

                                    write-host "Keyfile pair will be saved at : ~/.ssh/$keyfile, ~/.ssh/$keyfile.pub"
                                    write-host "And copied to $remoteuser@$remotehost"
                                    write-host ""
                                    write-host "You will need a password for the copy operation."
                                    write-host ""

                                    if( -not $(ls ~/.ssh) ) { mkdir ~/.ssh }
                                    $sshdir=$(get-item ~/.ssh/).Fullname

                                    #By default this puts keyfile pair in ~/.ssh/id_rsa & ~/.ssh/id_rsa.pub :
                                    ssh-keygen.exe -t rsa -b 2048 -f "$sshdir$keyfile"
                                    bash -c "ssh-copy-id -i ~/.ssh/$keyfile.pub $remoteuser@$remotehost"

                                    # I'm not sure if these two chmod lines work on windows but
                                    # typically ssh refuses to use a private key file
                                    # if it is less-well protected than this:
                                    chmod.exe 700 $sshdir
                                    chmod.exe 640 "$sshdir$keyfile"





                                    share|improve this answer




























                                      0












                                      0








                                      0







                                      I have tried a couple of ways of doing this and the first one that worked for me was ssh-copy-id



                                      #By default this puts keyfile pair in ~/.ssh/id_rsa & ~/.ssh/id_rsa.pub :

                                      ssh-keygen.exe -t rsa -b 2048
                                      ssh-copy-id -i ~/.ssh/id_rsa.pub $remoteuser@$remotehost


                                      # I'm not sure if these two chmod lines are needed on windows but
                                      # typically ssh refuses to use a private key file
                                      # if it is less-well protected than this:
                                      chmod 700 ~/.ssh
                                      chmod 640 ~/.ssh/id_rsa


                                      The easiest way to get the ssh tools is to install git for Windows.



                                      I ran the above commands from the git-installed bash shell. Running ssh-copy-id from powershell somehow didn't work so I ended with this PowerShell script



                                      Param(
                                      [Parameter()][string]$keyfile="id_rsa",
                                      [Parameter()][string]$remotehost,
                                      [Parameter()][string]$remoteuser
                                      )
                                      write-host "# ---------------------------------------------------------------------------------#"
                                      write-host "# Create an RSA public/private key pair, and copy the public key to remote server #"
                                      write-host "# #"
                                      write-host "# https://superuser.com/questions/96051 #"
                                      write-host "# ssh-from-windows-to-linux-without-entering-a-password/1194805#1194805 #"
                                      write-host "# #"
                                      write-host "# ---------------------------------------------------------------------------------#"

                                      write-host "Keyfile pair will be saved at : ~/.ssh/$keyfile, ~/.ssh/$keyfile.pub"
                                      write-host "And copied to $remoteuser@$remotehost"
                                      write-host ""
                                      write-host "You will need a password for the copy operation."
                                      write-host ""

                                      if( -not $(ls ~/.ssh) ) { mkdir ~/.ssh }
                                      $sshdir=$(get-item ~/.ssh/).Fullname

                                      #By default this puts keyfile pair in ~/.ssh/id_rsa & ~/.ssh/id_rsa.pub :
                                      ssh-keygen.exe -t rsa -b 2048 -f "$sshdir$keyfile"
                                      bash -c "ssh-copy-id -i ~/.ssh/$keyfile.pub $remoteuser@$remotehost"

                                      # I'm not sure if these two chmod lines work on windows but
                                      # typically ssh refuses to use a private key file
                                      # if it is less-well protected than this:
                                      chmod.exe 700 $sshdir
                                      chmod.exe 640 "$sshdir$keyfile"





                                      share|improve this answer















                                      I have tried a couple of ways of doing this and the first one that worked for me was ssh-copy-id



                                      #By default this puts keyfile pair in ~/.ssh/id_rsa & ~/.ssh/id_rsa.pub :

                                      ssh-keygen.exe -t rsa -b 2048
                                      ssh-copy-id -i ~/.ssh/id_rsa.pub $remoteuser@$remotehost


                                      # I'm not sure if these two chmod lines are needed on windows but
                                      # typically ssh refuses to use a private key file
                                      # if it is less-well protected than this:
                                      chmod 700 ~/.ssh
                                      chmod 640 ~/.ssh/id_rsa


                                      The easiest way to get the ssh tools is to install git for Windows.



                                      I ran the above commands from the git-installed bash shell. Running ssh-copy-id from powershell somehow didn't work so I ended with this PowerShell script



                                      Param(
                                      [Parameter()][string]$keyfile="id_rsa",
                                      [Parameter()][string]$remotehost,
                                      [Parameter()][string]$remoteuser
                                      )
                                      write-host "# ---------------------------------------------------------------------------------#"
                                      write-host "# Create an RSA public/private key pair, and copy the public key to remote server #"
                                      write-host "# #"
                                      write-host "# https://superuser.com/questions/96051 #"
                                      write-host "# ssh-from-windows-to-linux-without-entering-a-password/1194805#1194805 #"
                                      write-host "# #"
                                      write-host "# ---------------------------------------------------------------------------------#"

                                      write-host "Keyfile pair will be saved at : ~/.ssh/$keyfile, ~/.ssh/$keyfile.pub"
                                      write-host "And copied to $remoteuser@$remotehost"
                                      write-host ""
                                      write-host "You will need a password for the copy operation."
                                      write-host ""

                                      if( -not $(ls ~/.ssh) ) { mkdir ~/.ssh }
                                      $sshdir=$(get-item ~/.ssh/).Fullname

                                      #By default this puts keyfile pair in ~/.ssh/id_rsa & ~/.ssh/id_rsa.pub :
                                      ssh-keygen.exe -t rsa -b 2048 -f "$sshdir$keyfile"
                                      bash -c "ssh-copy-id -i ~/.ssh/$keyfile.pub $remoteuser@$remotehost"

                                      # I'm not sure if these two chmod lines work on windows but
                                      # typically ssh refuses to use a private key file
                                      # if it is less-well protected than this:
                                      chmod.exe 700 $sshdir
                                      chmod.exe 640 "$sshdir$keyfile"






                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Apr 2 '17 at 19:32

























                                      answered Apr 2 '17 at 17:28









                                      Chris F CarrollChris F Carroll

                                      20019




                                      20019























                                          0














                                          I was able to do this exactly from Windows 7 by using the -i option for supplying an identity private key:




                                          ssh -i X:win-pathtoprivate-key remoteuser@remote.host.com




                                          except that on the remote host, my authorized keys are in /etc/ssh/authorized_keys/remoteuser and in /etc/ssh/sshd_config, I changed



                                          #AuthorizedKeysFile     .ssh/authorized_keys
                                          AuthorizedKeysFile /etc/ssh/authorized_keys/%u


                                          but I don't know if the SSH remote config should matter.






                                          share|improve this answer




























                                            0














                                            I was able to do this exactly from Windows 7 by using the -i option for supplying an identity private key:




                                            ssh -i X:win-pathtoprivate-key remoteuser@remote.host.com




                                            except that on the remote host, my authorized keys are in /etc/ssh/authorized_keys/remoteuser and in /etc/ssh/sshd_config, I changed



                                            #AuthorizedKeysFile     .ssh/authorized_keys
                                            AuthorizedKeysFile /etc/ssh/authorized_keys/%u


                                            but I don't know if the SSH remote config should matter.






                                            share|improve this answer


























                                              0












                                              0








                                              0







                                              I was able to do this exactly from Windows 7 by using the -i option for supplying an identity private key:




                                              ssh -i X:win-pathtoprivate-key remoteuser@remote.host.com




                                              except that on the remote host, my authorized keys are in /etc/ssh/authorized_keys/remoteuser and in /etc/ssh/sshd_config, I changed



                                              #AuthorizedKeysFile     .ssh/authorized_keys
                                              AuthorizedKeysFile /etc/ssh/authorized_keys/%u


                                              but I don't know if the SSH remote config should matter.






                                              share|improve this answer













                                              I was able to do this exactly from Windows 7 by using the -i option for supplying an identity private key:




                                              ssh -i X:win-pathtoprivate-key remoteuser@remote.host.com




                                              except that on the remote host, my authorized keys are in /etc/ssh/authorized_keys/remoteuser and in /etc/ssh/sshd_config, I changed



                                              #AuthorizedKeysFile     .ssh/authorized_keys
                                              AuthorizedKeysFile /etc/ssh/authorized_keys/%u


                                              but I don't know if the SSH remote config should matter.







                                              share|improve this answer












                                              share|improve this answer



                                              share|improve this answer










                                              answered Oct 25 '17 at 21:46









                                              amphibientamphibient

                                              76351431




                                              76351431






























                                                  draft saved

                                                  draft discarded




















































                                                  Thanks for contributing an answer to Super User!


                                                  • Please be sure to answer the question. Provide details and share your research!

                                                  But avoid



                                                  • Asking for help, clarification, or responding to other answers.

                                                  • Making statements based on opinion; back them up with references or personal experience.


                                                  To learn more, see our tips on writing great answers.




                                                  draft saved


                                                  draft discarded














                                                  StackExchange.ready(
                                                  function () {
                                                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f96051%2fssh-from-windows-to-linux-without-entering-a-password%23new-answer', 'question_page');
                                                  }
                                                  );

                                                  Post as a guest















                                                  Required, but never shown





















































                                                  Required, but never shown














                                                  Required, but never shown












                                                  Required, but never shown







                                                  Required, but never shown

































                                                  Required, but never shown














                                                  Required, but never shown












                                                  Required, but never shown







                                                  Required, but never shown







                                                  Popular posts from this blog

                                                  Terni

                                                  A new problem with tex4ht and tikz

                                                  Sun Ra