Install ssh server on embedded device
You need to cross compile OpenSSH for your embedded device,Follow below steps
- Download OpenSSH from
http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.6p1.tar.gz extract it and cross-compile it using toolchain
./configure --host="board architecture"
make
Copy sshd from compiled source and download it in your embedded
device and run it/path/sshd
Try to connect with your embedded device
Adding ssh on embedded linux
Your device has an ARM processor. Your PC has an x86 processor. ARM and x86 are different processor architectures with different instruction sets. An executable program compiled for x86 consists of x86 instructions that an ARM processor cannot execute, and vice versa.
You need an ARM binary. Furthermore, you need an ARM binary that's compatible with the other software you have on your device. Specifically, you need either a statically linked binary (a binary that does not depend on anything else) or a binary linked with the right system libraries.
Check which standard library you have. If you have a file called /lib/ld-uClibc.so
, you have uClibc, a small library intended for embedded systems. If you have a file called /lib/ld-linux.so.2
, you have GNU libc, the same library that you have on your Ubuntu PC (and any other non-embedded Linux).
You have two choices of SSH clients and servers: OpenSSH and Dropbear. Dropbear is smaller, but has fewer features, in particular no SFTP.
If the standard library is Glibc, you can grab a binary from Debian's ARM distribution. Get the armel
client or server package. Extract the .deb
file by running
dpkg-deb -x openssh-….deb .
Then copy the binary from ./usr/bin
or ./usr/sbin
to the device.
If the standard library is uClibc, you'll need to grab a binary from a distribution based on uClibc. Dropbear is included in many embedded distribution. Openmoko, which shares some ancestry with Qtopia, includes Dropbear in its default installation. If you're going to want to install several programs, BuildRoot makes it very easy to obtain a cross-compiler and build common programs: you pretty much only need to follow the guide.
Manually get ssh access back on a embedded system (direct hdd access possible)
You can generate a new set of host keys on a handy Linux system as follows:
ssh-keygen -t rsa -b 2048 -f ssh_host_rsa_key
ssh-keygen -t dsa -b 1024 -f ssh_host_dsa_key
When ssh-keygen
asks you for a passphrase, hit Enter
without typing anything. Host keys must have an empty passphrase.
This creates the following files in your current directory:
ssh_host_rsa_key
ssh_host_rsa_key.pub
ssh_host_dsa_key
ssh_host_dsa_key.pub
You can then mount your device's hard drive and copy these four files into etc/ssh
.
Note that when you try to ssh to the system afterwards, your ssh client will complain that the keys are different than expected, and probably refuse to connect. If you're running the OpenSSH client, you can correct this by using ssh-keygen
again:
ssh-keygen -R <your_server_hostname>
How to install SSH host-key using Yocto
You can have a recipe that installs the key at the correct location. This key will be generated by you beforehand and "put" into an externalsrc
recipe (inherit externalsrc
and set EXTERNALSRC
appropriately which can point to any path on the host system). The recipe lives in the version control environment you use but the key stays outside of it. Then you just add the resulting package to your image.
Remote connection to embedded device in field
I think that using OpenVPN would be a easy way to tunnel to the device. You can cross compile it and set it up as a client on the embedded device. Then you install it on your Linux box and set it up as a server.
Finally you install it on your work PC and set up as a client there.
It gives you a virtual network where all clients can talk to each other like they would be on a local network.
Related Topics
How to Highlight The Differences Between Subsequent Lines in a File
Mono and Unmanaged Code in Ubuntu
"Nothing to Commit (Working Directory Clean)" When a Folder Has Been Added
Touch Command Create Multiple Files (Different Names) Under One Directory
Copying Files with Wildcard (*) to a Folder in a Bash Script - Why Isn't It Working
How to Get CPU Serial Under Linux Without Root Permissions
How Many Objects Are Returned by Aws S3API List-Objects
Expect Utility Is Not Working When Executing from Jenkins
Inotify Fd - Why Is The Limit Per User Id and Not Per Process
Automated Installation of R-Studio Using Shell Script
Extract Parent Domain Name from a List of Url Through Bash Shellscripting
How to Prevent Remote Branch Deletion in Git Without Using Gitolite
Shared Libraries (Dlopen) and Thread-Safety of Library Static Pointers
Raw Socket Access as Normal User on Linux 2.4
What Is a Shell Command to Find The Longest Common Substring of Two Strings in Unix