LinuxQuestions.org
Review your favorite Linux distribution.
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-30-2010, 03:09 PM   #1
epsx
LQ Newbie
 
Registered: Mar 2010
Posts: 6

Rep: Reputation: 0
Post bash scripting auth check for pop3


I need to make a bash scripting, based on a password and a user, that connect to pop3 server and see if it login,if you can,return ok, otherwise return ERR .

if someone can help me i will appreciate it... thx.
 
Old 03-30-2010, 03:26 PM   #2
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Generally we don't write scripts outright for people, but we'll be happy to help you with your script. I would suggest that perl (or language of your choice) or expect are better suited to this task than bash overall.

Also keep in mind pop3/imap are insecure protocols... you really should be using imaps or pop3s instead.
 
Old 04-02-2010, 07:02 AM   #3
epsx
LQ Newbie
 
Registered: Mar 2010
Posts: 6

Original Poster
Rep: Reputation: 0
I know they are insecure, but i need only for checking pop3 connection (telnet localhost 110 , then echo username - echo pass), if will give me -ERR or +OK, and send me email if pop3 give -ERR or +OK... theat's all.
I am new in the world of linux, and i like it verry much to work on it :P. 3Mouth
The scrept i want to be in bash, it is simply.

THX.

(SRY FOR THE DELAY)
 
Old 04-02-2010, 09:07 AM   #4
epsx
LQ Newbie
 
Registered: Mar 2010
Posts: 6

Original Poster
Rep: Reputation: 0
how far i worked at it ...
(sleep 3;
echo user email account ex: linux@questions.org;
sleep 3;
echo pass email password;
sleep 3;
echo "quit") | telnet hostname 110
 
Old 04-02-2010, 09:47 AM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by epsx View Post
how far i worked at it ...
(sleep 3;
echo user email account ex: linux@questions.org;
sleep 3;
echo pass email password;
sleep 3;
echo "quit") | telnet hostname 110
Does it work? If not, what are the symptoms?
 
Old 04-02-2010, 10:00 AM   #6
epsx
LQ Newbie
 
Registered: Mar 2010
Posts: 6

Original Poster
Rep: Reputation: 0
It working but now i have to find a way how to send mail.
When he give -ERR (he can't connect) send me email, when can connect to give me email with +OK.
 
Old 04-02-2010, 10:14 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by epsx View Post
It working but now i have to find a way how to send mail.
When he give -ERR (he can't connect) send me email, when can connect to give me email with +OK.
If you can send mail from the command line then you can use something similar in the script.

Have a look at the command line mail clients "mail" and "mailx".

Presuming you want to send mail via a remote mail server you will also need a local mail server to send the locally-created mail to the remote server. This will probably be an SMTP mail server like sendmail or postfix -- or hopefully someone will suggest a simple one!

Last edited by catkin; 04-02-2010 at 10:14 AM. Reason: Missing "
 
Old 04-02-2010, 10:29 AM   #8
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Better than mail would be mutt or pine also... they're fairly full featured.
 
Old 04-06-2010, 05:53 AM   #9
epsx
LQ Newbie
 
Registered: Mar 2010
Posts: 6

Original Poster
Rep: Reputation: 0
For now it done , i add a cronjob. It ok for now, THX for the info and help :P.

(sleep 3;
echo user email account ex: linux@questions.org;
sleep 3;
echo pass email password;
sleep 3;
echo "STAT"
sleep 3;
echo "quit") | telnet hostname 110

Last edited by epsx; 04-06-2010 at 05:54 AM.
 
Old 04-06-2010, 06:19 AM   #10
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by epsx View Post
For now it done , i add a cronjob. It ok for now, THX for the info and help :P.

(sleep 3;
echo user email account ex: linux@questions.org;
sleep 3;
echo pass email password;
sleep 3;
echo "STAT"
sleep 3;
echo "quit") | telnet hostname 110
Does that do what you wanted -- "When he give -ERR (he can't connect) send me email,"? It looks like it sends some strings to port 110 on hostname; it doesn't look like it does anything if the telnet session doesn't connect.
 
Old 04-06-2010, 07:16 AM   #11
epsx
LQ Newbie
 
Registered: Mar 2010
Posts: 6

Original Poster
Rep: Reputation: 0
yes, but i put in cronjob to give me at 10 hours email. I know it not a right way... he give all the information.
now i work on samba, i will focus later on it :P.
i will try with mailx, to send me email if he can "read -u 3;".
 
  


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
BASH scripting: check for numeric values linuxLuser Programming 11 11-14-2011 10:11 AM
Pop3 Auth Gssapi mjsabby Programming 1 09-29-2005 03:15 PM
Bash scripting to check text in a website carlp Programming 2 09-20-2005 11:14 AM
Imap - Pop3 Auth with user@domain instead username using virtusertable gakullak Linux - General 1 09-04-2004 04:34 PM
POP3 auth through LDAP and Mysql rajesh_r_r Linux - General 0 06-23-2004 09:15 AM

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

All times are GMT -5. The time now is 04:21 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