Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Permission problem with Postfix and MySQL [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
webbruno
n00b
n00b


Joined: 01 May 2010
Posts: 24

PostPosted: Mon Oct 08, 2012 1:04 pm    Post subject: Permission problem with Postfix and MySQL [SOLVED] Reply with quote

Hi all,

I've followed the instructions of Virtual Mailhosting System with Postfix Guide to set up a postfix mail server. I can send e-mails to my local users (and to other users on the internet as well) but the received e-mails are getting a different permission and in order to view the files on Squirrel I must change the permissions from 0644 to 0664, which means the new mails always are written with the 0644 permission. I'm using this script to add a user to my mailserver:



Code:


#! /bin/bash

USER=$1

useradd -s /sbin/nologin -G vmail,mail -m -b /var/mail/ ${USER}

maildirmake /var/mail/${USER}/.maildir/


chown ${USER}:${USER} -cR /var/mail/${USER}/

mysql --host=localhost --user=myverysecretuser --password=myverysecretpass mailsql << EOF
insert into users (email,clear,name, uid,gid,homedir,maildir) values("${USER}@zemarestaleiro.com.br","password","${USER}",1001,1001, "/var/mail/${USER}/","/var/mail/${USER}/.maildir/" );
EOF

passwd ${USER}



What am I missing or what am I doing wrong? Thanks in advance for all the help
_________________
Running Gentoo with =sys-kernel/vanilla-sources-2.6.39 from i5 2500k @ 4.0ghz, 8gb ddr3 1866 corsair vengeance, ga-ud3-p67-b3, seagate barracuda 1TB 32mb cache, cooler master 460 and Geforce GTX 580


Last edited by webbruno on Fri Oct 12, 2012 1:38 pm; edited 1 time in total
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6639
Location: The soundosphere

PostPosted: Tue Oct 09, 2012 1:10 pm    Post subject: Reply with quote

If you're not married to doing it that way, check out the Postfix guide linked in my sig. I think it would sidestep those problems by nature.
_________________
decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN
Back to top
View user's profile Send private message
cach0rr0
Bodhisattva
Bodhisattva


Joined: 13 Nov 2008
Posts: 4123
Location: Houston, Republic of Texas

PostPosted: Thu Oct 11, 2012 7:26 am    Post subject: Re: Permission problem with Postfix and MySQL Reply with quote

I second the aforementioned guide, but them I'm a touch biased (actually, I may need to do an updated ebuild for cyrus-2.4.16, but dont have time at the moment)

specific to this:

webbruno wrote:
in order to view the files on Squirrel I must change the permissions from 0644 to 0664, which means the new mails always are written with the 0644 permission.


squirrelmail should be asking your IMAP server to read the mail file, and give it the contents
it should not be trying to read files from the filesystem directly, so unless something is amiss, squirrelmail *should* be permissions-agnostic - if the IMAP/POP server can read the emails, then so too, should squirrelmail be able to read them.

so that's the spot to troubleshoot - first see if you can read the emails just via IMAP. Use telnet to test (list) if necessary, but make sure the IMAP piece is taken care of. Again, the variable here, squirrelmail should be asking IMAP, it should not be querying the filesystem directly.

It may even be as simple as changing the user under which the IMAP/POP daemon runs, to be the same user under which Postfix runs.

This is part of why I found the "official" guide to be a bit cumbersome, and why cyrus with its internal account/mailbox structure ends up being easier to manage long-term.
_________________
Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash
Back to top
View user's profile Send private message
webbruno
n00b
n00b


Joined: 01 May 2010
Posts: 24

PostPosted: Fri Oct 12, 2012 1:37 pm    Post subject: Solved Reply with quote

As I use to say: 90% of the problems in the computing world comes from somewhere between the chair (in this case, my own chair)[/b] and the keyboard, this one wasn't different. The error was obvious, I configured postfix to accept only connections from a specific uid: the vmail uid. The solution was the simplest:

Instead of creating system users I should create users using the mysql database linked with postfix as described in the tutorial

I really appreciate the help of you guys above!
_________________
Running Gentoo with =sys-kernel/vanilla-sources-2.6.39 from i5 2500k @ 4.0ghz, 8gb ddr3 1866 corsair vengeance, ga-ud3-p67-b3, seagate barracuda 1TB 32mb cache, cooler master 460 and Geforce GTX 580
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum