Discussion:
Is user active or not ?
Renaud (Ron) Olgiati
2011-09-22 15:02:14 UTC
Permalink
I find myself in need of an easy way to check whether the account of a remote
user on the lan is active or not.

Is there an easier way than to ssh, then grep $USER /etc/shaddow | grep !

And is there a way to automate the ssh connection in a script ?

TIA,

Ron.
--
Pain is life,
and death is when the pain goes away.
-- Keith Roberts

-- http://www.olgiati-in-paraguay.org --
Stephen Kitchener
2011-09-22 16:21:49 UTC
Permalink
Post by Renaud (Ron) Olgiati
I find myself in need of an easy way to check whether the account of a
remote user on the lan is active or not.
Is there an easier way than to ssh, then grep $USER /etc/shaddow | grep !
And is there a way to automate the ssh connection in a script ?
TIA,
Ron.
the commands "last" and "lastlog" as root, will show what you need I
believe...
--
Regards

Stephen Kitchener

www.imagebysteve.co.uk

Do not meddle with the affairs of Dragons for you are crunchy and good with
mustard

The Difference Between Genius And Stupidity Is That Genius Has It's Limits ~
Albert Einstein
David Guntner
2011-09-22 16:28:58 UTC
Permalink
Post by Stephen Kitchener
Post by Renaud (Ron) Olgiati
I find myself in need of an easy way to check whether the account of a
remote user on the lan is active or not.
Is there an easier way than to ssh, then grep $USER /etc/shaddow | grep !
And is there a way to automate the ssh connection in a script ?
the commands "last" and "lastlog" as root, will show what you need I
believe...
I didn't know about those two; cool beans! I just tried them out on my
machine - didn't need to be root to get a report via either of those.

--Dave
David Guntner
2011-09-22 16:25:48 UTC
Permalink
Post by Renaud (Ron) Olgiati
I find myself in need of an easy way to check whether the account of a remote
user on the lan is active or not.
Is there an easier way than to ssh, then grep $USER /etc/shaddow | grep !
You could install the finger daemon on the remote machine, and then doing a

finger ***@othermachine

would tell you if they're logged in or not, and if not, when they last did.
Post by Renaud (Ron) Olgiati
And is there a way to automate the ssh connection in a script ?
ssh ***@othermachine "command"

Will let you run "command" on the other machine. You'll still have to
enter your password on the other machine, unless you set up a ssh key to
allow you passwordless access to your account (or in your case, the root
account since you're trying to access /etc/shadow) on the other machine
from the machine you're trying to connect from.

--Dave

Loading...