Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running SLED 11, and I want to understand what the useradd command does and how it does what it does. I know that SLED 11 is built from OpenSuSE 11.1 and I would be more than satisfied with the OpenSuSE 11.1 source code for useradd.

Where can I find the source code for useradd?

share|improve this question
up vote 2 down vote accepted

On openSUSE useradd is from package pwdutils. Homepage http://www.thkukuk.de/pam/pwdutils/, source ftp://ftp.kernel.org/pub/linux/utils/net/NIS/

share|improve this answer

since SUSE is an rpm based distro, you should be able get it by:

$ rpm -qf `which useradd`

which will tell you which package it is in. You can then go get that package source from the repository, which in my case is here: http://download1.fedora.redhat.com/pub/fedora/linux/releases/11/Fedora/source/SRPMS/shadow-utils-4.1.2-13.fc11.src.rpm (I run fedora; your package repository location will be different)

share|improve this answer

Don't know about SLED, but the Debian version is available here.

share|improve this answer

The useradd utility might well be a script.

Try

$ file $(which useradd)

(or

file `which useradd`

if your shell doesn't support $() style command expansion).

If it is a script, use more or an editor...

share|improve this answer
    
file $(which useradd) returns: /usr/sbin/useradd: ELF 32-bit LSB executable, Intel 80386. version 1 (SYSV), for GNU/Linux 2.6.4, dynamically linked (uses shared libs), stripped – eleven81 Oct 26 '09 at 17:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .