I'm trying to establish ssh connection from my laptop(macbookpro) to my iphone. when trying to copy keys from laptop to iphone getting:
$ ssh-copy-id -i ~/.ssh/id_rsa.pub email@example.com /usr/local/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /usr/local/bin/ssh-copy-id: ERROR: ssh_exchange_identification: Connection closed by remote host
When trying to ssh just with password authentication getting basically the same:
$ ssh -vvv firstname.lastname@example.org OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 debug1: Reading configuration data /etc/ssh_config debug1: /etc/ssh_config line 20: Applying options for * debug1: /etc/ssh_config line 102: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connecting to iphone.local [192.168.1.53] port 22. debug1: Connection established. debug3: Incorrect RSA1 identifier debug3: Could not load "/Users/Andryuwka/.ssh/id_rsa" as a RSA1 public key debug1: identity file /Users/Andryuwka/.ssh/id_rsa type 1 debug1: identity file /Users/Andryuwka/.ssh/id_rsa-cert type -1 debug1: identity file /Users/Andryuwka/.ssh/id_dsa type -1 debug1: identity file /Users/Andryuwka/.ssh/id_dsa-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.2 ssh_exchange_identification: Connection closed by remote host
scanning of port 22 of my iphone gives this:
$ sudo nmap -sS -sV -p 22 iphone.local Password: Starting Nmap 6.47 ( http://nmap.org ) at 2015-08-09 14:43 PDT Nmap scan report for iphone.local (192.168.1.53) Host is up (0.096s latency). PORT STATE SERVICE VERSION 22/tcp open tcpwrapped MAC Address: D8:BB:2C:83:F8:84 (Unknown) Service detection performed. Please report any incorrect results at http://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 0.45 seconds
"tcpwrapped" state of port instead of OpenSSH version is really strange and confusing... But I believe it shows that something wrong with server config.
Keys are fine, because I can use them to connect to another host successfully. Trying to generate another keys - did not make any changes.
SyslogFacility AUTHPRIV #LogLevel INFO PermitRootLogin yes #PermitRootLogin without-password #StrictModes yes #MaxAuthTries 6 #MaxSessions 10 #RSAAuthentication yes #PubkeyAuthentication yes # The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 # but this is overridden so installations will only check .ssh/authorized_keys AuthorizedKeysFile .ssh/authorized_keys # Kerberos options KerberosAuthentication yes KerberosOrLocalPasswd yes KerberosTicketCleanup yes # GSSAPI options GSSAPIAuthentication yes GSSAPICleanupCredentials yes GSSAPIStrictAcceptorCheck yes GSSAPIKeyExchange no UsePrivilegeSeparation sandbox # Default for new installations. AcceptEnv LANG LC_* Subsystem sftp /usr/libexec/sftp-server
What's the problem? Can anybody point me to the right direction?
OpenSSH version on iphone:
$ ssh -V OpenSSH 6.7p1, OpenSSL 0.9.8zg 11 Jun 2015
I believe, i launched the process correctly with
# launchctl load /Library/LaunchDaemons/com.openssh.sshd.plist
I've already tried to remove known_hosts and all /etc/ssh/ssh_host_ on iphone... Run out of ideas.((
$ telnet iphone.local 22 Trying 192.168.1.53... Connected to iphone.local. Escape character is '^]'. Connection closed by foreign host.
==> No sshd banner.
I've checked if the server runs on my iphone:
ps aux | grep [s]shd
I should have got a line such as:
root 749 0.0 0.0 55164 5428 ? Ss Aug09 0:00 /usr/sbin/sshd -D
but i didn't. Seems like it was my problem. Now I have to find out how to start the process on iOS.