# How to setup listening port of dropbear under initramfs-tools

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!

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

• That is much better then your first "answer". 10 points extra! – Fabby Oct 21 '16 at 22:40
• Used in this howto, thanks. – ceremcem Sep 21 '18 at 23:04

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