This method of
openssh-server installation uses the
chroot command to gain access to the files in the compact flash (CF). Once the chroot command is issued, the running Ubuntu treats the CF's
/ as its own. Commands run in a
chroot environment will affect the CF system's filesystems and not those of the running Ubuntu.
Step 1: Preliminary
Boot to the Ubuntu desktop in your computer. The running desktop version of Ubuntu should be 64bit (not 32bit) if the CF system is 64 bit, and vice versa. If one is 64bit and the other 32bit, then boot a Live USB (Try Ubuntu without installing) that matches the headless system intalled in the CF.
Insert the CF drive in the CF card reader in the desktop computer. Unmount any partitions that are automatically mounted. We will mount them soon using different mount-points.
Open a terminal using Ctrl+Alt+T.
Determine the normal system partition in the CF drive. The following commands may be helpful. The fdisk switch is a lowercase "L".
sudo fdisk -l
Step 2: Mount CF drive's Partitions and
Mount your normal system partition. X is the drive letter. Y is the partition number: Substitute the correct partition: sda1, sdb5, etc.
sudo mount /dev/sdXY /mnt
Only if you have a separate boot partition (where sdXY is the /boot partition designation):
sudo mount /dev/sdXY /mnt/boot
Mount the critical virtual filesystems. Run the following as a single command:
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
Chroot into your normal system device:
sudo chroot /mnt
At this point the
/ system partition is remapped to the CF drive. Anything installed or any changes to system configuration files will be made to the CF drive.
Step 3: Install & Configure
ssh server is installed. If you want to make some changes to the
ssh server configuration, now is the time. However, be very careful as you may not be able to test the
ssh server in this
chroot environment. As a result, once the CF is in the embeded system,
ssh may not work. The configuration file is located in
/etc/ssh/sshd_config. The default config is reasonably secure. It does not allow the user
root to login with password. If you plan to
root then you have to either enable password based login for
root or use private-public key pair based login. See How to set up passwordless SSH access for root user for more.
- Exit chroot: CTRL-D on keyboard
I have not tested this method. If this does not work or there is any problem with the steps, let me know in a comment. I will try to fix the answer.
This answer is inspired by the method to install
Hope this helps