Ubuntu: How to setup listening port of dropbear under initramfs-tools



Question:

This is in reference to: Ubuntu will not boot into busybox for remote LUKS decryption using dropbear

I have really like this solution by BinaryShrub.

One question: what is the right way to set the listening port of dropbear in this setup?

Thank you!


Solution:1

I've managed to find a solution (nothing helped me on internet...), I've tried many things as change port in /etc/default/dropbear or etc/init.d/dropbear without any effect...

So, after searching how initramfs works and how dropbear is launched at boot, here is the solution:

$ cd /usr/share/initramfs-tools/scripts/init-premount  $ nano dropbear  

then go to the function run_dropbear(), you should find a line with something like this:

exec /sbin/dropbear ${DROPBEAR_OPTIONS:-$PKGOPTION_dropbear_OPTION} -Fs  

Just add the following option at the end of line:

exec /sbin/dropbear ${DROPBEAR_OPTIONS:-$PKGOPTION_dropbear_OPTION} -Fs -p #### (where #### is your port number)  

Don't forget to run update-initramfs -u after this modification. Reboot. Your SSH at boot time should now be on the chosen port.

Cheers


Solution:2

You can specify the options to dropbear in your /etc/initramfs-tools/initramfs.conf

DROPBEAR_OPTIONS="-p 2222"

And then rebuild the initramfs: update-initramfs -u


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »