# Motd and ssh last login



## charles-martel (Sep 26, 2011)

Hi,

Sorry for my english.

How to display last login message (ssh) after motd ?

Thanks.


----------



## da1 (Sep 26, 2011)

The fortune or the last login via ssh (last) ?


----------



## charles-martel (Sep 26, 2011)

Last login with ssh.


----------



## da1 (Sep 26, 2011)

Try:
[cmd=""]last[/cmd]


----------



## charles-martel (Sep 26, 2011)

Actually I have this:


```
Last login: Mon Sep 26 17:31:20 2011 from e4600.home

FreeBSD 8.2-RELEASE (GENERIC) #0: Fri Feb 18 02:24:46 UTC 2011

etc ...
```

I want line: Last login, ect ..., appear after motd (FreeBSD 8.2-RELEASE etc ...).


----------



## no (Sep 27, 2011)

I think, you need check your config 
/etc/ssh/sshd_config
and set 

```
PrintLastLog yes
```

and kill -HUP sshd-process' id.


----------



## charles-martel (Sep 27, 2011)

I already do this, it's work but the last login line appear before the motd.
I have debian to and the last login line appear after motd.

debian :


```
Linux biche.home 2.6.18-028stab092.1 #1 SMP Wed Jul 20 19:47:12 MSD 2011 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Sep 26 23:28:34 2011 from e4600.home
```

FreeBSD:


```
Last login: Mon Sep 26 17:31:20 2011 from e4600.home

FreeBSD 8.2-RELEASE (GENERIC) #0: Fri Feb 18 02:24:46 UTC 2011

etc ...
```

I want same as debian.


----------



## aragon (Sep 27, 2011)

You will need to modify the source of login(1) for that.  Or you can create ~/.hushlogin to suppress all its messages, and then implement what you want in your shell's startup file instead.


----------



## charles-martel (Sep 27, 2011)

How modify login, with login.conf?


----------



## SouthPawn (Oct 4, 2011)

Try disabling PrintMotd in the sshd_config, and then having it be displayed via pam.


```
session   optional   pam_motd.so
```

Kind regards,
-Craig


----------



## charles-martel (Oct 5, 2011)

When I add this line 
	
	



```
session optional pam_motd.so
```
 to sshd pam file I can't login.


----------



## charles-martel (Oct 5, 2011)

pam_motd does not exist on FreeBSD.


----------

