# ssh logins and /etc/issue banners



## phospher (Sep 15, 2009)

hi,

i have a custom banner configured sshd_config as follows:



```
Banner /etc/issue
```

this displays the login banner as soon as the user connects via ssh/sftp. does anyone know how i can setup different logon banners for different users? for example, i have a user i want to warn about their account being expired.

thanks


----------



## DutchDaemon (Sep 15, 2009)

I don't know about 'personalised banners' being possible. You could, however, put something in the user shell's rc file (.cshrc, .bashrc, .profile, what have you). This will print right under the motd.


----------



## anomie (Sep 15, 2009)

@phospher: you could also let chpass(1) do the work for you. 


```
$ ssh mrbig@my.host
Password:

[b]Warning: your account expires on Thu Sep 17 00:00:00 2009[/b]

Last login: Sat Sep 12 16:08:20 2009 from dhcp-10-50-111-

Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
	The Regents of the University of California.  All rights reserved.

If you want to play CDs with FreeBSD, a utility for this is already included.
Type 'cdcontrol' then 'help' to learn more.  (You may need to set the CDROM
environment variable in order to make cdcontrol want to start.)
>
```

It seems to warn users automatically when they're expired that way. (I am not sure when it starts warning them, exactly, but you could experiment on a test account.)


----------



## phospher (Sep 15, 2009)

that works great for ssh but doesn't display for sftp. probably because it's not considered an interactive login session.


----------



## Alt (Sep 15, 2009)

You can do Banner in conjunction with Match command in sshd_config. I not tested by i think its must work


----------



## phospher (Sep 15, 2009)

thanks Alt that worked! Between Match and the chpass I'm all set now.


----------

