Logging In & Out

Commands covered in this section: login logout su logname passwd

First Steps

In this section we will cover the basics you will need, logging in and out of the system. Before launching into this, please note that you will need to get a login name and a password from you system administrator.
Make sure that you type both your login name and password in the appropriate case, if your password is mik9998H and you type Mike9998H (or mike9998h, ...), you won't be able to login.



Logging in

When you are ready to start using a machine, you will initially see a prompt on screen like:
login:
type your login name. Then a prompt asking you to type your password in will be displayed. Type your password in as it was given to you. The password you type in will not be displayed on screen nor any other characters, this is for security reasons so don't worry if you don't see anything just type it in and press enter.
If you have got it all right you should get a prompt with the name of your machine. You can now start using all the wonders of UNIX!!



Restarting your Login Shell

You might at some point need to change your login environment variables (more on these later on), or even the login name you are using (you can only do this is you have more than one account on the system). To do this you would use the command login. A few restrictions apply to this command, to be able to execute it you must not be in a subshell (if you don't know about subshells don't worry you are most probably not using one). The syntax to use is:
exec login name
where name is the new login name you want to use, if you just want to reinitialise your environment type your own login name.
This new session will replace your former so that it will be as if this was the command you use to log into the system from the start.



Changing your Identity

Using the login command to do this was discussed above. We would like to introduce a new command namely su. su will allow you to login as another user but with the difference that you will be working in a subshell, so when you logout, you will resume your initial identity (whereas using login would log you out of the system altogether).
su (which stands for substitute user) is used by typing su username, where the username is the name of the new user you wish to use. By typing su - username (spaces before and after - are necessary) will allow you to work in a new shell (used by the user who's identity you are assuming), along with that user's environment set-up. However if you omit the - you will still be working in your original shell/set-up but with the new user's identity and privileges.
Note:The su command will not allow you to login without the new user's password!!



Checking your Identity

If at some point you want to see what login name you are using (during one of your logins) just type logname and your login name will be displayed.



Logging Out

This is the important one! To logout (and terminate you session) simply type logout at the prompt. This will log you out and make sure you have no processes running. An alternative to this command is to use the Ctl and D keys, it does exactly the same thing as would the logout command.
If you use logout while using a subshell this will log you out of the subshell and not out of the system. Always make sure you have logged out properly! Wait for the login prompt to be displayed again or if worst come to the worst reboot your machine.



Note on Passwords

Changing your password is very important. You show change it at least once a month, and specially if people see you typing it in! Most systems require you to have a password of at least 6 characters long, and you should use numbers as well as symbols (eg: us76.jh#q9*7$ ), make it as difficult as possible to guess. If you are the luck owner of several accounts DO NOT use the same password for each!



Changing Passwords

To change your password simply type passwd, you will be asked to enter your old password and then to type in a new one twice. This is because, what you type will not be echoed on screen, so to make sure you have typed it in properly you need to do it twice!
If you have given a correct password and typed your new one in properly your password will be changed, if not, well start again!!
You can also use passwd username. This will allow you to change the password for the user specified by username (the same process applies as if you were changing your own).



< Previous: Introduction ^ Next: Exploration >
Index

Frankie Blaskovic
Last modified: Sun Aug 10 12:03:03 BST 1997