5

I'm having some trouble getting SSMTP to let me send email as a regular user. When I set up this machine ~a year ago, I'd used Arch's instructions to set up security, but that apparently broke silently at some point with (I assume) an update, and I just realized that I haven't been getting email from cron and whatnot. I'd rather not have to hope that I notice when ssmtp updates and go change everything manually.

I'm getting what looks like a classic permission error:

$ echo "This is a test" | mail -s "Subject" <my email>
send-mail: Cannot open mailhub:25
Can't send mail: sendmail process failed with error code 1

This works perfectly fine when I run mail with sudo. However, my permissions look fine:

$ sudo ls -l /usr/sbin/ssmtp 
-rwxr-xr-x 1 root root 39784 Jul 14  2014 /usr/sbin/ssmtp
$ sudo ls -l /etc/ssmtp/ssmtp.conf
-rw-r----- 1 root root 699 Dec 28 16:35 /etc/ssmtp/ssmtp.conf

I've added my user to the "root" group, which seems little iffy, although I'd tried using the "mail" group earlier:

$ groups
root mail [...]

The frustrating part is that I've got a ubuntu box sitting here with what looks like exactly the same configuration, except that it works. What the heck am I doing wrong? [This machine is running Debian "stretch", ssmtp package version 2.64-8+b2]

Edit- As requested, I tried using mail in verbose mode, which didn't yield any additional output (?)

$ echo "Test" | mail -v -s "Test" [email protected]
send-mail: Cannot open mailhub:25
Can't send mail: sendmail process failed with error code 1
3
  • a strace might indicate what send-mail is doing right before issuing that error Commented Dec 28, 2017 at 23:14
  • I'm sorry, I have no idea how to use strace :/ I have no significant programming (or debugging) experience. Commented Dec 29, 2017 at 1:08
  • Please add debugging output by pasting the output of: echo test|mail -v -s "test" [email protected] Commented Dec 31, 2017 at 18:07

1 Answer 1

2

If you used those Arch configuration instructions the part you're missing after a Debian upgrade is that there is nothing to tell Debian to reapply the setgid bit. Run these two commands (or use the script /root/bin/ssmtp-set-permissions if you created that)

chown :ssmtp /usr/bin/ssmtp
chmod g+s /usr/bin/ssmtp

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.