XMailforum is a readonly knowledge archive now.

Registering as a new user or answering posts is not possible anymore.

Might the force be with you, to find here what you are looking for.

2019-09-20 - hschneider, Admin

Cookie Disclaimer: This forum uses only essential, anonymous session cookies (xmailforum*), nothing to be scared of.

XMail Forum -> XMail Sendmail permission denied !

Closed TopicStart new topicStart Poll

> XMail Sendmail permission denied !, Howto setup XMail's sendmail wrapper ...
crys
Posted: Mar 4 2006, 09:53 AM
Quote Post


Junior Member
**

Group: Members
Posts: 40
Member No.: 1719
Joined: 15-August 05



Hi All,

I do this,
CODE
ns1 # sendmail crys@domain.tld -s "SSH Alert" admin@omain.tld

And I get,
CODE
/var/MailRoot/spool/temp/1141458289000.22430.ns1: Permission denied

I checked the dirs,
CODE
ns1 # ls -la /var/MailRoot/spool/
total 108
drwx------  27 root root 4096 Feb 23 20:47 .
drwx------  15 root root 4096 Mar  4 10:01 ..
drwx------  25 root root 4096 Feb  7 10:53 0
drwx------  25 root root 4096 Feb  7 10:53 1
drwx------  25 root root 4096 Feb  7 10:53 10
--- continue ---
drwx------  25 root root 4096 Feb  7 10:53 7
drwx------  25 root root 4096 Feb  7 10:53 8
drwx------  25 root root 4096 Feb  7 10:53 9
drwx------   2 root root 4096 Feb 28 11:39 local
drwx------   2 root root 4096 Feb 28 11:38 temp
ns1 #

and this,
CODE
ns1 # ls -la /usr/sbin/sendmail*
-rwxr-xr-x  1 root  root    103 Mar  4 13:18 /usr/sbin/sendmail
-rwxr-xr-x  1 root  root    118 Feb  7 14:25 /usr/sbin/sendmail.org
-rws--S---  1 xmail xmail 14688 Mar  4 13:15 /usr/sbin/sendmail.xmail
ns1 #

What could be the problem?

Thnx

Crys.
PMEmail Poster
Top
hschneider
Posted: Mar 4 2006, 10:21 AM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



mv sendmail sendmail.org2
ln -s sendmail.xmail.sh sendmail
chmod +s sendmail.xmail.sh

The sendmail.xmail.sh should call sendmail.xmail then.

Mine looks like this:

CODE

#!/bin/sh

export DEFAULT_DOMAIN="xxx.com"

if [ -z $MAIL_ROOT ]; then
       export MAIL_ROOT=/var/MailRoot
fi
/usr/sbin/sendmail.xmail $*


CODE

lrwxr-xr-x  1 root  wheel     17 Oct 13 10:06 sendmail -> sendmail.xmail.sh
-rwsr-sr-x  1 root  wheel  15428 Oct 13 10:04 sendmail.xmail
-rwsr-sr-x  1 root  wheel    141 Oct 14 07:35 sendmail.xmail.sh


--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
crys
Posted: Mar 6 2006, 10:21 AM
Quote Post


Junior Member
**

Group: Members
Posts: 40
Member No.: 1719
Joined: 15-August 05



Thanks,

This works charm!. Do you care to explain WHY?. Not Mandatory but will help!!

Thanks,

Crys
PMEmail Poster
Top
hschneider
Posted: Mar 6 2006, 11:03 AM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



mv sendmail sendmail.org2
This disables the original sendmail binary by renaming it.

ln -s sendmail.xmail.sh sendmail
Here we create a symbolic link called sendmail, which calls sendmail.xmail.sh. So each call to the sendmail binary is redirected to that script.

chmod +s sendmail.xmail.sh
This means the script is executed under the ID of its owner (root).

The script itself just sets the global environment variables DEFAULT_DOMAIN + MAIL_ROOT and finally calls XMail's sendmail binary:
/usr/sbin/xmail.sendmail
which has also its SUID bit set (chmod +s)


--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
crys
Posted: Mar 7 2006, 03:59 AM
Quote Post


Junior Member
**

Group: Members
Posts: 40
Member No.: 1719
Joined: 15-August 05



THANK YOU,

And off topic
I'd like to share something for which I toil to get this XMail sendmail CLI working!!,

1. I wanted to get SSH login/connection alert from my box (I have a gentoo box)

2. Create a file called /etc/ssh/sshrc
CODE
vi /etc/ssh/sshrc
# /etc/ssh/sshrc
# Send a brief alert with connection details
#
when=`/usr/bin/date`
sWhen=`/usr/bin/date +'%F %T'`
where=`echo $SSH_CONNECTION|cut -f1 -d' '|cut -f4 -d:`
if [ -z "$SSH_TTY" ]; then
  what="Connect by $USER"
else
  what="Login by $USER on $SSH_TTY"
fi

/usr/sbin/sendmail -t >&2 <<-EOM
Subject:SSH Alert - ${sWhen}
From:root ns1 <root>
To:Crysanthus Silva <crys@domain.tld>, System administrator <admin@domain.tld>

 ${what} from ${where} at ${when}
EOM

3. Whenever a connection is made thru' SSH I get a mail.
4. My next step is to setup a sms alert to my mobile!!!.

I'll be very glad if this helps somebody. Please please improve this junk if a genius see this !!!.

Thnx

Crys.
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
« Next Oldest | Documentation and Knowledge Base | Next Newest »

Closed TopicStart new topicStart Poll