By default, the SSH server is running on Haiku.
However you can't have access to it unless you do a little bit of manual configuration.
In this article, we will review two methods on how to connect to your Haiku machine via the SSH server.
First, let's review if the SSH server is running in the Network preferences application :
Yes it's the case on the 192.168.1.13 local IP address :)
The standard way of connecting to your SSH server on Haiku is to use your password.
To define the "root" password under Haiku, type :
passwd
Then confirm your password.
Now edit the "sshd_config" file :
lpe /boot/system/settings/ssh/sshd_config
Indicate "PermitRootLogin Yes" and save the file
Now stop and start your SSH server :
kill sshd
/bin/sshd
Check it's running with the command :
ps sshd
Now let's connect from another machine :
As you can see it's a sucess!
Now let's facilitate the access to that server.
Instead of using a password, let's use public/private keys.
From your client machine - MacOS, Windows, Linux, etc - create public/private keys with the command :
cd .ssh
ssh-keygen
Type "id_haiku" as the name of the key.
You do not need to specify a passphrase, so type enter.
Once completed, you should see :
Now let's share the public key to the Haiku SSH server :
ssh-copy-id -i ./id_haiku.pub user@192.168.1.13
The public key content has been copied into the "/boot/home/.ssh/authorized_keys" file on the Haiku server as below :
Each time a new key is added, it will add an entry into that file.
Edit the "sshd_config" in order to indicate to use this file :
AuthorizedKeyFile .ssh/authorized_keys
Ok now let's modify the Logging :
SyslogFacility LOCAL0
LogLevel DEBUG
Let's stop/start the server with logging to "ssh_server.log" :
kill sshd
/bin/sshd -D -e >> /boot/home/ssh_server.log 2>&1 &
If you check at the logs, you should see the below :
tail -f /boot/home/ssh_server.log
Ok now let's connect from the client machine again :
ssh user@192.168.1.13
It's fine !
Now your private key on your client machine indicates to the SSH server on Haiku that you are the right person to connect, and you don't have to enter a password anymore :)