# FreeBSD SSH install with no screen?



## majamin (Jan 8, 2021)

I'm trying to repurpose an old laptop that has a malfunctioning screen to a backup server. I can connect the laptop to an external display, but, I'd rather not! My laptop will boot from a USB stick if one is plugged in. I was hoping that there would be a way to modify the FreeBSD live ISO so that sshd is enabled automatically so that I could install FreeBSD remotely. Perhaps FreeBSD already allows this, and I'm not aware? Thanks,

majamin


----------



## tux2bsd (Jan 9, 2021)

Something like what you want can probably be done but I'd say you're gonna save yourself a whole lot of time by plugging in a monitor.


----------



## ccammack (Jan 9, 2021)

majamin said:


> I'm trying to repurpose an old laptop that has a malfunctioning screen to a backup server. I can connect the laptop to an external display, but, I'd rather not! My laptop will boot from a USB stick if one is plugged in. I was hoping that there would be a way to modify the FreeBSD live ISO so that sshd is enabled automatically so that I could install FreeBSD remotely. Perhaps FreeBSD already allows this, and I'm not aware? Thanks,
> 
> majamin


It's certainly possible to modify an 11.1 image to do this but I haven't tried with anything newer yet. Here are the required changes to the installer image:


```
root@:~ # cd /mnt/etc
root@:/mnt/etc # rm rc.local
root@:/mnt/etc # sed -e 's/ro/rw/' -i "" fstab
root@:/mnt/etc # echo ifconfig_DEFAULT=\"inet 192.168.0.254/24\" >> rc.conf
root@:/mnt/etc # echo sshd_enable=\"YES\" >> rc.conf
root@:/mnt/etc # cd ssh
root@:/mnt/etc/ssh # echo "UseDNS no" >> sshd_config
root@:/mnt/etc/ssh # echo "UsePAM no" >> sshd_config
root@:/mnt/etc/ssh # echo "PasswordAuthentication yes" >> sshd_config
root@:/mnt/etc/ssh # echo "PermitEmptyPasswords yes" >> sshd_config
root@:/mnt/etc/ssh # echo "PermitRootLogin yes" >> sshd_config
root@:/mnt/etc/ssh # cd
root@:~ # umount /mnt
root@:~ # shutdown -p now
```


----------



## JohnnySorocil (Jan 9, 2021)

Use temporary USB to install memstick image. Then edit that image to have fixed IP address (or set up your DHCP server) and configure ssh connection (my recommendation is to use ssh keys, but not mandatory for temporary install).
Then boot from that USB stick on machine without monitor, ssh to it and install OS (bsdinstall or extract tar archivers or make installword).

I usually boot from SD/USB card or connect destination drive as USB and then manually do partitioning and OS install. My last adventure was on arm64 board on Linux with OpenZFS: create ZFS pool, create partitions, extract tars (base and kernel) into it, edit /boot/loader.conf and /etc/rc.conf, install bootloader (copy /boot/loader.efi to EFI partition), set u-boot/GRUB to load that file, reboot. Once logged set up network and ssh, setup beadm, install rsync, rsync /usr/src and /usr/obj from x86 machine, install new customized world and kernel, reboot. All without monitor but with UART console (you even can skip that if you are sure that machine will boot).
Still works


----------



## chrbr (Jan 9, 2021)

majamin said:


> I was hoping that there would be a way to modify the FreeBSD live ISO so that sshd is enabled automatically so that I could install FreeBSD remotely.


Would it be an option to attach the USB stick to a computer with a working display and do the installation there? Then you can tweak the configuration and finally attach the stick to the target laptop. It is just an idea, may be I overlooked something.


----------



## T-Daemon (Jan 9, 2021)

Neubert said:


> root@:/mnt/etc # echo sshd_enable=\"YES\" >> rc.conf


On the 12.2-RELEASE installation image (probably neither on -STABLE, or CURRENT)  this doesn't work, the _sshd_ daemon won't start. I don't know if there is a better way, but setting `service sshd start` in /etc/rc.local will start the daemon (or `service sshd onestart`, without setting `sshd_enable="YES"` in /etc/rc.conf).


----------



## kpedersen (Jan 9, 2021)

Perhaps you can install in a VM (or another machine) and then just dd the disk image to the laptop disk?

Kinda like a Raspberry Pi-type of install.


----------



## tingo (Jan 9, 2021)

OP: this is one of the things you can do with mfsBSD.


----------



## jdakhayman (Jan 22, 2021)

If you have serial ports avaiable, setup the image to enable it at boot. If connecting on a *nix system use cu, if Windows, putty is a good choice.

The handbook also has good information on how to do this as well.

Edit your /boot/loader.conf and add:


```
# Setup serial console.
boot_multicons="YES"
boot_serial="YES"
comconsole_speed="115200"
console="comconsole"
```

Devices such as these can help in the port department:

USB to RS-232 serial port.

Null modem cable.

Just another possiblity.

jda


----------

