UNIX Tutorial 2. Logging in, logging out  

Commands covered in this section:   whoami, passwd, logout

Since UNIX supports multiple users at one time, you must identify yourself to the system before you can begin using it. This process is called logging in. When you connect to a computer running UNIX (often called a UNIX host), you are asked to provide two pieces of information in order to log in: your login name, which is your identity on the system, and your password, which proves (or at least improves the likelihood) that you are indeed who you say you are. Throughout the tutorial, we will assume your login name is "natasha" and you are logging into a UNIX host called "peabody."

Exercise 2.1

Connect to a UNIX host on which you have an account (this can be accomplished by using the telnet or ssh program running on a PC or a Mac, for example). Log in by supplying your login name and password when prompted (your password will not be displayed when you type it), as shown below:
          UNIX(r) System V Release 4.0 (peabody)

          login: natasha
          password: your-password

          Last login: Fri Feb 14 08:21:43 from bullwinkle.whatsamatta-u.edu

          Sun Microsystems Inc.     SunOS 5.8     Generic May 2001

          Welcome to peabody!  Report any problems by sending e-mail
          to sysadmin@peabody.whatsamatta-u.edu.

            ** NOTE: peabody will be down from 10:00 am to 11:00 am
            **       on Saturday, February 22 for a hardware upgrade.

          You have new mail.
          TERM = (vt100)
          % 
When you log in, the system will print several lines of information on the screen. After you've logged in a few times and the novelty has worn off, you may be tempted to ignore this and start using the system. Don't! There are several important pieces of information displayed here. The first line you see after typing your password tells you when you last logged in. If you see something like:
Last login: Fri Feb 14 03:52:12 from evil.hackers-r-us.org
and you've never heard of a machine called "evil," you might begin to suspect that your account has been compromised... The next several lines are from a file called motd (message of the day). This is where the system administrator places important announcements about the system. If new electronic mail addressed to you has arrived, you will see a message informing you of this. You may also be prompted for a terminal type. If the system suggests one for you (as in "vt100" in our example), accept it by pressing the RETURN key; otherwise, you must supply the correct terminal type yourself (ask your system administrator for assistance if you are not sure). Finally, you will see the shell prompt ("%" in our example). You are now ready to begin issuing commands to the UNIX system!

In order to ease ourselves into this business, let's begin with a very simple command, whoami. This command requires no options or arguments, and has the highly desirable side effect of reassuring the user by confirming his or her identity.

Exercise 2.2

Enter the whoami command at the shell prompt and see what happens.
         % whoami
         natasha 
That's it -- all this command does is print the login name of the current user. Congratulations, you've just had your first taste of the power of UNIX!

Now before you get carried away with all that power, let's talk a bit more about passwords. Remember that UNIX uses your password to verify that it's you who is entering the system under your login name and not someone else. Therefore, only you should know your password. In order to be effective, the password must be extremely difficult for someone else to guess. Here are some simple guidelines:

Don't:

  • use your login name, real name, nickname, dog's name, or any name for that matter.
  • use a word which appears in a dictionary (yes, that includes dictionaries in all languages).
  • easily guessed combinations of characters, such as "abc123" or "qwerty".
  • write your password down -- you would never even think of writing it on a Post-it and sticking it on your computer, right?   :-)
Do:
  • make sure your password consists of at least six characters.
  • include at least one number or punctuation mark and at least two letters.
  • use both uppercase and lowercase letters (UNIX passwords are case sensitive).
  • choose a password you can remember without having to write it down.
The easiest way to make up a password that follows these guidelines is to take the first letter of each word in a phrase that is easily remembered. Choose a phrase that allows you to use a number or punctuation mark. Table 2.1 shows some examples (no, you can't use these; make up your own!).

Table 2.1

Phrase Password
Four out of five dentists recommend Trident 4oo5drT
In every point twice done and then done double Ie.tdatdd
The Adventure of the Three Garridebs TAot3G
Once an account is broken into, it can be used to stage further attacks on the same host or other hosts on the Internet. As a trusted member of a community of UNIX users, you have a civic duty to select good passwords and change them on a regular basis -- anything less would be uncivilized! In fact, right now is a good time to start. You use the passwd command to change your password.

Exercise 2.3

Enter the passwd command at the shell prompt. You will be prompted to enter your old password (to confirm that it's really you), and then your new password (twice, to ensure that you didn't make a typing error). In all cases, passwords are not displayed on the screen as you type them. Depending on which version of UNIX you are using, the wording in the prompts may vary slightly from that shown here.
          % passwd
          passwd:  Changing password for natasha
          Enter login password: your-old-password
          New password: your-new-password
          Re-enter new password: your-new-password 
Once you've completed your work, you can end your UNIX session by logging out. This is accomplished via the logout command.

Exercise 2.4

Enter the logout command at the shell prompt.
          % logout
          Connection closed by foreign host. 
Of course, you'll have to log back in to continue with the tutorial. Now that you know how to log in and log out, you have the option to stop working on the tutorial at any point and later resume where you left off. In the next section of the tutorial, we will begin to explore the UNIX environment in more detail.


<   previous   |   table of contents   |   next   >