Is it possible to make this work by using this method
I thought maybe I could add the login.sh script in /opt/etc/init.d/S01openssh or something and have it autorun from there.
Would this work?
Yes, you can follow the instructions in the QNAPedia article: 2.1 Running /opt/etc/init.d/* on startup
to run your "login.sh" script. Hiding this article title
behind the words: "this method
", rather than under the article's actual title
of "Running /opt/etc/init.d/* on startup
" , might have slowed down replies to your question.
I personally believe that "replacing" QNAP's "broken
" SSHd deamon is a major mistake
however. Optware doesn't always load properly, (especially after a Firmware upgrade), so doing so can fail under certain circumstances. This can effectively leave you "locked out
" of your NAS from an SSH perspective.
You might be better off to support QNAP's broken "SSHd" (but put it on a different port), and then simply install OpenSSH on "Port 22/TCP". However even this isn't a perfect solution, as OpenSSH allows non-Admin users to login as well, which has the potential to completely compromise the security of your NAS. There are many strategies to "working around" QNAP's imcompetence at providing a properly working SSHd, but some of the solutions, (especially using OpenSSH instead), have security concerns that need to be addressed.
If you believe that you can deal with the security issues of using OpenSSH instead of the firmware provided SSDd daemon, you might want to review my previous post: Installing OpenSSH as default SSHd Server (but keeping QNAP's SSHD version active as well)
Please read the entire thread, and not just my message, as there are some pretty serious security concerns that you need to be aware of, and some of these concerns are identified in some of the replies to my recommended solution.
I have used my solutions on both ARM-based, and Intel-based QNAP NAS devices successfully. It provides a good solution for knowlegable members, but is NOT
recommended for newbies, because of the needed security issues that need to be addressed if you decide to adopt it. If you have any questions about my Installing OpenSSH as default SSHd Server (but keeping QNAP's SSHD version active as well)
article, please post replies to that
thread, rather than this one, so that I can answer any questions about it that you might have.
I take no responsibility
for the security of your
NAS, so please ensure that you completely understand the advantages
and the pitfalls
of my solution. If this is above your skill set, please do NOT attempt to implement it on your equipment.