Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to use ssmtp as my command line mail application as proposed in this answer.

One of the steps is to put my mail account password in a file /etc/ssmtp/ssmtp.conf. Since the file has read permission for all users, it undermines the secrecy of my password.

How to overcome this? I tried to remove the read permission for group and others but then ssmtp does not work anymore.

share|improve this question
add comment

2 Answers

Try invoking ssmtp as a regular user instead and specifying a custom configuration file location.

From the manpage of ssmtp(8):

-Cfile Use alternate configuration file.

Put your configuration file in a safe place in your home directory without read permission for others. Then run ssmtp like this:

user@host:~$ ssmtp -C/path/to/somesecuredir/ssmtp.conf [options]
share|improve this answer
add comment

The answer is contained within the sample ssmtp.conf file - it reads as follows (taken from http://wiki.debian.org/sSMTP);

#### VERY IMPORTANT !!! If other people have access to this computer
# Your GMAIL Password is left unencrypted in this file
# so make sure you have a strong root password, and make sure
# you change the permissions of this file to be 640:
# chown root:mail /etc/ssmtp/ssmtp.conf
# chmod 640 /etc/ssmtp/ssmtp.conf"
share|improve this answer
    
i am getting this error: "ssmtp: Cannot open mailhub:25" –  bubble Jan 2 '13 at 17:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.