Skip to content
Unix Server Solutions
  • Server
  • Apple
  • Database
  • Ubuntu
  • Linux

Ssh banner per user

loginsshsshd

I want to notify a certain user to call me, the admin, since I disabled his account. I could set /etc/issue.net, but this is shown to all login attempts. Is there a way to restrict a message/banner to a certain user?

Best Answer

Re-enable the user's login, but change the account's shell to a script which outputs the message and exits.

Related Solutions

Windows – How to hide admin account and only show main user at logon screen in Windows

Yes, it seems you can hide the account following guidelines explained at Microsoft Technet forums. However you can't login then unless you set the registry key back.

  1. Go to regedit
  2. Go to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
  3. On the left, right click on Winlogon, click New and click Key.
  4. Type SpecialAccounts and Enter.
  5. On the left, right click on SpecialAccounts, click New and click Key.
  6. Type UserList and Enter.
  7. In the right panel of UserList, right click on a empty area and click New then click DWORD (32bit) Value.
  8. Here, type in the name of the user you want to hide. You may have to experiment with that, I don't know how spaces or changed user names affect this.
  9. Right click on the user account name and click Modify.
  10. To hide the user account type 0 and click OK.

If you want to show it again you have to enter 1 instead of 0 at the last step.

Alternatively, you can see the answers from this post: "Hide account from login screen but can be used in UAC"

Linux – disable SSH last-login and MOTD on a per-user basis

Yes you can, add the Match User directive to your sshd_config file like so:

Match User root 
    PrintlastLog no
    PrintMotd no

The Match directive also works for Group and Address to match for GEOS/Unix group and IP Address retrospectively.

Update:

As a per user basis without access to the sshd_config then you would just create an empty file in $HOME/.hushlogin which would prevent bash in interactive mode to output these alerts. This also works under other systems that use login(1) such as telnet and screen sessions.

Update 2:

To surpress the Banner output from sshd on a per session basis use ssh -q <host>or include LogLevel quiet in your ~/.ssh/config

Related Question
  • Disable SSH login via password on a per-user basis