I have some questions on how I can perform the following actions from the terminal in CentOS 5.5 final. My Google searches aren't helping and I keep seeing references to the command 'useradd' but this isn't present on my box;
-How to add a new user? $ useradd -bash: useradd: command not found (This is the same for my normal user and when logged in as root)
-How to set/change an existing users home folder path -How to list all users -How to list all groups
Sorry if this seems trivial but I am actually stuck on this :)
On Thu, Feb 03, 2011 at 11:12:19AM +0000, James Bensley wrote:
I have some questions on how I can perform the following actions from the terminal in CentOS 5.5 final. My Google searches aren't helping and I keep seeing references to the command 'useradd' but this isn't present on my box;
-How to add a new user? $ useradd -bash: useradd: command not found (This is the same for my normal user and when logged in as root)
See my page
http://home.roadrunner.com/~computertaijutsu/rhpath.html
From: James Bensley jwbensley@gmail.com
-How to add a new user? $ useradd -bash: useradd: command not found (This is the same for my normal user and when logged in as root)
First, normal user not finding useradd is normal. And it would not be able to use it for obvious security reasons... Second: use 'su -' instead of 'su'. locate 'x' finds 'x' on your filesystem... Third: http://www.google.fr/search?q=unix+tutorial
JD
On Thu, 2011-02-03 at 04:01 -0800, John Doe wrote:
From: James Bensley jwbensley@gmail.com
-How to add a new user? $ useradd -bash: useradd: command not found (This is the same for my normal user and when logged in as root)
First, normal user not finding useradd is normal. And it would not be able to use it for obvious security reasons... Second: use 'su -' instead of 'su'. locate 'x' finds 'x' on your filesystem...
BUT, as someone helpfully mentioned on this list, ONLY if it has been indexed by a routine which automatically runs at night.
find / -iwholename *xxxxxx*
also works. xxxxxx being the sought file name. Don't forget the first * and add the second * if necessary.
Google your question, en Anglais, and you will usually get answers.
Bon chance !
With best regards,
Paul. England, EU.
Always Learning wrote on Thu, 03 Feb 2011 12:06:53 +0000:
BUT, as someone helpfully mentioned on this list, ONLY if it has been indexed by a routine which automatically runs at night.
if you install mlocate that is the case! If you do not install mlocate you cannot locate, anyway. So, this is a non-issue.
Kai
On Thu, Feb 3, 2011 at 6:12 AM, James Bensley jwbensley@gmail.com wrote:
I have some questions on how I can perform the following actions from the terminal in CentOS 5.5 final. My Google searches aren't helping and I keep seeing references to the command 'useradd' but this isn't present on my box;
-How to add a new user? $ useradd -bash: useradd: command not found (This is the same for my normal user and when logged in as root)
If you look up the "File System Hierarchy", you'll find out that system administration tools that normal users don't really "need" are in /sbin or /usr/sbin or /usr/local/sbin. Those directories are not in a user's default "PATH" on RedHat based operating systems. They're added to the root user's PATH by a bit of scripting in /etc/profile. Personally, I consider this silly and add a copy of this code, edited to enable it for me, to my personal $HOME/.bashrc.
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". 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.
-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.
Sorry if this seems trivial but I am actually stuck on this :)
Sounds like you could use some time with some basic UNIX or Linux manuals, or benefit from the "man useradd" command.
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!