Re: Is user active or not ?

David Guntner <davidg-1boXBf7wef/[email protected]> Thu, 22 Sep 2011 09:25:48 -0700
Newsgroups gmane.linux.mandrake.expert
Organization What a concept! :-)
Message-ID <[email protected]>
Renaud (Ron) Olgiati grabbed a keyboard and wrote:
> 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 user@othermachine

would tell you if they're logged in or not, and if not, when they last did.

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

ssh youruser@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
signature.asc (application/pgp-signature, 260 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk57YYwACgkQvC3peSYrMN5dnwCgniP8le11ATuqrK3QTFnWX08x
uWAAnRELlDxpHV3RpxHl49lNMOPJLqnJ
=2hJP
-----END PGP SIGNATURE-----