I recommend reading the man page of agetty(8). I have never tried this, but this should work: Enable the service again, copy the service file to /etc/systemd/system
, and modify it to start /usr/sbin/nologin
instead of /bin/login
...
Exempt from the manpage:
-l, --login-program login_program
Invoke the specified login_program instead of /bin/login.
This allows the use of a non-standard login program. Such a
program could, for example, ask for a dial-up password or use
a different password file. See --login-options.
This way, the file /etc/issues is read and displayed, but a direct login on the terminal is not possible. You might want to change the line Restart=always
to Restart=never
, to prevent a restart loop, but after that, you should be good to go.
But keep in mind, that no matter how you disable the getty service - if you ever loose network connectivity on your server (for example due to a configuration mistake), you'll have to boot a rescue disc in order to recover your server... It might not be a good idea to disable the getty service!