It is often said that running as
superuser on your desktop is bad idea, the same is true in your embedded environment. While many people just leave
root as the only user in the embedded system, it should be understood that while this may be an acceptable practice, managing users in uClinux is the same as any other Linux system. To manage users, there are a few commands and files which you should understand. Many of these are part of Busybox, and can be compiled into or left out of the uClinux-dist.
Most of the utilities needed to properly manage users/groups can be found in Customize Vendor/User Settings → BusyBox → All of these utilties have two options:
/etc/groupfiles. When this option is enabled, you will not be able to use PAM to access remote LDAP password servers. And if you want hostname resolution to work with glibc, you still need the /lib/libnss_* libraries.
This option is called
Use internal password and group functions rather than system functions, and should be set for normal systems.
The easiest way to package the password databases with your default image is to first boot the system and set the passwords to what you want. Then copy the files off the board and into the uClinux-dist build system. Typically this will be
uclinux-dist/vendor/<vendor>/<board>/passwd. Then next time you run `make`, the file will be installed into your romfs/ tree automatically.
You will first need to enable the
login programs (either the standalone or busybox versions).
If you want to enable a login prompt on your console, then modify the
/etc/inittab file (typically found at
uclinux-dist/vendor/<vendor>/<board>/inittab) to include a line for your console device. Assuming you use
ttyBF0 by default, it would look like:
ttyBF0::respawn:/bin/getty -L ttyBF0 57600 vt100
Obviously you'll want to change the
57600 to the baud rate you want to use.
Telnet by default will automatically start using
login if it detects it in the system $PATH, so you shouldn't need to configure things there.
Add a user
foo with default options:
root:~> adduser foo
Add a user
fooie with a custom homedir:
root:~> adduser -d /var/fooie fooie
Add a user
mooie with a custom shell:
root:~> adduser -s /bin/false mooie
Change the active user's password:
Change the password of the user
root:~> passwd foo
Delete the user
root:~> deluser foo
For a good introductory book, you may want to look at Linux in a Nutshell.