Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: SSH into localhost without a password

  1. #1
    Join Date
    Mar 2006
    Posts
    325
    Rep Power
    0

    Default SSH into localhost without a password

    I am trying to ssh locally into localhost without a password after i enter these two commands but Im still being asked for a password. where did i go wrong?
    Code:
    # ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
    # cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

    Code:
    ubuntu@oh-squiggly-line:~$ sudo chown -R ubuntu project
    ubuntu@oh-squiggly-line:~$ ssh-keygen -t rsa
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/ubuntu/.ssh/id_rsa): /home/ubuntu/project/.ssh/id_rsa
    /home/ubuntu/project/.ssh/id_rsa already exists.
    Overwrite (y/n)? y
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/ubuntu/project/.ssh/id_rsa.
    Your public key has been saved in /home/ubuntu/project/.ssh/id_rsa.pub.
    The key fingerprint is:
    87:6:43:6c:7e:j7:b:fd:sb:99:99:99:f9:99:99:99 ubuntu@oh-squiggly-line
    The key's randomart image is:
    +--[ RSA 2048]----+
    |                 |
    |         o       |
    |        o o      |
    |       . o .     |
    |      . S   .    |
    |       o   o  . o|
    |            o oB |
    |             .+=+|
    |            E=+*O|
    +-----------------+
    ubuntu@oh-squiggly-line:~$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys cat: /home/ubuntu/.ssh/id_rsa.pub: No such file or directory
    ubuntu@oh-squiggly-line:~$ cat ~/project/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
    ubuntu@oh-squiggly-line:~$ ssh localhost
    Enter passphrase for key '/home/ubuntu/.ssh/id_dsa':
    ubuntu@localhost's password:
    
    ubuntu@oh-squiggly-line:~$ ssh localhost
    Enter passphrase for key '/home/ubuntu/.ssh/id_dsa':
    ubuntu@localhost's password:
    Permission denied, please try again.
    ubuntu@localhost's password:
    
    ubuntu@oh-squiggly-line:~$
    1337

  2. #2
    Join Date
    Jul 2002
    Posts
    1,395
    Rep Power
    0

    Default

    Quote Originally Posted by wiel View Post
    I am trying to ssh locally into localhost without a password after i enter these two commands but Im still being asked for a password. where did i go wrong?
    Code:
    # ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
    # cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

    Code:
    ubuntu@oh-squiggly-line:~$ sudo chown -R ubuntu project
    ubuntu@oh-squiggly-line:~$ ssh-keygen -t rsa
    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/ubuntu/.ssh/id_rsa): /home/ubuntu/project/.ssh/id_rsa
    /home/ubuntu/project/.ssh/id_rsa already exists.
    Overwrite (y/n)? y
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /home/ubuntu/project/.ssh/id_rsa.
    Your public key has been saved in /home/ubuntu/project/.ssh/id_rsa.pub.
    The key fingerprint is:
    87:6:43:6c:7e:j7:b:fd:sb:99:99:99:f9:99:99:99 ubuntu@oh-squiggly-line
    The key's randomart image is:
    +--[ RSA 2048]----+
    |                 |
    |         o       |
    |        o o      |
    |       . o .     |
    |      . S   .    |
    |       o   o  . o|
    |            o oB |
    |             .+=+|
    |            E=+*O|
    +-----------------+
    ubuntu@oh-squiggly-line:~$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys cat: /home/ubuntu/.ssh/id_rsa.pub: No such file or directory
    ubuntu@oh-squiggly-line:~$ cat ~/project/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
    ubuntu@oh-squiggly-line:~$ ssh localhost
    Enter passphrase for key '/home/ubuntu/.ssh/id_dsa':
    ubuntu@localhost's password:
    
    ubuntu@oh-squiggly-line:~$ ssh localhost
    Enter passphrase for key '/home/ubuntu/.ssh/id_dsa':
    ubuntu@localhost's password:
    Permission denied, please try again.
    ubuntu@localhost's password:
    
    ubuntu@oh-squiggly-line:~$
    You need to edit /etc/ssh/sshd_config; Disable password challenge. Read
    Code:
    man sshd_config
    for more.

  3. #3
    Join Date
    Jul 2012
    Posts
    6
    Rep Power
    0

    Default

    Try Renaming the keys file mv .ssh/authorized_keys .ssh/authorized_keys2
    SSH2 used the authorized_keys2

  4. #4
    Join Date
    Aug 2002
    Posts
    612
    Rep Power
    0

    Default

    Seems the pub key wasn't created either....Could be a permissions issue as well.
    "To err is human - and to blame it on a computer is even more so."
    Alcatel One Touch PIXI 3 (4.5)
    LG Fortune 2

  5. #5
    Join Date
    Mar 2006
    Posts
    325
    Rep Power
    0

    Default

    i did fix this a couple weeks ago. i had locked myself out trying to do this and the only way onto the machine/instance was ssh. i deleted the openssh config files and got locked out . had to mount the image on another linux machine and get the openssh config and .shh folder replaced. i dont know why it worked but Im glad and if anybody wants to do that, backup first and go google because Im not sure how i solved the problem
    1337

  6. #6
    Join Date
    Jul 2002
    Posts
    1,395
    Rep Power
    0

    Default

    Quote Originally Posted by wiel View Post
    i did fix this a couple weeks ago. i had locked myself out trying to do this and the only way onto the machine/instance was ssh. i deleted the openssh config files and got locked out . had to mount the image on another linux machine and get the openssh config and .shh folder replaced. i dont know why it worked but Im glad and if anybody wants to do that, backup first and go google because Im not sure how i solved the problem
    So could it be you were caught in the middle of a version change? The default key type is now ECDSA instead of RSA.

  7. #7
    Join Date
    Mar 2006
    Posts
    325
    Rep Power
    0

    Default

    Quote Originally Posted by carey View Post
    So could it be you were caught in the middle of a version change? The default key type is now ECDSA instead of RSA.
    is that what theyre using in ubuntu 12? both of them were running 10
    1337

  8. #8
    igodit Guest

    Default

    I know this is an old post, but I had to ask. Why would you want to SSH to localhost?

  9. #9
    Join Date
    Mar 2006
    Posts
    325
    Rep Power
    0

    Default

    i was setting up hadoop at the time. i was doing this part
    http://hadoop.apache.org/docs/r0.20....passphraseless
    1337

  10. #10
    igodit Guest

    Default

    Okay, were you able to complete your Hadoop installation & configuration and why not use VirtualBox?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •