LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-08-2009, 08:39 PM   #1
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 862

Rep: Reputation: 91
use ssh to check and read mail on host?


Hi, all. I'm trying to check and read email on the host using ssh, fetchmail and Alpine. Here's the line I'm using:

ssh user@host gmm

where "gmm" is a script on the host that looks like this:

#!/bin/bash
trap 'exit $USER_INTERRUPT' TERM INT
fetchmail -v --sslproto '' someplace.net
case $? in
1) sleep 4; exit 0;;
0) clamscan /var/spool/mail/user;
case $? in
1) echo "Virus found in mail"; exit 0;;
0) alpine -i;;
esac
esac

Everything works fine on the host. I can shell into host and run the "gmm" script and it fetches my email and opens alpine to the inbox. But if I don't log on to host and just run "ssh user@host gmm" and there is new mail it downloads it but won't open alpine. This is the error I get:

Can't access terminal or input is not a terminal. Redirection of
standard input is not allowed. For example "pine < file" doesn't work.

Does this have to do with ssh or the way I have the line written or both? I understand some of the error has to do with alpine opening the mail file and I could just copy it to the client, but I don't want to have to copy the mail file to the client machine every time because having the same email account content on two machines can be confusing.
Thanks.
 
Old 03-08-2009, 09:07 PM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
try ssh -t user@host gmm

Code:
   -t      Force pseudo-tty allocation.  This can be used to execute arbitrary screen-based
             programs on a remote machine, which can be very useful, e.g. when implementing menu
             services.  Multiple -t options force tty allocation, even if ssh has no local tty.
 
Old 03-08-2009, 09:28 PM   #3
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 862

Original Poster
Rep: Reputation: 91
Quote:
Originally Posted by AlucardZero View Post
try ssh -t user@host gmm
Thanks, that works like a charm.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
E-Mail Read Receipt E-Mail Delivery Status E-Mail tracking number. ytd Linux - Software 3 02-14-2009 04:02 AM
sendmail mail loops back but with a weird mail.barnhallrfc.com MX host masionas Linux - Server 2 12-09-2008 07:10 AM
Can I read PGP/GPG mail in my maildir from a SSH shell? 3rods Linux - Software 1 04-10-2008 10:37 AM
ssh + pop3 with kmail: Could not connect to host localhost, but ok without ssh Emmanuel_uk Linux - Networking 0 07-20-2006 04:56 PM
How to setup a host.deny and host.allow for SSH? explorer1979 Linux - Security 2 01-31-2005 05:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 11:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration