Guys,
I'm configuring SUDO on our hosts.
I've created a script to configure SUDO and to create the users on the host.
When the user is created I need to update the default PATH in each users HOME folder
from...
PATH=$PATH:$HOME/bin
to...
PATH=$PATH:/usr/local/sbin:/sbin:/usr/sbin:$HOME/bin
I'd like to either, remove, update or comment out and replace the default PATH and replace with the new one.
Could anyone suggest a suitable way to do this via a sh. script?
Any guidance??
A bash guide could be fine.
A mandatory profile does not exist in Linux world.. you can set some variable globally (using /etc/profile files)... but each users can modify them (so is not really "mandatory")
There is also a way to make a "default profile": create your file in /etc/skel and when you add a new user, those files will be copied in the user's home directory.
Andre
In the past, I've modified /etc/profile upon provision to update the path of the user's I want to have specific paths, you can take a look at how it's setup for root
# Path manipulation if ; then pathmunge /sbin pathmunge /usr/sbin pathmunge /usr/local/sbin fi
If you know the id for the user's you're creating, then you can add additional conditional OR you can just set it globally depending on your requirements.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
For global settings, as also as written, you can use /etc/profile.
You can find a lot of examples (for other environment variables) in /etc/profile.d directory.
Andre
Thanks Guys.
I think I'd like to set the path globally so that when it creates the user it pulls the "updated path" and creates the user profile based on these settings. I suppose just like a manadatory profile in Windows.
I looked through the links but I wasn't 100% sure what I was looking for.
Any guidance??
Any guidance??
A bash guide could be fine.
A mandatory profile does not exist in Linux world.. you can set some variable globally (using /etc/profile files)... but each users can modify them (so is not really "mandatory")
There is also a way to make a "default profile": create your file in /etc/skel and when you add a new user, those files will be copied in the user's home directory.
Andre
Thanks.
Updating etc/skel/.bash_profile with the path statement has worked.