LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Changing Users Default Env variables at creation (http://www.linuxquestions.org/questions/linux-general-1/changing-users-default-env-variables-at-creation-4175441739/)

jmc1987 12-17-2012 01:28 AM

Changing Users Default Env variables at creation
 
Okay Thanks for helping me for starters. I just installed postfix and dovecot on my CentOS 6 Server and got it configured to use system users. Now I also got the default mail dir

$HOME/Maildir

So what I am trying to figure out is how would I stop the /var/spool/mail file from creating and changed the users default MAIL variable to $HOME/Maildir

Now I changed the MAIL variable by editing /etc/skel/.bash_profile and adding these 2 lines.

Quote:

MAIL=$HOME/Maildir
export MAIL
And I added another file to /etc/skel/Maildir with permissions 0700

Now I think there is another way to achieve this and would like some suggestions.

Thanks again

unSpawn 01-13-2013 11:36 AM

Quote:

Originally Posted by jmc1987 (Post 4850731)
(..) how would I stop the /var/spool/mail file from creating and changed the users default MAIL variable to $HOME/Maildir

I don't understand that unless you mean "changing from something else to $HOME/Maildir".


Quote:

Originally Posted by jmc1987 (Post 4850731)
Now I changed the MAIL variable by editing /etc/skel/.bash_profile and adding these 2 lines.
And I added another file to /etc/skel/Maildir with permissions 0700

/etc/skel/ files are dumped in the users account on account creation which means they'll be subject to any change the user makes (also note ~/.bash_profile won't be read if BaSH is invoked as "/bin/sh" but instead ~/.profile). For BaSH and Bourne Shell variables are read from the /etc/profile.d/ directory (see /etc/profile) so you should be able to get away by setting
Code:

echo 'MAIL="${HOME}/Maildir"; export MAIL' > /etc/profile.d/maildir.sh
just once.



//NTLB


All times are GMT -5. The time now is 10:58 AM.