OS2 Introduction
OS2 Introduction
1. ssh 1
2. scp 1
Introduction
These introductory guide contains brief descriptions of the tools whose knowledge will be necessary
for the efficient implementation of tasks within the laboratories of Operating Systems 2. Each team will
be assigned a virtual machine that will need to be operated from the console, therefore it is necessary
to remember the basic commands of the system shell. These commands will not be described in these
guides. Section 1 describes how to use the ssh (Secure Shell) command, Section 2 presents the scp
(Secure Copy) command, and Section 3 refers to the use of the Linux Cross Reference service.
1. ssh
The ssh command is used for working with the remote computer. This work is done using a system
shell (console), and the network traffic is encrypted. In case of laboratory classes, the remote computer is
a virtual machine. To connect to it, issue the following command in a local computer terminal or console:
ssh [email protected] -p X
The so2 in the command is a username, 81.26.20.32 is an IP address of virtual machine server, and
X is a port number. Every team will have a separate virtual machine assigned. The port numbers used by
the machines will be given by the person conducting the laboratory classes. When the command is issued,
the remote system will ask for the password. Enter the password provided by the person conducting the
laboratory. While typing the password, no characters will appear on the screen until the Enter button
is pressed. Please note, that You can connect to the virtual machine only from within the Department
of Information Systems internal network, provided the machine is on.
The command allows You to log as the so2 user. This account has limited privileges. To load or
unload a kernel module, what is essential to accomplish tasks from laboratory guides, You need to log
to the root account, using the following command:
su -
The system will ask for the root user password, which also will be given by the person conducting
the laboratory. If the password is valid, then You will be granted access to an account that allows You
to administrative operations, including those mentioned earlier.
It is also possible to log in as the root using another command:
sudo su -
This time, the system will ask for the so2 user password, not the root one. If it is valid, You will
also be granted access to the root account.
The sudo command has more applications. Generally, it is uses to perform privileged commands
by an unprivileged user. However, these cannot be any commands. They should have been previously
specified for that user by the root.
2. scp
The scp command belongs to the same package as ssh. It allows the user to copy files between a
local and a remote computer. Copying of the file named source.c located in the current directory on
the local machine, to the home directory of the so2 user on the remote virtual machine on the X port,
can be done using the following command:
scp -P X source.c [email protected]:~
1
Please note the „ : ” character after the ip address followed by the directory name. In this case, it is
the user’s home directory, which in Linux is denoted with a tilde character (~). Should the destination
directory be lab1, located inside the home directory, then the command would have to be:
scp -P X source.c [email protected]:~/lab1
The remote system will ask for the so2 user password, just like in the case of ssh.
Similarly, files can be copied in the opposite direction. For example, to copy a file named Makefile
from the home directory of the so2 user at the virtual machine, to the local computer current directory,
issue the following command:
scp -P X [email protected]:~/Makefile .
The dot at the end of the command denotes the current directory. Please note, that the order of scp
arguments is the same, as in the case of the cp command, used for copying files localy.
There are two ways to copy the entire directory to a remote system. Suppose this directory is called
sources and is a subdirectory of the current directory. The first way is to use the -r option of the scp
command, which recursively copies the directory:
scp -P X -r sources [email protected]:~
In the second method, the directory should be first compressed, e.g. with the tar command. It can
be done as follows:
tar jcvf sources.tar.bz2 sources,
where sources.tar.bz2 is the name of the output file being a compressed archive of the sources
directory. After copying it to a remote computer, its contents can be extracted with the command:
tar xvf sources.tar.bz2
2
Figure 1: Main page of the Linux Cross Reference service
3
Figure 3: Detailed menu for choosing the kernel source version
4
Figure 5: Results of the name search
5
Figure 7: Definition of the schedule() function