Tuesday, February 21, 2012

How to avoid sudo password

How to avoid sudo password

When you are logged in as a user other then root and execute a privileged action or action related to privileged resource using "sudo" command, then a "sudo" password is requested .

You face two challenges mainly during this act:

* During a system or configuration setup you can see frequently system is prompting for "sudo" password

* Also you need to execute the command with the full path name.

To overcome this you can login as the "sudo" user and execute the below command.

$ sudo bash

This command will ensure the running shell is supplied with sudo credential, so it won't bother you asking for credential again.

Enjoy Configuring!!!!!!!!

Monday, February 20, 2012

Email Standard.


Email Standard. 

I am trying to put them in writing below.

An Ideal Email ID should have 3 parts in representation, eg. User1@gmail.com

1.       Domain name (gmail.com)
2.       “@” symbol
3.       Valid user in the system (User1)

Always Email ID will be read from back to front, that is the domain name will be read first in the Email ID then everything else.  After Domain name ‘@’ symbol is expected and finally Username will be considered.

When I try to send an email from my machine using telnet session on 25 port, as below.

Date: Fri, 20 Jan 2012 15:23:43 +0530
Subject: subject

Return-Path: <User1@test.com>
Received: from Local.com ([10.30.117.97])
        by mail.local.com (Switch-3.4.3/Switch-3.4.3) with ESMTP id q0K9s3DZ012502
        for <Test-user@example.com>; Fri, 20 Jan 2012 04:54:04 -0500
Received: from Local.com (localhost.localdomain [127.0.0.1])
        by Local.com (8.13.8/8.13.8) with ESMTP id q0K9rhv2004369
        for <Test-user@example.com>; Fri, 20 Jan 2012 15:23:43 +0530
Received: (from root@localhost)
        by Local.com (8.13.8/8.13.8/Submit) id q0K9rhlj004368
        for Test-user@example.com; Fri, 20 Jan 2012 15:23:43 +0530


The above example of email header info is modified to make it simple. When you read this header info which is generally analyzed by the email spam scanner you can find few odd things. Like the email says it’s from User1@example.com and the return path also reflect it, but in the header you can see that email is from root@localhost (in your case it will be logged in user wit ‘@’ and machine FQDN) by Local.com (machine name). Also you see the ‘from’ domain is test.com, but the origin machine or the source IP address is a different domain Local.com.

Here you see two odd stuff one the ‘from’ email address and the other is the Domain.

This above contradiction in email header info is what always suspected as spam.
 .
Many relay system or email servers are restricted relay and only few where open relay system.So when you send a email of this contradiction then your IP address would be blocked by the spam database.

When you try sending an email best practice is that create a email ID with your email system and have them as the envelope sender as well as return path of the email.

mail command with specific recipient

Mail command can be used to send email from any UNIX or Linux system to other system. Basically they are command based email program to send email.

mail -s "Subject" name@example.com

To send the email with particular sender email ID then use the below syntax.

mail -s "Subject" name@example.com -- -r "user1@example.com"

Why it becomes very particular to send with an email ID because when you use a mail program it assumes that the logged in user as the sender from the base(current  working) machine. These type of emails are generally rejected on the basis of doubt for spam.

So i recommend a particular email ID for sender which will ensure the safe journey of email.

Body with file redirection:

To send email with data from a file or a source you can always redirect the information to the mail command.

 mail -s "Subject for test" name@example.com -- -r "user1@example.com" </etc/mail/sendmail.cf

The email from user1@example.com to name@example.com will have a subject as 'Subject for test' and carry the data from the sendmail.cf file.