On 3 February 2011 12:45, Nico Kadel-Garcia nkadel@gmail.com wrote:
But the result for normal users is that command like "useradd", "chkconfig", and "service" need to be typed out with their full path, such as "/usr/sbin/useradd" or "/sbin/chkconfig".
Thanks Nico, I was aware of this but I couldn't find the useradd command at the time
This also means that if you become root by doing a "sudo' command, it doesn't get added to your PATH. without some additional options.
I see, I didn't know this, this is why I was being thrown because when using sudo I wasn't temporarily inheriting root's $PATH. This makes sense.
-How to set/change an existing users home folder path
/usr/sbin/useradd -d [new directory]
-How to list all users
getent passwd
-How to list all groups
getent group
These getent commands will also pull NIS or certain types of LDAP data, and mix it with the contents of /etc/passwd or /etc/group, just for your information. Unsorting them can be awkward.
This is all very user, thanks very much :D
Despite being told here the answer, I found it myself when logged in as root, 'which' showed me the full path, like 'locate' so logging back in as my normal user I was able to 'sudo /usr/sbin/useradd ....'.
Many thanks all!