Home Menu

User Administration


Contents


Basics

A user is defined by the user identifier that the system assigns to that account when it is created (or is assigned by the creator). Normally, the UID of a normal user is above 100, and the lower numbers are reserved for special users. Of particular interest, UID = 0 is reserved for the superuser or root user. Anyone that can get logged on with a UID of zero is a superuser. This makes it possible to have more than one superuser account.

In addition, every user has a default group, which is also identified by a numeric value. All of the available groups are listed in /etc/group. Again, lower numbers are typically reserved for special groups.

Managing users involves a number of activites:


User Characteristics

Adding a User Manually

Account Management

  • Setting the password

  • Deleting a user
  • Modifying a user
  • Keeping accounts up to date
  • Password checking

    There are programs that will test passwords and make sure that they are "crack-proof". Basically, they are the same tools that people user to break into your system. It is better to test passwords as they are created - see above, but these programs will test passwords and tell you which are vulnerable.

  • Setting user defaults

    Straight from the Horse's Mouth

    I took this from a site that is dedicated to hacking.

    Information in a Password File


    User Support

    This is one of the most important things that you do for two reasons - first, your job probably depends on keeping the users reasonably happy. Second, it will eat up all of your time if you allow it to. Users can be incredibly demanding and helpless given the opportunity, so you need to have an organized approach.

  • Forgotten passwords
  • Lost files
  • Security or policy breaches
  • Automating account addition
  • Kicking everyone off
    1. shutdown -k +5 System going down in 5 mintues
    2. telinit s     - Gets you to single user mode.
    3. touch /etc/nologin     - no one can log on.
    4. Now try to get things figured out.


    Shadow Passwords

    The Shadow password system keeps the private parts of the password system in a file that can be protected. It also keeps some other things there that are quite useful in managing user accounts. Further, it creates a shadow group file that will keep your group information protected.


    Superuser Priviledges

    This is an ability that must be used with care. Normally, you want to know everyone that might make changes as root, and you need very good communications.

    On some systems, it is important to control access to su just for you own piece of mind. This can be done by restricting access to su by changing the ownership and permissions. Traditionally, the wheel group is used for people that can access root types of things, so change the ownership of /bin/su:

    and then change the permissions to:

    The permissions and ownership for /bin/su should be:

    If you want someone to be able to run su, they must belong to the wheel group, which can be done by editing the /etc/group file, or with groupadd.

    sudo

    sudo is a system that allows you to give limited superuser access to some users without opening up your system completely. For example,

    Most recent Linux installs include sudo.

    The sudo command syntax is straight forward and documented in the man pages (sudo and sudoers) , but you seldom need to do anything fancy. Of some use is the -l option which lists the commands a user is allowed to execute with sudo.

    The hosts part of the sudo process is for performing system administration tasks remotely. For example, on host A, you run a sudo command that uses rsh to access and execute a command on another system via sudo. For example,

    On blah.blee.com, sudo will ask for your password and insure that the system are executing on is a trusted host for the shutdown command and user. rsh is not secure (and is disabled on many systems) so a better way to do this is:

    You will have to type in a password for accessing the system as well as the sudo password. You can eliminate the first one by setting up ssh to access the remote host without a password.

    sudo is controlled by the sudoers file, /etc/sudoers, as shown here /etc/sudoers. This is a very simple format, in spite of the way it looks. The lines at the bottom tell sudo how to control things, and the lines above simple define lists of, hosts, users, commands and run_as lists.

    If you modify /etc/sudoers, use visudo as it locks the file and also performs syntax checking on the file when you close it. All sudoer accesses are logged in /var/log/sudo.log by default.


    Quotas

    Quotas are very important in systems with a large user base, as they prevent a user from deliberately or inadvertently filling up a disk. Quotas operate on a file system basis and may be on or off for a given filesystem. Also, quotas come in two varieties, quotas for users and quotas for groups. So a given user might have several quotas for different file systems, as well as quotas for groups on each filesystem that has quotas enabled.

    Most 2.x Linux kernels include quota support, and it can be enabled either at installation or by rebuilding the kernel. If kernel support is on, /etc/rc.d/rc.sysinit will enable quotas at boot time.

    Turn on Quotas

    There are several steps. First, you need to turn on the quotas when the disk is mounted. In the following, all examples are related to a /home file system, but it could be any file system.

    usrquota places quotas on users and grpquoata places defaults on groups. Next, you need to create the quota files for the filesystems as root.

    Now reboot your system and quotas will be on. If you don't want to reboot, do the following:

    If your quotas aren't on after rebooting try running quotacheck and then quotaon for each filesystem.

    Note: This is really not a good way to do this as you could create corrupted quota files if there are users logged on. With this in mind, you should only do this booted to single user mode, or by mounting the partition read-only. You will not be able to mount the / partition read-only unless you boot from a floppy or CD-ROM.

    To set quotas for a user:

    Other the commands related to quotas are:


    Turn off Quotas

    Manipulate Quotas


    Getting Information About Users

    There are a number of commands that can be used to get information about users. Many of these commands provide other information as well.


    Pseudo-users

    Linux systems and Unix systems in general have a group of users known as Pseudo-uses that are used to designate special processes. For example,' a typical Linux system might have some of the following users in the /etc/passwd file:

    bin    daemon    adm
    lp    sync    shutdown
    halt    mail    news
    gopher    ftp    nobody
    ntp    rpc    sshd
    rpm    mailnull    nfsnobody
    named    gdm    apache

    Some of these could be used simply for setting permissions on the file system, others could be actual login names. For example, the named daemon (implements DNS services) runs as named to insure that it can be isolated from roots capabilities. If these ran as root, with uid 0, they could do considerable damage to your system if they happened to be a trojan horse or simply had a serious bug. It is important that the password field in /etc/passwd for thse accounts be set to prevent logins (an "x").


    Assignment

    Due: October 1
    1. Add a group to your system named users and another group named projects. Choose some reasonable group identifiers for them by looking at your /etc/group file.
    2. Create a login.defs file for your system that is reasonable, but not the same as the shipped version. Also create a /etc/default/useradd in the same way, and finally a set of skeleton files in /etc/skel.
    3. Then add at least 4 users to your system, all with the default group of users.
      Another one of the users should be one for yourself, but set it up with the same uid that you have on esus. To find out what that is type the following:

        id

      on esus. It will display your uid and current gid, as well as all groups you belong to.
      All accounts should have home directories and the skeleton files you have created.


      Set up a user named gjh, and use the password you have been given. You will also have to set up your tcp wrappers so that I can telnet to your machine from 153.90.199.77.

    4. Try to log into root with the su command from your personal account.
    5. If you don't have sudo on your system, install it from the Red Hat CD. Configure it to provide a group called admin with the privileges necessary to help out the sysadmin. In particular, give the user gjh permission to run anything (ha, ha, ha).

    6. Set up quotas on your machine.
    7. Create a script to print the connect time and the last three logins for any given user. The script should be run with a command of the form: command username. All scripts should be placed in /usr/local/bin.


    Home Menu