Estou tentando estabelecer uma conexão ssh do meu laptop (macbookpro) com o meu iphone. ao tentar copiar chaves do laptop para o iphone, obtendo:
$ ssh-copy-id -i ~/.ssh/id_rsa.pub mobile@iphone.local
/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
Ao tentar ssh apenas com a autenticação de senha, obtém basicamente o mesmo:
$ ssh -vvv mobile@iphone.local
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
a digitalização da porta 22 do meu iphone fornece:
$ 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
O estado da porta "tcpwrapped" em vez da versão do OpenSSH é realmente estranho e confuso ... Mas acredito que isso mostra algo de errado com a configuração do servidor.
As chaves estão boas, porque eu posso usá-las para conectar-se a outro host com êxito. Tentando gerar outras chaves - não fez alterações.
iphone / etc / ssh / sshd_config:
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
Qual é o problema? Alguém pode me indicar a direção certa?
Versão do OpenSSH no iphone:
$ ssh -V
OpenSSH 6.7p1, OpenSSL 0.9.8zg 11 Jun 2015
Acredito, iniciei o processo corretamente com
# launchctl load /Library/LaunchDaemons/com.openssh.sshd.plist
Eu já tentei remover known_hosts e todos os / etc / ssh / ssh_host_ no iphone ... Fique sem ideias. ((
ATUALIZAR
Tentei isso:
$ telnet iphone.local 22
Trying 192.168.1.53...
Connected to iphone.local.
Escape character is '^]'.
Connection closed by foreign host.
==> Nenhum banner sshd.
EDITAR
Eu verifiquei se o servidor roda no meu iphone:
ps aux | grep [s]shd
Eu deveria ter recebido uma linha como:
root 749 0.0 0.0 55164 5428 ? Ss Aug09 0:00 /usr/sbin/sshd -D
mas eu não fiz. Parece que foi meu problema. Agora eu tenho que descobrir como iniciar o processo no iOS.
ssh-copy-id
novamente.