On Thu, Feb 3, 2011 at 6:12 AM, James Bensley <email@example.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
> -How to list all groups
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.
CentOS mailing list