Monday, October 19, 2009

The first faltering steps

We have done enough homework on Unix now to venture for our first practical contact with it. Given that your terminal is secured to the host computer and is powered on, your display prompts you for your login name. Each user is given an unique login name & a password, which are like an entry pass to contact to the host machine as a user.

If you haven't been given a login name and a password, you won't be able to gain access to Unix. After you enter your login name, you are prompted to enter the password which when keyed in does not appear on the display. Obviously this is to ensure that no chance or may be premeditated passer-by is able to sneak it on it.

When you try to access your system, Unix wil display a prompt that looks something like this:

login: aa1
Password: heman1

After receiving the login prompt, you enter your login name (aa1 in the above example), after which you receive the Password prompt. At this stage you must type in your password (heman1 in the above example). The password of course would not appear on the screen. The password you use should be kept private. It is the method used by Unix to prevent unauthorized entry into the system. The password should be changed frequently. On many systems, after a specified period of time, your password expires (ages) and the next time you login the system requires you to change your password. In addition, you can change your password whenever you like on most systems by using a command to alter the password. We would discuss how to change your password later.

Sometimes you may not type the login name or password properly. When you do this, the system will respond with the following message:

login: aa1
Password: heman1
Login incorrect

Wait for login retry:
login:

Note that the system does not tell you which one is incorrect, the login name or the password. Again, this is a security measure. Even if you type your login name improperly, you will still get the password prompt. You usually get three to five attempts to get it right before your terminal is disconnected. Many times a message is displayed to the system administrator telling him or her that several unsuccessful attempts were made on your login name.

Once the correct login name and password have been supplied, you find some welcome messages from the suppliers of the Unix version installed on the host machine, followed by a command prompt. The command prompt is a $ (dollar) if you are operating in Bourne shell or a % if in C shell. What powers await you here will be unwound as we progress. For now, take it from me that they do.

You are prompted for the login and the password every time you put on your terminal. Its purpose is to identify the user and allow access to the system only after verifying the identity of the user. You will not be prompted for the login if there is some problem in cables through which your terminal is connected to the host machine.

Once at the $ prompt you can issue commands. There are several hundred commands available in Unix. Let us begin with the most elementary one.

$ who am i
aa1 tty3a Jun 10 09:15


A word of caution before we proceed. All Unix commands are to be typed in small-case letters. Once you enter the above command and press the Enter key the shell interprets your command and then dispatches a message to kernel to identify the user. The kernel retrieves the information about you and displays it on the screen. This information consists of aa1 which is our login name, tty3a signifies the terminal number or the serial port line by which your terminal is connected to the host machine. The date and time at which you logged in are also displayed.

In fact the who am i command is a special case of the who command. The who command is more powerful and displays data about all the users who have logged into the system currently. This is shown below:

$ who
aa1 tty3a Jun 10 09:15
aa2 tty3c Jun 10 09:25
ajay tty3d Jun 10 08:22
shilpa tty3b Jun 10 07:10

The format of the output is same as that of who am i. The first entity is again the user's login name followed by the terminal line he is using and login dates and times.

The end of an Unix session is marked by a logout. This is done by either typing exit at the $ prompt or hitting Ctrl d. Terminating your session this way indicates that you have logged out of the system. Simply turning the power at your terminal off does not result in an actual exit. Anyone switching on the terminal would then automatically find himself logged in, by passing the login procedure. Needless to say, that would mean goodbye to your file security.

No comments:

Post a Comment