# Show uptime on shell login



## enCyde (Jul 25, 2011)

Hi all.


There is something I'm trying to do on my server and that is to show the server uptime when a user logins to his shell account. 

I've searched the web for it and I have come this far.

I've edit /etc/csh.login

and putted (uptime) at the bottom of it. And yes it works on root login, but it ain't working on a normal user login. I heard I need to modify the /usr/share/skel/ but I don't really understand how I am going to modify it.

greetings


----------



## SirDice (Jul 25, 2011)

It depends which shell the user uses. /etc/csh.login is for (t)csh users only. Bash or other shell users do not use it. Set it in /etc/profile, most bourne shell related shells read that one.


----------



## fonz (Jul 25, 2011)

SirDice said:
			
		

> It depends which shell the user uses.


@OP: If that's not good enough and you want to be absolutely sure that every user sees uptime regardless of which shell they use (which could theoretically even be a custom shell that reads neither /etc/profile nor /etc/csh.login) a roundabout solution might be to set the _shell_ resource in /etc/login.conf to a shell script that does uptime and then execs to the user's actuall login shell, which is in the _SHELL_ environment variable.

Fonz


----------



## mix_room (Jul 26, 2011)

Perhaps this link may help you

http://parkersamp.com/2010/10/howto-creating-a-dynamic-motd-in-linux/


----------



## enCyde (Jul 26, 2011)

SirDice said:
			
		

> It depends which shell the user uses. /etc/csh.login is for (t)csh users only. Bash or other shell users do not use it. Set it in /etc/profile, most bourne shell related shells read that one.




Thank you, that is what I was looking for.

And thanks to the rest for the replies.

cheers


----------

