1

I have a VPS, which one can use noVNC to login. I would like to restrict login through ssh only.

  1. Can I remove the portion where it is showing the login prompt? (Preferred to mod this, instead of using systemd to mask tty)
hostname login:

enter image description here

  • Related, if not a dupe: https://unix.stackexchange.com/questions/598870/how-do-i-disable-all-login-prompts-including-on-vt-1-on-a-systemd-system – Kusalananda Nov 15 '20 at 16:12
  • Thanks. I updated it to reflect I would like to mod this output instead of masking it. – lovsunshine Nov 15 '20 at 16:20
  • So, do you want to disable it, or change the message only? – Stephen Kitt Nov 15 '20 at 16:42
  • I know I can mask the tty. However, I am trying to modify what's being displayed, i.e. not to display that "HOSTNAME login" prompt. – lovsunshine Nov 15 '20 at 18:23
  • I’m voting to close this question because it unclear whether login should be disabled, or whether the prompt text should be changed. Comments says "modify prompt" and "don't display prompt", question says "mod prompt" and "disable login". – Kusalananda Oct 26 '22 at 05:34

1 Answers1

0

If I understand the post you are only asking to change the login prompt over SSH.
sshd

sshd has its own option "?PrintMotd" in /etc/ssh/sshd_config. This defaults to "yes", but is set to "no" in Debian's default configuration since you get the motd twice otherwise: Once printed by pam_motd, the second time by sshd itself. Please note that the motd doesn't show on multiplexed ssh connections, only on the "first" session that also does the authentication. [1]: https://wiki.debian.org/motd#A.2Fetc.2Fmotd_in_current_versions_.288.2B-.29_of_Debian

Or

/etc/issue

The text displayed before the login prompt is stored in /etc/issue (there's a related file, /etc/issue.net, that's displayed before the user logs in, before their shell is started). It's just a normal text file, but it accepts TTY escape sequences:

The issue file can contain certain character sequences to display various information. All issue sequences consist of a backslash () immediately followed by one of the letters explained below (so \d in /etc/issue would insert the current date).

\b -- Baudrate of the current line.
\d -- Current date.
\s -- System name, the name of the operating system.
\l -- Name of the current tty line.
\m -- Architecture identifier of the machine, eg. i486
\n -- Nodename of the machine, also known as the hostname.
\o -- Domainname of the machine.
\r -- Release number of the OS, eg. 1.1.9.
\t -- Current time.
\u -- Number of current users logged in.
\U -- The string "1 user" or " users" where is the number of current users logged in.
\v -- Version of the OS, eg. the build-date etc.
Off Grid
  • 1
  • 1
  • 3
  • 1
    I think /etc/motd is for displaying messages to the user after user logs in. I am trying to modify the login prompt screen. – lovsunshine Nov 15 '20 at 18:25
  • Could be possible what you are looking for is located within the `/etc/ssh/sshd_config` file. look for a setting referring to BANNER or WELCOME `#` add a `#comment` to that section of the `/etc/ssh/sshd_config`. If you still want a message printed to the console on login, you can fall back to a static MOTD. Examine the contents of `/etc/update-motd.d` for more flies. – Off Grid Nov 15 '20 at 22:36
  • I am looking to modify the behavior of tty before logging in. – lovsunshine Nov 15 '20 at 23:58
  • `/etc/issue` as the last place [Stack Exchange/etc/issue](https://unix.stackexchange.com/questions/16255/how-can-i-change-whats-displayed-at-a-login-shell) – Off Grid Nov 16 '20 at 01:11
  • my `/etc/issue` has no **character sequences** regarding the login prompt. – lovsunshine Nov 21 '20 at 15:49
  • All of the files used `/etc/ssh/sshd_config` in connection with `/etc/issue`. finally [mingetty - minimal getty for consoles](https://manpages.debian.org/testing/mingetty/mingetty.8.en.html) – Off Grid Nov 23 '20 at 16:47