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 02: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 12:36 PM

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

rlj4214 12-09-2014 08:16 PM

No ~/Maildir created with user automatically
 
System is Centos 7
Postfix
Dovecot
MySQL

Frankly I am more than a little surprised that creating a user is not creating the ~/Maildir with the correct permissions and any sub-folders that are needed. I would have thought that was a "gimmie" so to speak.

I would like to set up user creation so that it automatically adds the ~/Maildir with the correct permissions and I guess files structures.

I tried your command

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

and while it appears in /etc/profile.d it is not propagated to the users created. At least it didn't work for me.

I have read documents till I'm blue in the face for the past 2 days and have no answer. This thread was as close as I got and like I said, no go.

I'm still trying to figure out how to do this other than /etc/skel

Thanks for your help in advance.

evo2 12-09-2014 08:26 PM

Hi,

please start a new thread for your question. When you do, please include what method you are using to create new users.

Regards,

Evo2.

rlj4214 12-09-2014 08:52 PM

ok thanks
 
ok thanks

unSpawn 12-09-2014 08:55 PM

Quote:

Originally Posted by evo2 (Post 5282200)
please start a new thread for your question.

Instead please report, or have the member report, the posts for moving.
That's prolly less work than mods having to trawl fora for duplicates.
TIA


All times are GMT -5. The time now is 11:15 PM.