Results 1 to 8 of 8
Discuss SSH keys at the iPhone "2G" (Rev. 1) - Hackint0sh.org; Hi Folks, I am trying to stabilish a ssh key with my Mac and iPhone, ...
  1. #1
    Advanced Array

    Join Date
    Oct 2007
    Posts
    36
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default SSH keys

    Hi Folks,



    I am trying to stabilish a ssh key with my Mac and iPhone, I copy the keys from one to another, but can't have an automatic login, iPhone's ssh demom keeps asking me for a password.

    Has anyone done this before?


    Thanks!



  2. #2
    Amazingly Knowledgeable Array

    Join Date
    Oct 2007
    Posts
    803
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    47

    Default

    you entered a wrong password.

  3. #3
    Newbie Array

    Join Date
    Dec 2007
    Posts
    2
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    *bump*

    I too am having problems setting up ssh keys - everything is being set up fine, but whenever I try to connect from the terminal I get a passowrd prompt - is the iPhone/Touch sshd set up slightly differently to normal and not running a suitable authentification agent?

    This is what I used to set up the key pairs:
    Code:
    $ ssh-keygen -t rsa -f ~/.ssh/id_rsa
    
    $ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
    
    $ cat ~/.ssh/id_rsa.pub | ssh root@iphoneipaddress ‘cat - >> ~/.ssh/authorized_keys’
    I have been able to input the above (substituting user@mymacipaddress) into mobile terminal to set up key pairs back to the mac, but trying it the other way above doesn't work which has me a little bamboozled

    Anyone have keys working for mac -> iphone and able to share how they did it?

    Many thanks, T.

  4. #4
    Advanced Array

    Join Date
    Nov 2007
    Posts
    32
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    YGPM both of you.

    Pm'ed it because I don't know if I'm allowed to type it in here lol.

  5. #5
    Amazingly Knowledgeable Array

    Join Date
    Oct 2007
    Posts
    803
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    47

    Default

    SSH key and password are two separate things. Do not compare apple to orange.


  6. #6
    Senior Professional Array

    Join Date
    Nov 2007
    Posts
    155
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    15

    Default

    I don't have the iPhone yet so can't really comment on the implementation of ssh on iPhone, but what is usually needed are a number of things for ssh key based stuff to work.

    First of all the ssh daemon configuration must support RSA authentication
    Second the authentication mechanism must support the correct VERSION of the keys (1 or 2)
    Authorized keys file must contain the right keys
    The permissions on the folders, keys and authorized_keys file must be correct (600 for keys, 644 for authorized_keys)

    I hope it helps...

  7. #7
    Newbie Array

    Join Date
    Dec 2007
    Posts
    2
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Default

    @isom3tric
    Thanks for the password, but our request is slightly different. I have been ssh'ing into the iPhone/Touch ok, then typing in my password, but I am after something slightly different here - by setting up public keys on the phone and your home computer, you can ssh in without password prompt which means I can then start creating a few cron jobs/automator 'apps'.

    @toruonu
    Thanks for the tips. Running with a bit of verbose output, I see that the openssh installation on the phone is running protocol 2 with should be supporting my rsa keys.

    You will note from my code that the two keys should be the same and I have 600 on them both (although I just changed to 644 to see if that would have any difference but no).

    The only other thing it could be (but I am an ssh n00b so maybe way off) is that openssh on the phone is blocking it as it is a root user on the phone?

    FYI, here is my verbose output (edited to remove my details/ip). Also note that it is in my known hosts from ordinary login, I deleted the known_hosts file to see if this was conflicting, but no affect)

    Code:
    $ ssh -v root@iphone.ip.address
    OpenSSH_4.5p1, OpenSSL 0.9.7l 28 Sep 2006
    debug1: Reading configuration data /etc/ssh_config
    debug1: Connecting to iphone.ip.address [iphone.ip.address] port 22.
    debug1: Connection established.
    debug1: identity file /Users/my_user/.ssh/identity type -1
    debug1: identity file /Users/my_user/.ssh/id_rsa type 1
    debug1: identity file /Users/my_user/.ssh/id_dsa type -1
    debug1: Remote protocol version 2.0, remote software version OpenSSH_4.6
    debug1: match: OpenSSH_4.6 pat OpenSSH*
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_4.5
    debug1: SSH2_MSG_KEXINIT sent
    debug1: SSH2_MSG_KEXINIT received
    debug1: kex: server->client aes128-cbc hmac-md5 none
    debug1: kex: client->server aes128-cbc hmac-md5 none
    debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
    debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
    debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
    debug1: Host 'iphone.ip.address' is known and matches the RSA host key.
    debug1: Found key in /Users/my_user/.ssh/known_hosts:1
    debug1: ssh_rsa_verify: signature correct
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug1: SSH2_MSG_NEWKEYS received
    debug1: SSH2_MSG_SERVICE_REQUEST sent
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug1: Authentications that can continue: publickey,password
    debug1: Next authentication method: publickey
    debug1: Trying private key: /Users/my_user/.ssh/identity
    debug1: Offering public key: /Users/my_user/.ssh/id_rsa
    debug1: Authentications that can continue: publickey,password
    debug1: Trying private key: /Users/my_user/.ssh/id_dsa
    debug1: Next authentication method: password

  8. #8
    Senior Professional Array

    Join Date
    Nov 2007
    Posts
    155
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    15

    Default

    Well it did try all three options (identity, id_rsa and id_dsa), if you did create your id_rsa with version two key, then that basically means that likely the root user is not allowed to login with keys.

    What you can do in theory is ssh into the iPhone with password and start a secondary ssh daemon on another port (say 2222) with more verbose output and try to login through that one. This way you don't screw up your ordinary ssh connection and can check why things are going wrong, though I have battled with getting keys to work in configurations where they ought to work a number of times and on at least half of them given up without finding the final cause...

    EDIT: one of the first things to try is to make all 3 key options (identity, id_rsa and id_dsa) and have them all as authorized keys, this way you at least eliminate the mismatched and expected versions ... Has worked for me before with SSH version 2 which expected a version 1 key only...

 

 

Similar Threads

  1. 4.0GM keys
    By dborca in forum iOS 4.x (iPhone OS 4.x)
    Replies: 1
    Last Post: 06-08-2010, 06:54 PM
  2. Descrypt keys.
    By fenderiukas in forum iOS 4.x (iPhone OS 4.x)
    Replies: 0
    Last Post: 06-08-2010, 06:18 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 02:05 PM.
twitter, follow us!