Red Hat This forum is for the discussion of Red Hat Linux. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
12-03-2009, 03:20 PM
|
#1
|
Member
Registered: Jan 2005
Distribution: MythDora 3.2, RHEL 6.3
Posts: 101
Rep:
|
send email to server to start shell script
I want to be able to send an email to a user on a Redhat 4 box. Depending on the subject of the email, I want to that user to start a specific shell script.
I am thinking I would create a cron to read emails every 5 minutes using mail, if it finds the specific email subject it's looking for it would start the shell script. Is my assumption, using mail, correct? What else might I use?
|
|
|
12-03-2009, 03:47 PM
|
#2
|
Senior Member
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833
Rep: 
|
It would be fairly easy to parse the mail spool in perl or any variety of programs. I think you should build some verification into your program though if it's possible for the scripts to do anything you would NOT want done by a random stranger. Mail isn't tremendously secure.
|
|
|
12-03-2009, 04:30 PM
|
#3
|
Senior Member
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Rep: 
|
Better use "encrypted" text to send a command. Maybe use some password generator, and use several of those to trigger events. You could create a small script on the client end to translate your human readable commands to specific password like trigger.
Also take a look at expect+shh logging and issuing commands, that would be a better way.
|
|
|
12-03-2009, 05:43 PM
|
#4
|
Moderator
Registered: May 2001
Posts: 29,417
|
The generic idea of a "mail to command" gateway is not new. Searching Freshmeat, Sourceforge, Non-gnu or Berlios for implementable SW should yield result(s).
|
|
|
12-03-2009, 07:31 PM
|
#5
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,441
|
It would be simpler to setup ssh auth_keys and then have src machine login to the target and run the cmd.
|
|
|
12-04-2009, 09:06 AM
|
#6
|
Senior Member
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833
Rep: 
|
You are correct it would be easier to setup with key'd ssh, however many phones aren't capable of doing that and email can be sent fairly easily from anywhere.
|
|
|
All times are GMT -5. The time now is 12:02 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|