As with any other operating system, administration efforts are necessary for any linux system. These include the following tasks:
Linux is a multi user environment which means it is optimized to receive multiple user sessions at the same time (many people can connect and interact with the system at the same time). Therefore, carefully adding, deleting, and modifying users is necessary. You can add and delete users using Linuxconf.
Adding users can also be done using the adduser shell command.
Linuxconf will also let you modify each of your user accounts.
If you want to modify a user’s password using the shell, simply type passwd
Group management is also possible using Linuxconf
Surfing the File System
Before giving out permissions to files, you need to be able to navigate through the file system. The first command you might want to use is the pwd command. This will tell you the folder in which you are currently working in.
To list a folder’s contents type the ls command. Typing ls -l will display additional attributes about each file and directory including permissions, file type, size, owner, date and date last modified. For more information on the LS command, type man ls.
The mv command renames and moves files.
The rm command removes files
To move from a directory to another use the cd command. This command, like many others in Linux, is not far from the ones found in MS-DOS. However it is a bit pickier on syntax. To jump back to the root of the file system, type the cd / command. To move up a directory, type cd .. (make sure to put a space between cd and ..). To move to a specific directory, type cd
Using the Super User command
Before you can change file permissions, you need to understand that Linux is a very secure environment. It is recommended to avoid logging in as the root user. Using a regular account you can do most administrative tasks. Whenever privileged use is necessary, simply type the su command. You will then be prompted for the root password and voila! The moment you are done with your tasks, type the exit command to stop being a super user.
Managing File Permissions
Because Linux is a multi-user environment (it allows multiple user to connect to one machine in order to access resources), it is important to secure its resources. To view the different permissions associated to files, type the ls –l command.
It is absolutely vital that you understand how the permissions work. The permissions are identified by the first column of characters. Every letter has a specific meaning. The rights column can be interpreted the following way:
Object type Group rights Owner of file rights Others’ rights
Character 1 Characters 2-4 Characters 5-7 Characters 8-10
d = directory
l = link
- = file r = read
w = write
x = execute r = read
w = write
x = execute r = read
w = write
x = execute
A missing permission is represented by a dash (-).
Permissions are given values.
* Read = 4
* Write = 2
* Execute = 1
The command used to give those values is chmod. To give read write and execute to an owner, read and execute to groups and others for a specific file you would type chmod 755
You can also use chown to change the owner of a file and chgrp to change a file’s group.
Accessing file systems and related devices
In order to use a disk device, it needs to be active or “mounted”. The mount or df command will enable you to see which disks are mounted.
Figure 5.13 – The Mount command gives you the mount points and device status
This indicates which disks are currently active. The mount command activates on startup. You can access most devices starting with the root. Removable devices will be placed under the /mnt folder. However, if you want to mount a different cd drive without rebooting the system, you will need to mount it.
To unmount a device, use the umount command.
Managing Remote Systems
Linux is a great system when it comes to doing remote administration. You can connect to a remote system using many different techniques. Here are the most common ones:
* Telnet: This command will enable you to connect to another computer and establish a shell session. You will then be able to enter commands just as if you were directly in front of the remote computer.
* Ssh: ssh is more or less the same thing as telnet except it is a more secure way of doing it. Telnet uses clear text authentication and no encryption. Ssh is using a more secure authentication mechanism that can even use security public certificates and it then encrypts the whole session.
* Ftp: The ftp command enables you to connect to a ftp server enabled machine and manage files. This is a very common technique on the internet and most people don’t really know about its potential. Ftp stands for File Transfer Protocol and can move files from one computer to another. It contains many commands that you should have basic knowledge of.
* You can also redirect an Xwindows session or use a remote desktop software like AT&T’s VNC.
Runlevels and init
Think of runlevels as different modes in which linux can operate (just as windows can start in safe mode or regular mode). A runlevel is defined when the computer starts up. When it boots, Linux starts the kernel which loads a first process called init. This process monitors the system run state and then consults the init table (located at /etc/inittab) to start daemons and the other processes. The init table file contains information on the runlevel. There are 7 levels:
And as you can see, the default is set to 3. Setting the level to halt or reboot will force the computer to shutdown or reboot upon startup (which is not a very good idea unless you want to make a bad prank).
To edit the different Linux configuration files, a simple text editor will do the job. Linux includes many of these. You should know the most popular of them and their basic functions. VI and EMACS are amongst the most widely used of these tools. To start either of them simply type vi or emacs at the shell.
Using the VI text editor
A very important aspect of the Linux file system is to create, edit and save system configuration files. One way to do this is to use the VI text editor. To edit a file, type vi
Figure 5.15 – Either VI or VIM will be invoked by the VI command. Both are good text editors
To learn more about VI, I recommend reading the man vi output or reading Using the VI Text Editor
Using the Graphical User Interface
To start the graphical user interface from the shell, type the startx command. Navigating through the GUI is much like Windows nowadays. You will encounter specific functions depending on the distribution and desktop environment you’ve chosen.
Figure 5.16 – A nicely customized KDE desktop in action. Picture courtesy of Sean Parsons.
I recommend you practice using the KDE and Gnome environments before taking the test.
Basic Shell Scripting
The most powerful feature of Linux is its scripting possibilities. It is assumed that you have reasonable knowledge of common script commands in order to pass the Linux+ exam. Here are the main scripting commands that you can use:
* Find : As its name implies, the find command is used to locate different files, folders, etc.
* grep: This command is useful to search for text contained within files. The output can be put into files, etc. This can be very useful to automate log scavenging and inspection.
* cut: This is used to be more specific within your searches, to filter the elements you are looking for, etc.
* if: The if command is also used to screen out information by providing conditions.