1 Introduction, Your first log in

You will get a shell account, which you can access from anywhere in the faculty network, or in two steps from anywhere in the Internet. To access the shell you need a terminal emulator on your machine. In the process you familiarize yourself with terms like terminal, remote log in, shell, prompt, etc.

1.1 Why use a command interface


PIC

Figure 1: A terminal session

Experienced system administrators maintain their machines from the command prompt. They compile source code, install programs, troubleshoot their operation, automate routine tasks; all in this text environment. Unix relies heavily on text, whether in the form of configuration files or as scripts, and Unix masters an elaborate system of pattern matching in text called regular expressions. The Unix command language is also a programming language. One can write interactive programs in this language or paste other specialized programs together in scripts or pack routine tasks into scripts and schedule them to run regularly.

Graphical User Interfaces (GUI) are convenient but they don’t tell you exactly what they do behind the interface. Once something unexpected happens or if you have a task for which there is no option in the GUI, you are stuck. In addition to that the text terminal doesn’t require the overhead a GUI needs which is a critical factor in remote administration.

1.2 Your login to the Unix shell

In the early days people went to great lengths to access a Unix terminal. Only the system administrators had access to the system console itself. Users accessed the machine through terminals - in the same building through serial lines or from a distances through telephone lines1 . The machines were simply too expensive to be duplicated!

Today it is the opposite. Computers are everywhere! Because of their diversity there are also numerous ways of accessing them. There lies a problem for the beginner. Even within Unix the multitude of flavours make them seemingly different to each other. Which means that the inexperienced can not rely on the exact behaviour of individual examples.


PIC

Figure 2: The Raspberry Pi miniature computer

Therefore in this course all the participants will be working together in the same enviroment - in a Raspberry Pi running a Debian GNU/Linux port, which you access remotely through the network. (See the assignment of this week for details.)

1.3 Your first login

Typically a Unix terminal “greets” the user by printing something about itself on the screen and then requests the user to identify himself:


PIC

Figure 3: A terminal session

The terminal shown in the above figure has printed the Unix flavour, the version number of the kernel, the machine architecture and the host name. Then it requests the user to identify himself by presenting him with a login prompt. The user has to sign in by entering his login name and the password. Here is another example:

CrunchBang Linux waldorf cherry tty4 
Kernel 3.13 on an i686 
cherry login: john 
Password: [suppressed] 
Last login: Mon Feb 29 12:34:56 on tty6 
Linux cherry 3.2.04amd64 
[...] 
john@cherry:˜$

The first lesson: Unix is case sensitive! Don’t type John, if your login name is john. This might come as a surprise for the typical MS Windows user, but Unix was case sensitive right from the beginning with a strong orientation towards lower case - supposedly for easy typing.

The original terminals used serial connections, as a result there were many switches to be set - transmission speed or baud rate, handshake method, duplex method (full or half), etc. - and even required handling a telephone! That was magic which didn’t work without the help of a local expert. The result of all that effort was to get the login prompt.

Today the world is different. Most of the users have a Microsoft Windows desktop in front of them and they want to connect to the Unix across the Internet. If you are one of them get the free terminal emulator program PuTTY from its site 2. Just copy the ’exe’ file to any directory and run it! You might want to make a profile (Figure 2) so that you don’t have to enter the same information every time.


PIC

Figure 4: Setting up PuTTY

If you are on a Unix machine like Mac or Linux, you definitely have a terminal emulator. Look for a program called Terminal, Konsole, Command, or something similar. What you need is just the SSH client, which is unimpressively called ssh. Try ssh login@host at the command prompt. (Here login stand for you login name; the host is the DNS name or the IP address of the host.


PIC

Figure 5: Connecting from Mac OS X or Linux

In all these cases, the first time you log in you will get a warning about establishing the authenticity of the host. Accept it only if the finger print is correct, in the case of our ’arm’ it is 22:2f:cd:f3:df:d1:af:5d:66:dc:c0:74:68:86:14:22.

Once successfully logged in, the login procedure starts an interpreter which will be “talking” to you. This is called the shell. The shell signals that it is listening by printing its prompt. In the example above john@cherry:~$  is the shell prompt. Certain information in it are easily guessed. Note the general format login@host, which we are going to encounter often.

Also note that the default shell prompt vary from system to system. Since the user can customize it anyway, in this documentation we use simply the ’$’ character as the shell prompt.

You can now start working in Unix.

1.4 Changing the password

You should change the initial password you received from the system administrator to one of your own. You enter the command passwd to change your password:

$ passwd 
Changing password for john. 
(current) UNIX password: 
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password changed

When changing password not only that you should know the old password but you need to type the new password twice. Also notice that certain systems may have restrictions on the password like minimum length and whether you must use digits and/or special characters.

Note that the superuser can change password without providing the current password. Which means that the superuser can not find out the current password of a user, he can only set it to a new value.

1.5 Logging out

The command to log out is, you guessed it, logout. It instructs the shell to terminate your session. That will close the shell and reset the terminal so that it will fall back to the login prompt you saw at the beginning. Try it!

On a side note: It is not meaningfull to shut down the machine as a normal user: this is obviously something for the superuser!

1.6 Assignment 1

Step 1: If you are on Windows, install a terminal emulator like PuTTY and then log in to either aiken.ce.pdn.ac.lk or tesla.ce.pdn.ac.lk. If you are on a Unix you can simply type ’ssh eNUMBER@server.name’ in a terminal.

From there login to the ’arm’, a Raspberry Pi, by entering ’ssh eNUMBER@arm.ce.pdn.ac.lk’.

Step 2: Take a screen-shot just after logging in and upload it to the assignment tool.

Summary

In this week you have learned: