Adding banner when login with ssh.

Introduce yourself to us and other members here, or share your own product reviews, suggestions, and tips and tricks of using QNAP products.
Post Reply
philrich123
First post
Posts: 1
Joined: Fri Jan 05, 2018 6:10 pm

Adding banner when login with ssh.

Post by philrich123 » Wed May 06, 2020 7:33 pm

Hello,

The classical way to tell the sshd to add a banner when you login doesn't work with the stock qnap sshd.
The file /etc/ssh/sshd_config exists but qnap does nothing with it.
There is an other file that qnap use (/etc/config/ssh/sshd_config) but no chance to do something with it because qnap overwrites it at each start.
After some investigations, the best way for me to add a banner was to modify the file /etc/init.d/login.sh.

So lets say that your banner is the file /etc/issue. Edit the file /etc/init.d/login.sh and go to the function update_sshd_config(), and before the closing bracket of the function add a command to modify the config file.
Now the end of the function should looks like:

Code: Select all

	echo "banner /etc/issue" >>${SSHD_CONF}
}
This work with QTS4.3.3

BUT, each time you update your firmware you'll have to do it again!

Hope this could help others !

Post Reply

Return to “Users' Corner”