Полезная информация

Next Up Previous Contents Index
A Brand New You

1.6 A Brand New You

Now, let's create a ``user account.''

If you're familiar with MS-DOS or, to a lesser extent, Windows 98, you might be a little befuddled by the requirement of creating a user account.

After all, if you can navigate the system and use programs in your root account, you might think that having two accounts on a single machine is excessive.

Nothing could be further from the truth. Here's why:

Linux is a multi-tasking, multi-user system, which means it can safely and securely accommodate many users at one time, performing plenty of tasks each user requires. But only one account can be root -- capable of changing the way the operating system works.

Because ``rooting around'' can easily lead to havoc, it's important to safeguard against accidents. That's why just about every Linux user -- even if they're the system administrator -- has their own user account.

Once you're logged in as root, you have two ways to conveniently add a user to the system: from the within X and from the shell prompt.

Both methods are quick and painless.

Let's say that the account you want to choose is called ``billy.''

From X:

One of the most powerful tools you can use for system administration is Linuxconf. You can use Linuxconf for adding and manipulating accounts, monitoring system activities and plenty of other system features.

Figure 8: Finding the Users accounts entry in Linuxconf

Completely documenting all the features of this utility would take much more space than we have here. For a more detailed look at the application's features -- including greater depth on manipulating accounts -- turn to the ``System Configuration with Linuxconf'' chapter in the Red Hat Linux Installation Guide.

  • Tip: You can learn more about Linuxconf by visiting the official Linuxconf website:

    http://www.solucorp.qc.ca/linuxconf/.

  • One of the easiest ways to access Linuxconf is from the shell prompt. At the prompt, type:

    linuxconf
    

    We want to add an account, so let's scroll about a third of the way down the menu in the left panel, to the entry marked Users accounts. If the entry has a + next to it, go ahead and click on the ``+''.

    Now, the menu will expand to show entries in the User accounts listing (as shown in Figure 8).

    The subentries will look like the following:

    |
    -Users accounts
     |
       Normal
       |
         User accounts
       |
         Group definitions
       | 
         Change root password
    

    Left-click with your mouse button on the User accounts entry, under Normal.

    In the right panel, you'll now see a box of the current user accounts (as shown in Figure 9).

    Figure 9: The Users accounts in Linuxconf

    Toward the bottom of the right panel, click on the Add button, between the Quit and Help buttons.

    Now, we'll see a dialog called User account creation. In here, we're going to fill in: Login name; Full name and group.

    Make sure the button is indented next to the statement The account is enabled.

    Now, let's type in a login name. It should be easy to remember (it's the password that should be complex, but more about that later...). Then, you can type in your full name.

    Figure 10: Adding a user in Linuxconf

  • Tip: Everyone's account belongs to at least one group. Groups are used to determine file access permissions. Unless you specify a group, the default group for your user account will be the login name you choose (for example, a group called billy).

  • When you're finished, your entries should look like the following:

    Login name.........billy
    
    

    Full name..........Bilbo Baggins

    group (opt)........billy

    Now, just click on the button marked Accept.

    We're almost finished. Next, we've got to come up with a password.

    Passwords are one of the best methods to safeguard against prying eyes or malicious behavior. If you've got a secure password, which only you know, you've taken a big step in your system's security.

    Figure 11: Creating a user account's password in Linuxconf

    For both your root and user account, your passwords should be unique and easy enough for you to remember. (Passwords can't protect very well if they're jotted down on a piece of paper and taped to the monitor!)

    What's both unique and easy to remember? Passwords which both numbers and letters. Here's an example:

    One more thing: Passwords must be at least six characters -- upper and lowercase letters and/or numbers -- in length.

    Once you decide on a password that you feel comfortable you'll remember, type it in the box provided. You won't see the password, except in a series of asterisks (as shown in Figure 11).

    Then, click on the Accept button.

    You'll be asked to retype the password for verification. Again, you won't see your password as you type it.

    When you've finished, you'll see the account listed in the accounts panel (see Figure 12 for an example).

    That's all there is to it.

    Figure 12: The new user account in Linuxconf

    For additional security, you should change your passwords every now and then. From your user account, you can change your password by clicking on the account name, then clicking on the box marked Passwd at the bottom.

  • Tip: Now that you've created your user account, you might want to reconsider whether your root account's password is secure enough. You can change this password easily, from within Linuxconf, by clicking on the Change root password item.

  • To learn more about how to modify your account or perform other account procedures, turn to the System Configuration chapter in the Red Hat Linux Installation Guide.

    From the shell prompt:

    At the prompt, type useradd billy. It should look like this:

    [root@localhost root]# useradd billy
    [root@localhost root]#
    

    (See Figure 13.)

    Figure 13: Adding a user at the shell prompt

    Looks like nothing's changed, right? Wrong. Although you've got the same prompt, an entry has already been made for the new account. Now, it's time to specify a password.

    At the prompt, type passwd billy. It should look like this:

    [root@localhost root]# passwd billy
    [root@localhost root]#
    

    (See Figure 14.)

    Remember that the password must be easy to recall and a unique mixture of letters, symbols and/or numbers.

    That's it.

    Figure 14: Adding a password at the shell prompt

    From now on, whenever you want to add a user, change account information or change account passwords -- including the root password -- either useradd or linuxconf will fit the bill. Make sure you're logged in as the root user, however.

  • Tip: If you find yourself switching around frequently between the root account and your user account, it can become confusing to know which account you're actually logged into. You can always tell you're in the root account you see the word [root at the start of the shell prompt or the hash mark (#) at the end. If you see (for example) [billy, or the dollar sign ($), you're working in your user account.

  • Regardless of the method you choose -- from the shell prompt or from Linuxconf -- your new user account's ``login directory'' will be placed in a subdirectory of /home.

    To finish up and try out your new account, log out from your root account.

    You'll be taken back to the login screen.

    Now, you can log in to your new user account.

  • Summary: From X -- In a terminal emulation window, type linuxconf. Scroll to User Accounts -> Normal -> User Accounts. Click on Add. From the shell prompt -- type useradd (accountname); at the shell prompt again, type passwd accountname. Type and re-type password.


  • Next Up Previous Contents Index