Linux Important files
/etc:
/etc/hosts
– Stores IP addresses and their corresponding hostname plus any aliases.
/etc/hosts.allow and /etc/hosts.deny
– list machines which are allowed or denied use of network services.
/etc/HOSTNAME or /etc/hostname
– contains the hostname for the local system.
/etc/aliases
– used to create mail aliases. Mail for root can be forwarded to another mail account.
/etc/auto.*
– database files for the automounter daemon.
/etc/cron.*
– store daily, weekly, etc. cron jobs.
/etc/ftp*
– allows system administrator to define who can ftp to and from machine. Also define which machines can be used to access local ftp server.
/etc/httpd
– contain configuration and log directories for the Apache Web Server.
/etc/inittab
– define run levels; defines the default runlevel as 3.
/etc/dumpdates
– contains information on when each partition was backed up using the dump command.
/etc/lilo.conf
– Boot loader configuration file.
/etc/motd
– Message Of The Day – message which is displayed when user logs into the system. Maybe a warning message on usage or a funny message.
/etc/passwd
– contains user account information. Readable by everyone.
/etc/shadow
– contains actually passwords if using shadow passwords. Readable only by root.
/etc/sendmail.*
– sendmail configuration files.
/etc/sysconfig
– system configuration files, i.e. pcmcia, network, etc.
/etc/fstab
– file system table – define partitions and their mount points.
/etc/rc.d
– directory which contains system startup scripts.
/etc/services
– enable/disable network services. Can be used to disable ftp services or finger services, etc.
/var:
/var/log/messages
– System message files. View using any method used to view ascii files.
/var/log/lastlog
– Stores information on the last time each user logged into the system. Only viewable using the `last command`.
/var/log/httpd
– Stores log files for web server
/var/log/htmlaccess.log
– Stores information on who is accessing your server.
/var/log/dmesg
– System information. Info on hardware errors and messages seen during boot. View using the `dmesg` command.
/var/log/samba
– Directory containing log files for the Samba Server (Allows Window based machines to access data on UNIX machines).
/var/spool/mail
– contains mailbox files for each user. Created automatically when user account is created.
/var/spool/lpd/
– Printer spooler directory.
is created when you define your printer. Printers can be local or remote.
/var/spool/cron
– Directory contains crontab entries when created by users.
Mounting and Unmounting File Systems
– To mount a file system in the Linux directory tree, you must have a physical disk partition, CD-ROM, or floppy that you want to mount.
– You must also make sure that the directory to which you want to attach the file system, known as the mount point, actually exists.
– The mount point must exist before you try to mount the file system.
– Lets say you want to mount your Red Hat 6.2 CD:
– first, insert the CD into the CD-ROM drive
– then, as root, use the command: mount /dev/hdc /mnt/cdrom
– /dev/hdc = the device name for your CD-ROM drive
– /mnt/cdrom = the mount point. It is an empty directory that was created just for mounting your CD-ROM.
– Now when you want to read files from your CD-ROM, you will access it via the mount point, /mnt/cdrom. The system actually reads the date from /dev/hdc.
– Notice how /mnt/cdrom appears to be a part of the / file system. However, / is a hard disk partition and /mnt/cdrom is on your CD-ROM drive.
– The mount command is used to mount a disk and make it available for use.
– The umount command is used to dismount or un-mount a disk partition or CD-ROM. For example, to unmount the CD-ROM so you can eject the disk: umount /mnt/cdrom
– mount command options:
– -t type: specify the type of file system used on the device we are about to mount. Types include ext2 (linux native), msdos (MS-DOS), vfat (Windows 9x), ntfs (New Technology file system for WindowsNT), and iso9660(CD-ROM)just to name a few.
– Linux attempts to automatically determine the file system type. But it can not, then you must specify the type.
– -o list_of_options: These options allow you to mount the disk as read-only, read/write, whether root can access the data from a remote system(Not secure) and other things. Use the man command to find out more about mount’s options.
Mounting systems as boot time
– File systems that will be used all of the time should be mounted at boot time. For example, the / directory must be mounted when every we boot the system. If /home is on a separate disk, then it must be mounted before users log into the system. Or else, people can log in, but they have no home directory.
– /etc/fstab is the configuration file that defines which disk should be mounted and where (mount point).
– Fields in /etc/fstab:
– File System: Specifies the block device to be mounted from local or remote system.
– Mount Point: Specifies the mount point directory. For swap, this would be the word none.
– Type: Specify the type of file system being mounted.
– Mount options: comma-separated list of mount options.
– Dump Frequency: how often should the file system be backed up by the dump command.
– Pass Number: Specifies the order in which file systems should be checked by the fsck command when the system is booted. For / the value is 1, for all others (local only) the value is 2. NEVER check remote file systems.
– There is no mount point for swap partitions and the type is swap.
– The umount command unmounts a disk partition or CD-ROM. You can not remove, removable media until the drive has been unmounted. If you mount your CD-ROM, then push the button on the door, nothing happens. After unmounting the drive, then you can open the drive door.