No Expert wrote:
I wan to disable password access for both the default and OpenSSH servers so that only key authentication is active.
For OpenSSH I know that I can make the change in the sshd_config file:
Does anyone know how to do the same for the default ("Qnap") SSHd server?
There is no official
way of doing it, but it can be done. To do it, you simply have to implement changes within the "autorun.sh
" file on your NAS, per QNAPedia article: Running Your Own Application at Startup
so that it modifies the settings at every boot.
The following code might do it for you:
Code: Select all
echo -n "Shutting down sshd services:"
/sbin/daemon_mgr sshd stop /usr/sbin/sshd
rm -f /var/lock/subsys/sshd
/bin/sed -i -e 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
echo "Disabled SSHd Password Authentication in config file: /etc/ssh/sshd_config"
echo -n "Restarting sshd services:"
/sbin/daemon_mgr sshd start /usr/sbin/sshd -f /etc/ssh/sshd_config -p $(/sbin/getcfg LOGIN "SSH Port" -d 22)
I have NOT tested this code, so please enable your TELNET access temporarily to ensure you don't lock yourself out while attempting to get this working. Once you are satisfied that it is working you can re-disable TELNET again.