File System; etc, mnt, proc, tmp

 Back  File System  Next


 etc This directory contains directories and files that are used for system configuration. Used by all users, and program support. Based on these records, and the user's directory can be copied and create a user configuration file on the principle of preparing a sample configuration in [/etc]. At first layout view very awkward, but it is very useful to nearly all separated into discrete units and if he makes a mistake in setting up some configuration files, does not violate the consistency of the system. Before setting a configuration file is well original copy somewhere. Windows OS it holds together in a single database called the 'registry'. So two completely opposite concepts. There's one important difference: in this directory configuration files are never automatically complemented with facilities that are not directly related to the operation of the system while the 'registry' can remember all such as the last place made downloading any file so it will remember and address some 'naughty' site and what action to take, you can easily abuse inadvertently download malicious programs whose presence in the system user in most cases, does not notice.

What is important to emphasize that all the files in this directory text files in ASCII code, and that is by changing the configuration of the corresponding process (service) can be stopped and restarted to load the new configuration. If the client software requires more than one configuration file, then everything belonging to it in a separate directory. The following is a list that is a small part of what this directory contains what may be the most important to use the system, after everything is set during installation.

 voda:/etc# ls -alh
 total 492K
drwxr-xr-x 52 root root 4.0K 2010-08-01 00:34 .
drwxr-xr-x 21 root root 4.0K 2010-04-18 11:44 ..
drwxr-xr-x 3 root root 4.0K 2010-04-18 11:44 acpi
-rw-r--r-- 1 root root 3.0K 2010-04-18 11:43 adduser.conf
: drwxr-xr-x 4 root root 4.0K 2010-07-31 22:01 apt
-rw-r--r-- 1 root root 1.5K 2008-05-12 21:02 bash.bashrc
:
drwxr-sr-x 2 root bind 4.0K 2010-07-31 22:13 bind
:
drwxr-xr-x 2 root root 4.0K 2010-04-18 11:43 cron.d
drwxr-xr-x 2 root root 4.0K 2010-07-31 22:01 cron.daily
drwxr-xr-x 2 root root 4.0K 2010-04-18 11:43 cron.hourly
drwxr-xr-x 2 root root 4.0K 2010-04-18 11:43 cron.monthly
-rw-r--r-- 1 root root 724 2008-09-28 11:33 crontab
drwxr-xr-x 2 root root 4.0K 2010-04-18 11:43 cron.weekly
:
-rw-r--r-- 1 root root 6 2010-06-18 17:12 debian_version
drwxr-xr-x 2 root root 4.0K 2010-07-31 22:17 default
:
-rw-r--r-- 1 root root 455 2010-04-18 11:41 fstab
:
-rw-r--r-- 1 root root 543 2010-07-31 22:17 group
-rw------- 1 root root 532 2010-04-18 11:56 group-
-rw-r----- 1 root shadow 455 2010-07-31 22:17 gshadow
-rw------- 1 root root 447 2010-04-18 11:56 gshadow-
-rw-r--r-- 1 root root 9 2006-08-07 19:14 host.conf
-rw-r--r-- 1 root root 5 2010-04-18 11:43 hostname
-rw-r--r-- 1 root root 259 2010-04-18 11:43 hosts
-rw-r--r-- 1 root root 579 2010-04-18 11:43 hosts.allow
-rw-r--r-- 1 root root 878 2010-04-18 11:43 hosts.deny
drwxr-xr-x 2 root root 4.0K 2010-07-31 22:17 init.d
:
-rw-r--r-- 1 root root 2.0K 2008-08-12 16:09 inittab
:

-rw-r--r-- 1 root root 909 2010-07-31 22:17 passwd
-rw------- 1 root root 909 2010-07-31 22:17 passwd-
:
drwxr-xr-x 2 root root 4.0K 2010-04-18 11:55 rc0.d
drwxr-xr-x 2 root root 4.0K 2010-07-31 22:17 rc1.d
drwxr-xr-x 2 root root 4.0K 2010-07-31 22:17 rc2.d
drwxr-xr-x 2 root root 4.0K 2010-07-31 22:17 rc3.d
drwxr-xr-x 2 root root 4.0K 2010-07-31 22:17 rc4.d
drwxr-xr-x 2 root root 4.0K 2010-07-31 22:17 rc5.d
drwxr-xr-x 2 root root 4.0K 2010-04-18 11:55 rc6.d
-rwxr-xr-x 1 root root 306 2010-04-18 11:42 rc.local
drwxr-xr-x 2 root root 4.0K 2010-07-31 22:17 rcS.d
-rw-r--r-- 1 root root 48 2010-08-01 00:34 resolv.conf
:
-rw-r----- 1 root shadow 649 2010-07-31 22:17 shadow
-rw------- 1 root root 649 2010-07-31 22:17 shadow-
-rw-r--r-- 1 root root 155 2010-04-18 11:42 shells
:
drwxr-xr-x 4 root root 4.0K 2010-07-31 22:17 X11 voda:/etc#

Directory [bind] contains information describing how they see computers in the network, or the computer name associated with the domain name entered here is the IP address assigned to them, and also information about the supervisor a directory server (name server) that this server has a similar list . So here is the plan the local network. Changes to the 'Getting Started' restart the associated service as follows:

 voda:/# /etc/init.d/bind9 restart
 Stopping domain name service...: bind.
 Starting domain name service...: bind.
 voda:/#

The script can be run from the directory in which there is:

 voda:/# cd /etc/init.d
 voda:/etc/init.d#
 voda:/etc/init.d# ./bind9 restart
 Stopping domain name service...: bind.
 Starting domain name service...: bind.
 voda:/etc/init.d#

The directory [init.d] are scripts that are used to start or stop a particular service and the previous example is the use of one of them, and answered the given at its execution. Each script is a list of commands that interprets the shell and its starting and ending looks something like this:

 voda:/etc/init.d# cat apache2 
 #!/bin/sh -e
 #
 # apache2               This init.d script is used to start apache2.
 #                       It basically just calls apache2ctl.
 #
 ENV='env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin'
      :
      :
   if $APACHE2CTL start; then
     log_end_msg 0
   else
     log_end_msg 1
   fi
 ;;
 *)
 log_success_msg 'Usage: /etc/init.d/apache2 {start|stop|restart|reload|force-reload}'
 ;;
 esac
 voda:/etc/init.d#

First line scripts, painted in purple, indicating where the executable file shell that will interpret the commands strung. In this case the ' sh ' shell that will be used, and it is in fact a symbolic link towards the bash file. The red color shows the arguments that can be used when using scripts. All scripts have such a large number of available arguments. At the scripts in the directory [init.d] leads links from directories [rc0.d] to [rcS.d]. The name of the directory indicates that they are associated with the levels of usability of a computer as described in Chapter 5.1.1. Some content such as directory [rc1.d] is:

 voda:/etc/rc1.d# ls -alh
 total 12K
drwxr-xr-x 2 root root 4.0K 2010-07-31 22:17 .
drwxr-xr-x 52 root root 4.0K 2010-08-01 00:34 ..
lrwxrwxrwx 1 root root 14 2010-04-18 11:43 K11cron -> ../init.d/cron
lrwxrwxrwx 1 root root 13 2010-07-31 22:17 K84ssh -> ../init.d/ssh
lrwxrwxrwx 1 root root 15 2010-04-18 11:55 K85bind9 -> ../init.d/bind9
lrwxrwxrwx 1 root root 16 2010-04-18 11:55 K85lwresd -> ../init.d/lwresd
lrwxrwxrwx 1 root root 15 2010-04-18 11:44 K88acpid -> ../init.d/acpid
lrwxrwxrwx 1 root root 17 2010-04-18 11:43 K90rsyslog -> ../init.d/rsyslog
-rw-r--r-- 1 root root 369 2007-12-23 12:04 README
lrwxrwxrwx 1 root root 19 2010-04-18 11:42 S30killprocs -> ../init.d/killprocs
lrwxrwxrwx 1 root root 16 2010-04-18 11:42 S90single -> ../init.d/single
voda:/etc/rc2.d#

If the task command ' init 1 ' sequentially run scripts in the directory [rc1.d] that begin with the letter ' S ', and if you leave this level execute scripts that begin with the letter ' K '. If there is a need to prevent the execution of any script should change her name, the best change of the first big names in small letters. Of course should read what it says in the README file :-). inittab file defines the levels of usability of the system and the programs that are active in them. This is essentially a configuration file that defines what will work the command ' init ' at turn-on the computer.

 voda:/etc# cat inittab
 # /etc/inittab: init(8) configuration.
 # $Id: inittab,v 1.91 2002/01/25 13:35:21 miquels Exp $
 # The default runlevel.
 id:2:initdefault:
 # Boot-time system configuration/initialization script.
 # This is run first except when booting in emergency (-b) mode.
 si::sysinit:/etc/init.d/rcS
 # What to do in single-user mode.
 ~~:S:wait:/sbin/sulogin
 # /etc/init.d executes the S and K scripts upon change
 # of runlevel.
 #
 # Runlevel 0 is halt.
 # Runlevel 1 is single-user.
 # Runlevels 2-5 are multi-user.
 # Runlevel 6 is reboot.
	     :
      :
 voda:/etc#

The file /etc/debian_version contain information 5.0.5, five ASCII characters. It should be noted that the file name is composed of two words apart by ' _ '. It is not advisable to use the 'SPACE' character in filenames.

Contents of the file /etc/fstab already demonstrates the examples in Figure 5.1.1 and 5.1.6. List of partitions to be mounted on a PC.

hostname file keeps information about the name of the computer, and the file networks and interfaces files in the directory [network] show how to adjust the parameters of an Ethernet network card. All, as has already been said in the text files that are marked by ' # ', comments can be added without having to memorize that amendments made.

 voda:/etc# cat hostname
 voda                                 (name of the computer)
 voda:/etc#
 voda:/etc# cat networks
 default         0.0.0.0
loopback 127.0.0.0
link-local 169.254.0.0 (APIPA - automatic generation of DHCP settings) localnet 192.168.0.0 (address of computers on the network)
voda:/etc# voda:/etc# cat network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface allow-hotplug eth0 iface eth0 inet static address 192.168.0.11 network 192.168.0.0 netmask 255.255.255.0 gateway 192.168.0.1 voda:/etc#

Data in the configuration files related to the host name and network settings may be necessary to change. The new values will become active after the computer is restarted, the commands ' reboot ' or ' init 0 '. The computer turns-off with commands ' halt ' or ' init 6 '.

User data contain files passwd, shadow, group and gshadow, of which each has a backup copy of the file of the same name that ends with ' - '. Passwd file contains user information classified by categories that are mutually separated by ' : ', as in the following example for a server.

 mak:/etc# cat passwd | more
 root:x:0:0:root:/root:/usr/bin/tcsh
 daemon:x:1:1:daemon:/usr/sbin:/bin/sh
 bin:x:2:2:bin:/bin:/bin/sh
 sys:x:3:3:sys:/dev:/bin/sh
 sync:x:4:65534:sync:/bin:/bin/sync
 games:x:5:60:games:/usr/games:/bin/sh
 man:x:6:12:man:/var/cache/man:/bin/sh
 lp:x:7:7:lp:/var/spool/lpd:/bin/sh
 mail:x:8:8:mail:/var/mail:/bin/sh
     :
 pempl:x:3001:201:Protouser Employee,employee:/home/pempl:/bin/false
 pstud:x:3002:202:Protouser Student,student:/home/pstud:/bin/false
 pgrad:x:3003:203:Protouser Post_graduate,post_graduate:/home/pgrad:/bin/false
 passoc:x:3004:204:Protouser Associate,associate:/home/passoc:/bin/false
 pispnet:x:3005:205:Protouser ISP,isp:/home/ispnet:/bin/false
     :
 eni:x:5001:201:Eni Generalic,employee:/home/eni:/bin/bash
 drago:x:5002:201:Drago Radic,employee:/home/drago:/bin/tcsh
     :
 mak:/etc#

From the passwd file for that service or useful to read - USER_NAME: password tag existence: a User ID (UID): Group ID (GID): a description that contains the user name and surname: working directory: type shells used. From the list you can see using a user 'Drago' subsequently installed tcsh (The exTended C-SHell) shell different options from the default bash shell. In order to protect certain services and inactive users shell is disabled (false). Names tcsh, bash and false are executable files in [/bin] directory representing the command interpreters (shell) with different characteristics. Similarly organized shadow file that describes - USER_NAME: encryption method ($1$ indicates the MD5 encryption method) and the encrypted password: : where ' x ' number of days from 01.01.1970. was related to various time features password (Shadow Man):

 mak:/etc# cat shadow | more
 root:$1$zzzzzzzzzzz....zzzzzzzzzz:13443:0:99999:7:::
 daemon:*:12398:0:99999:7:::
 bin:*:12398:0:99999:7:::
 sys:*:12398:0:99999:7:::
 sync:*:12398:0:99999:7:::
 games:*:12398:0:99999:7:::
 man:*:12398:0:99999:7:::
 lp:*:12398:0:99999:7:::
 mail:*:12398:0:99999:7:::
     :
 pempl:*LK*:12500:::::20000:
 pstud:*LK*:12500:::::20000:
 pgrad:*LK*:12500:::::20000:
 passoc:*LK*:12500:::::20000:
 pispnet:*LK*:12500:::::20000:
     :
 eni:$1$xxxxxxxxx....xxxxxxxxxx:12500:::::20000:
 drago:$1$xxxxxxxxx....xxxxxxxxxx:14000:::::20000:
     :
 mak:/etc#

If the password is in place or in front of her characters ' * ' or ' ! ' means that the accounting services locked. It is wise not to leave this place empty :-). Number 14'000 means that in this field the date May 01 2008th year. The difference in dates is easily converted into the number of days using a spreadsheet (EXCEL for example).

The file group contains information about the group membership of a user or a service. When opening an account is opened group ID and group belonging to the user. Thus, every user has his own group. Group can be password protected (sign ' x ') in the file gshadow and its copy protection. Default 'account' groups are disabled and this option is rarely used.

 mak:/etc# cat group | more
 root:x:0:
 daemon:x:1:
 bin:x:2:
 sys:x:3:
 adm:x:4:logcheck
 tty:x:5:
 disk:x:6:
 lp:x:7:lp
 mail:x:8:dovecot
     :
 www-data:x:33:drago,eni,jagoda
     :
 empl::201:drago
 stud::202:drago
 grad::203:drago
 assoc::204:drago
 ispnet::205:drago
     :
 mak:/etc#

Administration is quite inconvenient to maintain for each user's group, and prefer to use the solution to declare the status of the user groups in the middle. So in the example in Figure prepared five groups (GID 201-205) and a new user account when creating joins one of them, according to the template for that group. Group can contain multiple members or groups as given in the example for the group ' www-data '. Administrator is assigned to each sample the group for ease of maintenance.

Each server contains the SOA record in the files hosts.db and hosts.rev that identifies the network, and the computers that belong to (alpha, beta ...). The first file contains the following:

mak:/# cat /etc/bind/hosts.db
$TTL 86400
@       SOA     mak.ktf-split.hr.       hostmaster.mak.ktf-split.hr.    (
        2010051001      ; Serial number as date and two digit number - YYMMDDXX
        28800           ; Refresh in seconds - 28800 = 8 Hours
        7200            ; Retry in seconds - 7200 = 2 Hours
        604800          ; Expire in seconds - 3600000 = 1 Week
        86400   )       ; Minimum TTL in seconds - 86400 = 24 Hours
                NS      mak.ktf-split.hr.
                NS      duje.st.carnet.hr.
                NS      bjesomar.srce.hr.
localhost       A       127.0.0.1
bindmaster      CNAME   mak
dns             CNAME   mak
www             CNAME   mak
proxy           CNAME   mak
mail            CNAME   mak
smtp            CNAME   mak
pop             CNAME   mak
ftp             CNAME   mak
ntp             CNAME   mak
;
ktf-split.hr.   MX      5       mak
;
; %HOSTS_START%
;
alfa            IN      A       161.53.32.100
beta            IN      A       161.53.32.200
;
; %HOSTS_END%

The second file contains records that allow your computer to the list (alpha, beta ...) IP address:

mak:/# cat /etc/bind/hosts.rev
$TTL 86400
@       SOA     mak.ktf-split.hr.       hostmaster.mak.ktf-split.hr.    (
        2010051001      ; Serial number as date and two digit number - YYMMDDXX
        28800           ; Refresh in seconds - 28800 = 8 Hours
        7200            ; Retry in seconds - 7200 = 2 Hours
        604800          ; Expire in seconds - 3600000 = 1 Week
        86400   )       ; Minimum TTL in seconds - 86400 = 24 Hours
                NS      mak.ktf-split.hr.
                NS      duje.st.carnet.hr.
                NS      bjesomar.srce.hr.
;
; %HOSTS_START%
;
100     IN      PTR     alfa.ktf-split.hr.
200     IN      PTR     beta.ktf-split.hr.
;
; %HOSTS_END%

Header both files is the same and it is a basic feature of the server where the DNS system subordinate. In the event of changes in the content of any of these files XX should be increased by one if the changes are the same day, or change YYMMDD if the changes do not work the same day.

 mnt This directory is basically empty, but is intended as a default location for the point of attachment (mount point), to which is mounted a non-standard file systems, or devices that support such systems as: floppy disk, CD / DVD player, USB devices, Windows partition , OS/2 partition or something like that. It has been said that the file systems are incorporated into the core, and the rest can be retrieved if they have installed the available modules.

 voda:/mnt# ls -alh
 total 8.0K
 drwxr-xr-x  2 root root 4.0K 2010-01-25 04:41 .
 drwxr-xr-x 21 root root 4.0K 2010-04-18 11:44 ..
 voda:/mnt#

Some operating systems for this purpose we use prepared mount points in the directory [/media], for example:

 voda:/media# ls -alh
 total 16K
 drwxr-xr-x  4 root root 4.0K 2010-04-18 11:41 .
 drwxr-xr-x 21 root root 4.0K 2010-04-18 11:44 ..
 lrwxrwxrwx  1 root root    6 2010-04-18 11:41 cdrom -> cdrom0
 drwxr-xr-x  2 root root 4.0K 2010-04-18 11:41 cdrom0
 lrwxrwxrwx  1 root root    7 2010-04-18 11:41 floppy -> floppy0
 drwxr-xr-x  2 root root 4.0K 2010-04-18 11:41 floppy0
 voda:/media#

When for instance a CD media attaches to this directory [/mnt] or it created a directory, the entry in the directory that 'holding' mounted device can read the contents of the media in the device. On the other hand, if the graphic is inserted music CD into the unit through the connection point of the already prepared in the directory [/media] content CD immediately available for listening through appropriate applications. Media content can be read by the example of entering the subdirectory [cdrom0] and [floppy0], of course, if the media is inserted into the device.


Example III

Connect USB Stick (device) to computer.

Because this action is affecting the system itself can be conducted only by an administrator. When the stick is connected, follows his recognition as a unit-disk and be presented to the messages that follow in his identification to determine how the device is recognized ('sda' or 'sdb' or some other name). When the stick plugged in, and is recognized as a device that could be retrieved ga 'linked' to a directory, eg ' mnt ', whether it exists or it shall first make directory command ' mkdir ' with the specified name or another name at will .

   mount device_name mount_point         (basic syntax)

   voda:~# cd /                          (order to move to the root of a directory structure)
   voda:/#
   voda:/# mkdir mnt                     (making of directory if not already created
                                          when installing the operating system)
   voda:/# mount /dev/sdb /mnt           (joining device 'sdb' to directory mnt')
   voda:/# cd /mnt                       (move to the associated device)
   voda:/mnt#

Now they were available all content stick and can be read by the command ' ls ', copy its contents, or copy the contents of the command ' cp ', or execute a file or script with his command ' ./name_of executable_file_or_script'. Mark. ' ./ ' is interpreted as 'done here'. Described actions can be performed only by a user with administrator rights, as seen according the prompt ' # '. Prompt of user is ' ~ '.

When the device is no longer required 'detached' by command ' umount ':

   voda:/# umount /dev/sdb/

It is no problem if the stick is formatted as '  FAT 32 ' file system, because across available modules of Linux core device is orderly recognized. This means that the contents of the stick can be processed on a computer with a Windows operating system.

 proc Virtual file system, consisting of directories and files that are recorded in the kernel and process status as text files. Used to be able to access data and incorporated into the core as Interrupt (IRQ) that recognizes the core, the data of all available channels of DMA, the data on all configured I / O channels, statistical information about network sockets, some environment variables the first process (1) and so forth. An example of the entries in this directory is:

 voda:/proc# ls -alh
 total 4.0K
 dr-xr-xr-x 54 root  root     0 2010-07-31 21:08 .
 drwxr-xr-x 21 root  root  4.0K 2010-04-18 11:44 ..
 dr-xr-xr-x  7 root  root     0 2010-07-31 22:13 1
 dr-xr-xr-x  7 root  root     0 2010-07-31 22:13 1100
 dr-xr-xr-x  7 root  root     0 2010-07-31 22:13 1140
 dr-xr-xr-x  7 root  root     0 2010-07-31 22:13 131
     :
 dr-xr-xr-x  4 root  root     0 2010-08-01 01:41 tty
 -r--r--r--  1 root  root     0 2010-08-01 01:41 uptime
 -r--r--r--  1 root  root     0 2010-08-01 01:41 version
 -r--------  1 root  root     0 2010-08-01 01:41 vmallocinfo
 -r--r--r--  1 root  root     0 2010-08-01 01:41 vmstat
 -r--r--r--  1 root  root     0 2010-08-01 01:41 zoneinfo
 voda:/proc#

The number in the last column is the ID of the process and if you look at the process of active directory to see exactly what was being launched and when. A real little sign of the process. What should be noted is that this data is constantly changing and updated, and that does not take up much space, you can see the size of the directory to Figure 5.1.2b. Although the majority of the files in a display size ' 0 ', the actual size of their few bytes and must not be deleted because they contain information that argument values for variables with which the system serves. According to them, have the name of the file according to their content determines the behavior of the system. Thus, a virtual file system (file system) with information of processes.

 tmp This directory contains temporary files created by the program support in their work for their needs. It is the storehouse of the current situation regarding the use of program support all users. Write privileges on it have all but the content in it, except an administrator, it is available only to those who create the content.

 voda:/tmp# ls -al
 total 24K
 drwxrwxrwt  6 root  root  4.0K 2010-08-01 01:43 .
 drwxr-xr-x 21 root  root  4.0K 2010-04-18 11:44 ..
 drwxrwxrwt  2 root  root  4.0K 2010-07-31 22:17 .ICE-unix
 drwx------  2 root  root  4.0K 2010-08-01 01:43 mc-root
 drwx------  2 drago drago 4.0K 2010-07-31 22:39 ssh-oXxRlh7661
 drwxrwxrwt  2 root  root  4.0K 2010-07-31 22:17 .X11-unix
 voda:/tmp#

This directory contains temporary files created by the program support in their work for their needs. This warehouse is currently preserved parameters of program support all users. During the restart of the computer the contents of this directory is deleted and is ready to accept new records. But at the server size of this partition is not large and is usually filled in quite a bit. The reason given is that the regular 'clean' script that runs under given conditions in the configuration files (cron jobs), for example age and quantitative examination of files or simply periodic deletion. Therefore, this directory is always nice to use if you want to take on such a package without its installation, so that in this directory 'unpacked' and had access to its contents, without fear that it will lead to its filling the space, there is no need to take care of Unpacked it to erase the content immediately. Thus, a temporary workspace.


 Back
 Search
 Next

 Content - Home
 Content  Informatics Alphabet
 
Citing this page:
Radic, Drago. " IT - Informatics Alphabet " Split-Croatia.
{Date of access}. <http://www.informatics.buzdo.com/>.
Copyright © by Drago Radic. All rights reserved. | Disclaimer