automate ssh login

Walter Dnes waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org
Fri Jan 23 02:46:10 UTC 2004


On Thu, Jan 22, 2004 at 08:44:31AM -0800, James wrote

> > What does the script actually do?  Does it remotely execute a
> > program?  Does it copy files?
> 
> it logs in a remote machine and runs a command. this script run by 'lp'.

  I have a remote inbox at clss.net because they allow me to blacklist
and whitelist based on DNSbls, envelope-sender, rDNS (or total lack
thereof, as the case may be), CIDR, etc, etc and I control my own
configuration.  I POP email from home with mutt using the following
script...

#!/bin/bash -i
/usr/bin/ssh -P -f -L 10110:pop3.clss.net:110 my_userID-1sV0mdQTbhc at public.gmane.org sleep 25
/usr/bin/mutt -F /home/waltdnes/.symmutt/clssmuttrc

  The line with "sleep 25" is a necessary dummy command.  It keeps the
connection open for the first 25 seconds whilst mutt negotiates with the
remote server.  Note that the connection will stay open much longer than
the initial 25 seconds if necessary.  It shuts down when the last
process using it has let go of the connection.  The only change to
clssmuttrc was to connect to POP server 127.0.0.1 (or localhost) on port
10110.  ssh forwards it to pop3.clss.net:110.  Since the conversation is
tunneled over ssh, there's no problem with sending clear-text
userID/password from Toronto to Logansport, Indiana.

  But what if you want to execute a given command on the remote machine
and log out.  There are a couple of options...
  1) You can put the command and the logout in the user's profile.
  2) You can set the remote command as the user's "shell".  Upon
finishing, the user will be automatically logged out.

-- 
Walter Dnes <waltdnes-SLHPyeZ9y/tg9hUCZPvPmw at public.gmane.org>
Email users are divided into two classes;
1) Those who have effective spam-blocking
2) Those who wish they did
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list