ssh connection getting failed

Piyush
Hi guys,

I am facing a problem while implementing the SSH connection to my board and
I am just one step away from my goal.

Actually the problem statement is as follows:

I have an embedded development board based on s3c2440 microcontroller. The
cross compiled openSSH have been installed in the folder /usr/local/bin and
/usr/local/etc.

Following is the snapshot

~ $ ls -l /usr/local/bin/
-rwxr-xr-x    1 root     root       157786 Feb 23 23:01 scp
-rwxr-xr-x    1 root     root       245720 Feb 24 01:18 sftp
-rwxr-xr-x    1 root     root      3074202 Feb 24 01:20 ssh
-rwxrwxr-x    1 root     root      2392577 Feb 14  2017 ssh-add
-rwxrwxr-x    1 root     root      2290887 Feb 14  2017 ssh-agent
-rwxrwxr-x    1 root     root      2551181 Feb 14  2017 ssh-keygen
-rwxrwxr-x    1 root     root      2404513 Feb 14  2017 ssh-keyscan
-rwxrwxr-x    1 root     root      3250915 Feb 14  2017 sshd

and for /usr/local/etc:

~ $ ls -l /usr/local/etc/
-rw-r--r--    1 root     root       242153 Aug 30  2012 moduli
-rw-r--r--    1 root     root         1574 Oct  9  2013 ssh_config
-rw-------    1 root     root          668 Feb 25 03:09 ssh_host_dsa_key
-rw-r--r--    1 root     root          603 Feb 25 03:09
ssh_host_dsa_key.pub
-rw-------    1 root     root          227 Feb 25 03:10 ssh_host_ecdsa_key
-rw-r--r--    1 root     root          175 Feb 25 03:10
ssh_host_ecdsa_key.pub
-rw-------    1 root     root          672 Feb 25 03:15
ssh_host_ed25519_key
-rw-r--r--    1 root     root          603 Feb 25 03:15
ssh_host_ed25519_key.pub
-rw-------    1 root     root         1679 Feb 25 03:04 ssh_host_rsa_key
-rw-r--r--    1 root     root          395 Feb 25 03:04
ssh_host_rsa_key.pub
-rw-r--r--    1 root     root         3646 Feb 27 07:06 sshd_config
-rw-r--r--    1 root     root         3646 Feb 27 06:56 sshd_config_ori

Here you can see that I have done almost everything.

when I run ssh on my linux development board I get this :

~ $ 
~ $ /usr/local/bin/sshd
~ $ 
~ $ ps | grep ssh
  893 root     /usr/local/bin/sshd 
~ $ 
~ $ 

this means the SSH is running on my board.

Now the case is that my embedded linux does not have any login screen and
open up into the root screen automatically without asking for the password.

Now when I try to connect to the linux board from my computer through SSH
than it asks for the password for the root of the embedded linux board. But
I don't have any and therefore it terminates the SSH session after three
trials of password like this.

piyush@piyush-System-Product-Name:~$ sudo ssh root@192.168.18.32
root@192.168.18.32's password: 
Permission denied, please try again.
root@192.168.18.32's password: 
Permission denied, please try again.
root@192.168.18.32's password: 
Permission denied (publickey,password,keyboard-interactive).
piyush@piyush-System-Product-Name:~$ 

so whenever I try to execute the command passwd to create the password I
get following error:

~ $ passwd root
/etc/passwd: /etc/passwd: 1: root::0:0:root:/:/bin/sh: not found
/etc/passwd: /etc/passwd: 2: bin:*:1:1:bin:/bin:: not found
/etc/passwd: /etc/passwd: 3: daemon:*:2:2:daemon:/sbin:: not found
/etc/passwd: /etc/passwd: 4: nobody:*:99:99:Nobody:/:: not found
/etc/passwd: /etc/passwd: 5: sshd:x:74:74:Priviledge-separated: not found

So I want to know that how can I remove this problem for successful SSH
connection establishment.

davef
Try:

sudo ssh -vvv root@192.168.18.32

Evidently it gives you all the traffic as you try to set up the ssh
session.

Which kernel are you running 2.6.32.2 from FriendlyArm?

Piyush
Hi dave 

I am running 2.6.24 linux kernel 

Meanwhile here is the log of the -vvv option:

piyush@piyush-GT703AA-ACJ-a6123in:~$ ssh -vvv root@192.168.0.14
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.0.14 [192.168.0.14] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/piyush/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /home/piyush/.ssh/id_rsa type 1
debug1: identity file /home/piyush/.ssh/id_rsa-cert type -1
debug1: identity file /home/piyush/.ssh/id_dsa type -1
debug1: identity file /home/piyush/.ssh/id_dsa-cert type -1
debug1: identity file /home/piyush/.ssh/id_ecdsa type -1
debug1: identity file /home/piyush/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/piyush/.ssh/id_ed25519 type -1
debug1: identity file /home/piyush/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6
debug1: match: OpenSSH_6.6 pat OpenSSH_6.5*,OpenSSH_6.6* compat 0x14000000
debug2: fd 3 setting O_NONBLOCK
debug3: load_hostkeys: loading entries for host "192.168.0.14" from file
"/home/piyush/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file
/home/piyush/.ssh/known_hosts:2
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs:
ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.co
m,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp3
84,ecdsa-sha2-nistp521
debug2: compat_kex_proposal: original KEX proposal:
curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nis
tp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,di
ffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: Compat: skipping algorithm "curve25519-sha256@libssh.org"
debug2: compat_kex_proposal: compat KEX proposal:
ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-ex
change-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,dif
fie-hellman-group1-sha1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit:
ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-ex
change-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,dif
fie-hellman-group1-sha1
debug2: kex_parse_kexinit:
ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.co
m,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp3
84,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh
.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@
openssh.com,ssh-ed25519,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit:
aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,ae
s256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-
cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit:
aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,ae
s256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-
cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit:
hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-
128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@open
ssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-25
6,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-
96
debug2: kex_parse_kexinit:
hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-
128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@open
ssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-25
6,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-
96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: kex_parse_kexinit:
curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nis
tp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,di
ffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-dss
debug2: kex_parse_kexinit:
aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,ae
s256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-
cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit:
aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,ae
s256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-
cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit:
hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-
128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@open
ssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-25
6,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-
96
debug2: kex_parse_kexinit:
hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-
128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,
hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@open
ssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-25
6,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-
96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: mac_setup: setup hmac-md5-etm@openssh.com
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug2: mac_setup: setup hmac-md5-etm@openssh.com
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA
65:34:72:0f:dc:99:fc:db:c3:19:f6:48:b8:75:07:ce
debug3: load_hostkeys: loading entries for host "192.168.0.14" from file
"/home/piyush/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file
/home/piyush/.ssh/known_hosts:2
debug3: load_hostkeys: loaded 1 keys
debug1: Host '192.168.0.14' is known and matches the ECDSA host key.
debug1: Found key in /home/piyush/.ssh/known_hosts:2
debug1: ssh_ecdsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/piyush/.ssh/id_rsa (0xb81d3db8),
debug2: key: /home/piyush/.ssh/id_dsa ((nil)),
debug2: key: /home/piyush/.ssh/id_ecdsa ((nil)),
debug2: key: /home/piyush/.ssh/id_ed25519 ((nil)),
debug1: Authentications that can continue:
publickey,password,keyboard-interactive
debug3: start over, passed a different list
publickey,password,keyboard-interactive
debug3: preferred
gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/piyush/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue:
publickey,password,keyboard-interactive
debug1: Trying private key: /home/piyush/.ssh/id_dsa
debug3: no such identity: /home/piyush/.ssh/id_dsa: No such file or
directory
debug1: Trying private key: /home/piyush/.ssh/id_ecdsa
debug3: no such identity: /home/piyush/.ssh/id_ecdsa: No such file or
directory
debug1: Trying private key: /home/piyush/.ssh/id_ed25519
debug3: no such identity: /home/piyush/.ssh/id_ed25519: No such file or
directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug2: we sent a keyboard-interactive packet, wait for reply
debug1: Authentications that can continue:
publickey,password,keyboard-interactive
debug3: userauth_kbdint: disable: no info_req_seen
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: 
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
root@192.168.0.14's password: 
debug3: packet_send2: adding 64 (len 45 padlen 19 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentications that can continue:
publickey,password,keyboard-int...stripped-down

davef
Sorry I never tried to debug this output.

I have just noticed that you tried to change the passwd.  So, you have a
debug connection and can watch the boot messages.

After it boots up what are the last say 10 lines?