CoreElec sshd_config


I can see that the file sshd_config file is unwritable, how do I change ssh-port and setup ssh-keys on CoreElec?

I got the following message on opening the sshd_config file: [ File ‘/etc/ssh/sshd_config’ is unwritable ]

If You want to use ssk keys You have to create the folder /storage/.ssh
mkdir -p /storage/.ssh
chmod 600 /storage/.ssh
Put Your keys into the .ssh folder

/etc is write only, may be the devs can told You how to change ssh port

It’s not actually possible to change the port number because of the squashfs nature of the OS.

You could use iptables though and redirect the port or build your own image with the port number changed.

I’ve just successfully changed my ssh port by editing .cache/services/sshd.conf

change the line:-



SSH_ARGS="-p 1234"

using whatever port number you want then restart the service

systemctl restart sshd


Wasn’t aware it could be done like that, thanks. :+1:

After testing the change survives a reboot but not an update.

The change seems to survive the first reboot but not the second… Which is strange.

Once you update CoreELEC sshd.conf is overwritten :frowning:

I’ve been informed by Ray that another option is to override the systemd job, that would survive an update/reboot.

Thanks, the ssh job i guess? and what to set the port?

cp /usr/lib/systemd/system/sshd.service /storage/.config/system.d

change ExecStart line in /storage/.config/system.d/sshd.service

ExecStart=/usr/sbin/sshd -D $SSH_ARGS -p 2200
1 Like