February 21, 2017

SSH connection for AT91SAM9261 controller

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 AT91SAM9261 microcontroller. The cross compiled openSSH have been installed in the folder /usr/local/bin and /usr/local/etc.

Following is the snapshot

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

and for /usr/local/etc:

  1. ~ $ ls -l /usr/local/etc/
  2. -rw-r--r--    1 root     root       242153 Aug 30  2012 moduli
  3. -rw-r--r--    1 root     root         1574 Oct  9  2013 ssh_config
  4. -rw-------    1 root     root          668 Feb 25 03:09 ssh_host_dsa_key
  5. -rw-r--r--    1 root     root          603 Feb 25 03:09 ssh_host_dsa_key.pub
  6. -rw-------    1 root     root          227 Feb 25 03:10 ssh_host_ecdsa_key
  7. -rw-r--r--    1 root     root          175 Feb 25 03:10 ssh_host_ecdsa_key.pub
  8. -rw-------    1 root     root          672 Feb 25 03:15 ssh_host_ed25519_key
  9. -rw-r--r--    1 root     root          603 Feb 25 03:15 ssh_host_ed25519_key.pub
  10. -rw-------    1 root     root         1679 Feb 25 03:04 ssh_host_rsa_key
  11. -rw-r--r--    1 root     root          395 Feb 25 03:04 ssh_host_rsa_key.pub
  12. -rw-r--r--    1 root     root         3646 Feb 27 07:06 sshd_config
  13. -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 :

  1. ~ $ 
  2. ~ $ /usr/local/bin/sshd
  3. ~ $ 
  4. ~ $ ps | grep ssh
  5.   893 root     /usr/local/bin/sshd 
  6. ~ $ 
  7. ~ $ 

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 like this after booting the linux:

  1. rtc-rx8025sa 0-0032: setting system clock to 2022-02-27 19:37:04 UTC (1645990624)
  2. yaffs: dev is 32505862 name is "mtdblock6"
  3. yaffs: passed flags ""
  4. yaffs: Attempting MTD mount on 31.6, "mtdblock6"
  5. yaffs_read_super: isCheckpointed 0
  6. VFS: Mounted root (yaffs2 filesystem).
  7. Freeing init memory: 120K
  8. running /etc/init.d/rcS
  9. starting udevd...
  10. cannot open /dev/null
  11. eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
  12. eeprom initial complete
  13. /opt/apache/bin/apachectl start: httpd (pid 864) already running
  14. running /etc/profile
  15. route: SIOC[ADD|DEL]RT: Network is unreachable
  16. eth0: link down
  17. ~ $ eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
  18. ~ $ 
  19. ~ $ 

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.

  1. piyush@piyush-System-Product-Name:~$ sudo ssh root@192.168.18.32
  2. root@192.168.18.32's password: 
  3. Permission denied, please try again.
  4. root@192.168.18.32's password: 
  5. Permission denied, please try again.
  6. root@192.168.18.32's password: 
  7. Permission denied (publickey,password,keyboard-interactive).
  8. piyush@piyush-System-Product-Name:~$ 

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

  1. ~ $ passwd root
  2. /etc/passwd: /etc/passwd: 1: root::0:0:root:/:/bin/sh: not found
  3. /etc/passwd: /etc/passwd: 2: bin:*:1:1:bin:/bin:: not found
  4. /etc/passwd: /etc/passwd: 3: daemon:*:2:2:daemon:/sbin:: not found
  5. /etc/passwd: /etc/passwd: 4: nobody:*:99:99:Nobody:/:: not found
  6. /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.

Click Here!