Linux Installation: Welcome To Red Hat Enterprise Linux
Linux Installation: Welcome To Red Hat Enterprise Linux
The Welcome screen does not prompt you for any input. Read over the help text in the left panel for
additional instructions and information on where to register your Red Hat Enterprise Linux product.
Notice the Hide Help button at the bottom left corner of the screen. The help screen is open by
default. To minimize the help text, click on Hide Help.
Language Selection
Using your mouse, select a language to use for the installation. Selecting the appropriate language
also helps target your time zone configuration later in the installation. The installation program tries to
define the appropriate time zone based on what you specify on this screen.
On this screen, you can choose to perform automatic partitioning, or manual partitioning using Disk
Druid.
Automatic partitioning allows you to perform an installation without having to partition your drive(s)
yourself. If you do not feel comfortable with partitioning your system, it is recommended that you do
not choose to partition manually and instead let the installation program partition for you.
The partitioning tool used by the installation program is Disk Druid. With the exception of certain
esoteric situations, Disk Druid can handle the partitioning requirements for a typical installation.
These buttons control Disk Druid's actions. They are used to change the attributes of a partition (for
example the file system type and mount point) and also to create RAID devices. Buttons on this
screen are also used to accept the changes you have made, or to exit Disk Druid. For further
explanation, take a look at each button in order:
Edit: Used to modify attributes of the partition currently selected in the Partitions section.
Selecting Edit opens a dialog box. Some or all of the fields can be edited, depending on whether the
partition information has already been written to disk.
have created two or more software RAID partitions, select Make RAID to join the software RAID
partitions into a RAID device.
Partition Fields
Above the partition hierarchy are labels which present information about the partitions you are
creating. The labels are defined as follows:
o Mount Point/RAID/Volume: A mount point is the location within the directory hierarchy at
which a volume exists; the volume is "mounted" at this location. This field indicates where the
partition is mounted. If a partition exists, but is not set, then you need to define its mount
point. Double-click on the partition or click the Edit button.
o Type: This field shows the partition's file system type (for example, ext2 or ext3).
o Format: This field shows if the partition being created will be formatted.
o Size (MB): This field shows the partition's size (in MB).
o Start: This field shows the cylinder on your hard drive where the partition begins.
o End: This field shows the cylinder on your hard drive where the partition ends.
o A swap partition (at least 256 MB) — swap partitions are used to support virtual memory. In
other words, data is written to a swap partition when there is not enough RAM to store the
data your system is processing.
o If you are unsure about what size swap partition to create, make it twice the amount of RAM
on your machine. It must be of type swap.
o Creation of the proper amount of swap space varies depending on a number of factors
including the following (in descending order of importance):
o The applications running on the machine.
o Swap should equal 2x physical RAM for up to 2 GB of physical RAM, and then 1x physical RAM
for any amount above 2 GB, but never less than 32 MB.
Using this formula, a system with 2 GB of physical RAM would have 4 GB of swap, while one
with 3 GB of physical RAM would have 5 GB of swap. Creating a large swap space partition can
be especially helpful if you plan to upgrade your RAM at a later time.
o For systems with really large amounts of RAM (more than 32 GB) you can likely get away with
a smaller swap partition (around 1x, or less, of physical RAM).
A 500 MB partition allows you to install a minimal installation; while a 5.0 GB root
partition lets you perform a full installation, choosing all package groups.
It is recommended that you create a /boot/ partition (100 MB). /boot/ contains the
kernels, along with files used during the bootstrap process
Network Configuration
If you do not have a network device, this screen does not appear during your installation and you
should advance to
The installation program automatically detects any network devices you have and displays them in the
Once you have selected a network device, click Edit. From the Edit Interface pop-up screen, you can
choose to configure the IP address and Netmask of the device via DHCP (or manually if DHCP is not
selected) and you can choose to activate the device at boot time. If you select Activate on boot, your
network interface is started when you boot. If you do not have DHCP client access or you are unsure
what to provide here, please contact your network administrator.
Firewall Configuration
Red Hat Enterprise Linux offers firewall protection for enhanced system security. A firewall exists
between your computer and the network, and determines which resources on your computer remote
Firewall Configuration
Next, you can decide whether to enable a firewall for your Red Hat Enterprise Linux system.
No firewall
No firewall provides complete access to your system and does no security checking. Security checking
is the disabling of access to certain services. This should only be selected if you are running on a
trusted network (not the Internet) or plan to do more firewall configuration later.
Enable firewall
If you choose Enable firewall, connections are not accepted by your systems (other than the default
settings) that are not explicitly defined by you. By default, only connections in response to outbound
requests, such as DNS replies or DHCP requests are allowed. If access to services running on this
machine is needed, you can choose to allow specific services through the firewall.
If you are connecting your system to the Internet, this is the safest option to choose.
Enabling these options allow the specified services to pass through the firewall. Note, these services
may not be installed on the system by default. Make sure you choose to enable any options that you
may need.
Secure Shell (SSH) is a suite of tools for logging in to and executing commands on a remote machine.
If you plan to use SSH tools to access your machine through a firewall, enable this option. You need to
have the openssh-server package installed in order to access your machine remotely, using SSH
tools.
The HTTP and HTTPS protocols are used by Apache (and by other Web servers) to serve webpages. If
you plan on making your Web server publicly available, enable this option. This option is not required
for viewing pages locally or for developing webpages. You must install the httpd package if you
want to serve webpages.
The FTP protocol is used to transfer files between machines on a network. If you plan on making your
FTP server publicly available, enable this option. You must install the vsftpd package in order to
publicly serve files.
If you want to allow incoming mail delivery through your firewall, so that remote hosts can connect
directly to your machine to deliver mail, enable this option. You do not need to enable this if you
collect your mail from your Internet Service Provider's server using POP3 or IMAP, or if you use a tool
such as fetchmail. Note that an improperly configured SMTP server can allow remote machines to
use your server to send spam.
You can install and support multiple languages for use on your system.
You must select a language to use as the default language. The default language is the language used
on the system once the installation is complete. Typically, the default language is the language you
selected to use during the installation. If you choose to install other languages during this installation,
you can change your default language after the installation. If you are only going to use one language
on your system, selecting only that language saves significant disk space. Caution
To use more than one language on your system, choose specific languages to be installed or select all
languages to have all available languages installed on your Red Hat Enterprise Linux system.
Use the Reset button to cancel your selections. Resetting reverts to the default; only the language
To change the language configuration after you have completed the installation, use the Language
Configuration Tool.
There are two ways for you to select your time zone:
o Using your mouse, click on the interactive map to select a specific city (represented by a
yellow dot). A red X appears indicating your selection.
o You can also scroll through the list at the bottom of the screen to select your time zone. Using
your mouse, click on a location to highlight your selection.
Select System Clock uses UTC if you know that your system is set to UTC.
To change your time zone configuration after you have completed the installation, use the Time and
Date Properties Tool.
Type the system-config-date command in a shell prompt to launch the Time and Date
Properties Tool. If you are not root, it prompts you for the root password to continue.
timeconfig.
Setting up a root account and password is one of the most important steps during your installation.
Your root account is similar to the administrator account used on Windows NT machines. The root
account is used to install packages, upgrade RPMs, and perform most system maintenance. Logging in
The root user (also known as the superuser) has complete access to the entire system; for this
reason, logging in as the root user is best done only to perform system maintenance or
administration.
Root Password
Use the root account only for system administration. Create a non-root account for your general use
and su - to root when you need to fix something quickly. These basic rules minimize the chances of a
typo or an incorrect command doing damage to your system.
The installation program prompts you to set a root password for your system. You cannot proceed to
the next stage of the installation process without entering a root password
The root password must be at least six characters long; the password you type is not echoed to the
screen. You must enter the password twice; if the two passwords do not match, the installation
program asks you to enter them again.
Tip
To change your root password after you have completed the installation, use the Root Password
Tool.
A root password is the administrative password for your Red Hat Enterprise Linux system. You should
only log in as root when needed for system maintenance. The root account does not operate within
the restrictions placed on normal user accounts, so changes made as root can have implications for
your entire system.
Now that you have made most of the choices for your installation, you are ready to confirm the default
package selection or customize packages for your system.
The Package Installation Defaults screen appears and details the default
package set for your Red Hat Enterprise Linux installation. This screen varies depending on the version
of Red Hat Enterprise Linux you are installing.
To customize your package set further, select Customize the set of packages to
be installed option on the screen. Clicking Next takes you to the Package Group Selection
screen.
You can select package groups, which group components together according to function (for example,
Select each component you wish to install. Selecting Everything (at the end of the component list)
installs all packages included with Red Hat Enterprise Linux.
Once a package group has been selected, click on Details to view which packages are installed by
default, and to add or remove optional packages from that group. (Package Group Details)
Preparing to Install
For your reference, a complete log of your installation can be found in /root/install.log once you
reboot your system.
Warning
If, for some reason, you would rather not continue with the installation process, this is your last
opportunity to safely cancel the process and reboot your machine. Once you press the Next button,
partitions are written and packages are installed. If you wish to abort the installation, you should
reboot now before any existing information on any hard drive is rewritten.
Installing Packages
At this point there is nothing left for you to do until all the packages have been installed. How quickly
this happens depends on the number of packages you have selected and your computer's speed.
Installation Complete
The installation program prompts you to prepare your system for reboot.
Absolute Pathnames
/usr/share
/home/javed
Relative Pathnames
../index.html
Translate A to a
for example: #ls –l | lpr -------- It will send output on default printer
# cat file.txt | lpr –p pritnername -- send print on non default printer
All about Vi
This is probably the most popular text editor for Linux. Even if you don't like
it, you may end up using it quite often. If you need to make a quick change
to a file, you can't beat 'vi'. This is not meant to be an exhaustive guide to
vi. This is just meant to show you how to use the most common (and useful)
commands. Let's start by opening a file.
vi /etc/hosts.allow
Miscellaneous:
Esc i Insert Text
Esc a Append Text
Esc u undo
Esc: w save file
Esc: wq save file and quit
Esc ZZ save file and quit
Esc: q! Quit without saving
Basic operations
These are some popular vi commands:
Note
It is always a good idea to backup any data that you have on your system(s). Mistakes do happen and
can result in the loss all of your data.
In DOS and Windows, use the Windows fdisk utility to create a new MBR with flag /mbr. This ONLY
rewrites the MBR to boot the primary DOS partition. The command should look like the following:
fdisk /mbr
If you need to remove Linux from a hard drive and have attempted to do this with the default DOS
(Windows) fdisk, you will experience the Partitions exist but they do not exist problem. The best
way to remove non-DOS partitions is with a tool that understands partitions other than DOS.
2nd Method
To begin, insert the Red Hat Enterprise Linux CD #1 and boot your system. Once you have booted off
the CD, a boot prompt appears. At the boot prompt, type: linux rescue. This starts the
rescue mode program.
You are prompted for your keyboard and language requirements. Enter these values as you would
during the installation of Red Hat Enterprise Linux.
Next, a screen appears telling you that the program attempts to find a Red Hat Enterprise Linux install
to rescue. Select Skip on this screen.
After selecting Skip, you are given a command prompt where you can access the partitions you would
like to remove.
First, type the command list-harddrives. This command lists all hard drives on your system
that are recognizable by the installation program, as well as their sizes in megabytes.
Be careful to remove only the necessary Red Hat Enterprise Linux partitions. Removing other
partitions could result in data loss or a corrupted system environment.
Start parted, where /dev/hda is the device on which to remove the partition:
1. parted /dev/hda
2. print
The print command also displays the partition's type (such as linux-swap, ext2, ext3, and so on).
Knowing the type of the partition helps you in determining whether to remove the partition.
Remove the partition with the command rm. For example, to remove the partition with minor number
3:
3. rm 3
Important
The changes start taking place as soon as you press [Enter], so review the command before
committing to it.
After removing the partition, use the print command to confirm that it is removed from the partition
table.
Once you have removed the Linux partitions and made all of the changes you need to make,
After quitting parted, type exit at the boot prompt to exit rescue mode and reboot your system,
instead of continuing with the installation. The system should reboot automatically. If it does not, you
can reboot your computer using Control-Alt-Delete.
This MBR contains instructions on how to load the GRUB (or LILO) boot-loader, using a pre-selected
operating system. The MBR then loads the boot-loader, which takes over the process (if the boot-
loader is installed in the MBR). In the default Red Hat Linux configuration, GRUB uses the settings in
the MBR to display boot options in a menu.
• Places the appropriate initial RAM disk image, called an initrd, into memory. The initrd is used
by the kernel to load drivers necessary to boot the system.
When Linux begins to boot with its kernel, it first runs the /sbin/init program, which does some system
checks, such as verifying the integrity of the file systems, and starts vital programs needed for the
operating system to function properly. It then inspects the /etc/inittab file to determine Linux's overall
mode of operation or runlevel. A listing of valid runlevels can be seen in Table 7-1.
0 /etc/rc.d/rc0.d Halt
6 /etc/rc.d/rc6.d Reboot
Based on the selected runlevel, the init process then executes startup scripts located in subdirectories
of the /etc/rc.d directory. Scripts used for runlevels 0 to 6 are located in subdirectories /etc/rc.d/rc0.d
through /etc/rc.d/rc6.d, respectively.
at.allow, /etc If at.allow exists, then only the user accounts listed in
at.deny the file may use the at or batch commands. If at.deny
exists, then any user account listed in the file may not
use the at or batch commands.
.bashrc /home/<user> Shell script to set personalized functions and aliases for
each newly created shell or subshell.
cron.allow, /etc If cron.allow exists, then only the user accounts listed
cron.deny in the file may use the crontab command. If cron.deny
exists, then any user account listed in the file may not
use the crontab command.
crontab /etc Master cron scheduling file for system-wide jobs. On Red
Hat systems, the crontab file uses the run-parts script
to schedule any script in the appropriately-named
/etc/cron.* directory.
group /etc List of all user groups on the system and the user
membership list for each group.
lpd.conf /etc Configuration settings for the lpd print daemon, and
defaults for the printcap file.
passwd /etc List of all user accounts on the system. Also includes the
user's UID, GID, full name, home directory, and default
shell. Passwords tend to be stored in /etc/shadow on
most systems.
printcap /etc Configuration settings for print queues, used by both the
lpr command and lpd daemon. Some distributions
automatically regenerate this file during startup and use
the /etc/printcap.local file to store user
customizations.
rc.local /etc/rc.d Last rc shell script run, usually as part of all startup
runlevels (1-5). A common location for user-defined
startup commands.
services /etc Reference list of common TCP and UDP port numbers
and their related services.
Adding Users
useradd is a utility for adding new users to a UNIX system. It adds new user information
to the /etc/passwd file and creates a new home directory for the user. When you add a new
user, you should also set their password (using the -p option on useradd, or using the
passwd utility):
# useradd javed
# passwd javed
groupadd creates a new user group and adds the new information to /etc/group:
# groupadd staff
Every user belongs to a primary group and possibly also to a set of supplementary
groups. To modify the group permissions of an existing user, use
• groups
You can find out which groups a user belongs to by typing:
# groups username
As we have seen in the previous chapter, every file or directory on a UNIX system has three
types of permissions, describing what operations can be performed on it by various
categories of users. The permissions are read (r), write (w) and execute (x), and the three
categories of users are user/owner (u), group (g) and others (o). Because files and
directories are different entities, the interpretation of the permissions assigned to each
differs slightly, as shown in Fig 3.1.
Note:
File and directory permissions can only be modified by their owners, or by the superuser
(root), by using the chmod system utility.
(r,w,x)(4, 2, 1)
--- 0
--x 1
-w- 2
-wx 3
r-- 4
r-x 5
rw- 6
rwx 7
Sets the permissions on all files ending in *.txt to rw-rw---- (i.e. the owner and
users in the file's group can read and write to the file, while the general public do not have
any sort of access).
chmod also supports a -R option which can be used to recursively modify file permissions,
e.g.
It will grant group and other read rights to the directory play and all of the files and
directories within play.
It can be used to change the group that a file or directory belongs to. It also supports a -R
option.
Commands Detail
Comments: Take backup of two directories /home and /boot in backup.tar file.
Restore Backup
Use the following commands to restore backup,
You installed a new Linux system, but forgot to set enough swap space for your
needs. Do you need to repartition and reinstall? No, the swap utilities on Linux allow you to
make a real file and use it as swap space.
The trick is to make a file and then tell the swapon program to use it.
Here's how to create, for example, a 500mb swap file on your root partition.
This will make a 500mb file on your hard drive. You now need to initialize it:
mkswap /swapfile
And you can then add it to your swap pool:
swapon /swapfile
With that you 500mb of swap added. Don't forget to add the swapon command to your startup
files so the command will be repeated at each reboot.
Note: If Swap partition is not created then we face error during the creation of swap file.
The next time the system boots, it will enable the new swap file.
To add the swapon command in startup file, so the command will be executed at each
boot.
vi /etc/rc.local
swapon /swapfile
After adding the new swap file and enabling it, make sure it is enabled by viewing the output
of the following command
Note:
/dev/zero
In Unix-like operating systems, /dev/zero is a special file that provides as many null characters
(ASCII NUL, 0x00) as are read from it. One of the typical uses is to provide a character stream
for overwriting information. Another might be to generate a clean file of a certain size. Using it
to create virtual file shared memory.
#Do not execute this code on any computer unless you want to destroy
all data on a partition!
dd if=/dev/zero of=/dev/hda8
Like /dev/null, /dev/zero acts as a source and sink for data. All writes to /dev/zero succeed
with no other effects (the same as for /dev/null, although /dev/null is the more commonly used
data sink); all reads on /dev/zero return as many NULs as characters requested.
Disk Management:
The partitions on each drive are referred numerically. The first partition on the first drive is
referred to as hda1, the second as hda2, and the third as hda3 etc...
Note: SCSI disks are labeled /dev/sda, /dev/sdb, /dev/sdc etc... To represent the first, second,
third... SCSI hard drive partitions are represented by an additional number. i.e. First drive first
partition, /dev/sda1, second partition, /dev/sda2,... Other SCSI devices such as tape backup are
labeled /dev/st0 for the first, /dev/st1 for the second and so forth. See Linux SCSI tutorial for
more info.
Command Description
d Delete a partition
n Create a new partition
p Displays (prints) the partitions layout
q Quits without saving changes
T Change the partition’s type
w Writes (Save) changes and quits.
FTP Server
The File Transfer Protocol (FTP) is used to copying files between computers over the
LAN/WAN.
Red Hat currently installs the vsftpd server package along with anonymous FTP support
during installation. At that time, an ftp directory is created along with several subdirectories
where you can place files for FTP access.
The vsftpd FTP package does not create a directory where users can upload files to the
FTP site. If you want to upload files then you will have to create a directory, and make it part of
the ftp group, and then set its permissions to allow users write access.
Configuring vsftpd
You configure vsftpd using one configuration file, /etc/vsftpd/vsftpd.conf. Red Hat installs a
default vsftpd.conf file in the /etc/vsftpd directory. The man page for vsftpd.conf lists all
options, providing a detailed explanation for each.
Configuration file:
More detail
Configuration Options for vsftpd.conf
Option Description
listen Set standalone mode
listen_port Specify port for standalone mode
anonymous_enable Enable anonymous user access
local_enable Enable access by local users
no_anon_password Specify whether anonymous users must submit a password
anon_upload_enable Enable uploading by anonymous users
anon_mkdir_write_enable Allow anonymous users to create directories
aonon_world_readable_only Make uploaded files read only to all users
idle_session_timeout Time limit in seconds for idle sessions
data_connection_timeouts Time limit in seconds for failed connections
dirmessage_enable Display directory messages
ftpd_banner Display FTP login message
xferlog_enable Enable logging of transmission transactions
xferlog_file Specify log file
deny_email_enable Enable denying anonymous users whose e-mail addresses
are specified in vsftpd.banned
userlist_enable Deny access to users specified in vsftp.user_list file
For added security, you may restrict FTP access to certain users by adding them to the list
of users in the /etc/vsftpd.ftpusers file.
userlist_enable=YES
userlist_deny=NO
Then open the file vi /etc/vsftpd.user_list and add the users account which you want to allow.
You use the telnet command to log in remotely to another system on your network. The
system can be on your local area network or available through an Internet connection
Enable Telnet Services: you have to enable the telnet by edition of following file
/etv/xinetd.d/krb5-telnet
$ telnet 200.10.250.139
Connected to garnet
login:
Package: Samba
Configure File: /etc/samba/smb.conf
Service : smb
Samba Applications
Application Description
smbd Samba server daemon that provides file and printer services to SMB
clients
nmbd Samba daemon that provides NetBIOS name resolution and service
browser support
smbclient Provides FTP-like access by Linux clients to Samba services
smbmount Mounts Samba share directories on Linux clients
smbumount Unmounts Samba share directories mounted on Linux clients
smbpasswd Changes SMB-encrypted passwords on Samba servers
smbstatus Displays the current status of the SMB network connections
smbrun Interface program between smbd and external programs
testparm Tests the Samba configuration file, smb.conf
smbtar Backs up SMB/CIFS-shared resources directly to a Unix tape drive
nmblookup Maps the NetBIOS name of a Windows PC to its IP address
redhat-config-samba Samba GUI configuration tool (System Settings:Server
Setttings:Samba Server)
SWAT Samba Web administration tool for configuring smb.conf with a
Web browser; enables you to use a Web page interface to create and
maintain your Samba configuration file, smb.conf
windbind Uses authentication services provided by Windows domain
/etc/samba/smbpasswd
Starting Up Samba
For a simple Samba setup, you should be able to use the default smb.conf file installed
with the Linux distribution package of Samba. If you need to make changes, however, you must
restart the Samba server to have the changes take effect. Starting, stopping, and restarting the
To test your connection from a Linux system, you can use the smbclient command to query the
Samba server. To access the home directory of a user on the Samba server, use the IP or
hostname address of the Samba server, along with the homes section. With the -U option,
specify a user to connect to on the system, as shown here:
You are then prompted for a password. If the client password is different from the server
password, use the server password. Once connected, you are presented with the SMB client
prompt as shown here. You can then access the files on the user's home directory:
smb: \>
To set up a connection for a Windows client, you need to specify the Windows workgroup name
and configure the password. The workgroup name is the name that appears in the Entire Network
window in the Network Neighborhood on the Windows desktop (My Network Places on
Windows 2000, XP). In the smb.conf file, you specify the workgroup name in the workgroup=
entry in the global section. The workgroup name should be uppercase, no more than eight
characters, and contain no spaces.
You can then restart the Samba server. On a Windows client, you see the workgroup name in the
Entire Network folder in your Network Neighborhood. Within the workgroup is an icon for the
Samba server and within that is an icon for the user directory, as specified in the homes section
of the smb.conf file.
Samba configuration options are kept in the /etc/samba/smb.conf file. You edit this file to make
changes to the configuration. Once you finish making any changes, you should test your
smb.conf file using the testparm program. The testparm program checks the validity of your
configuration entries. By default, testparm uses the /etc/samba/smb.conf file, although you can
supply a different configuration file as an argument:
testparm
smbstatus
To check your network connections, use the smbstatus command. This command
returns a listing of all active SMB connections.
Server Hierarchy
Your network can have a master DNS server and several slave DNS
servers to help carry the workload. A slave DNS server automatically copies
its configuration files, including all zone files, from the master DNS server.
• Hint zone A hint zone specifies the root name servers and is
denoted by a period (.). A DNS server is normally connected to a
larger network, such as the Internet, which has its own DNS servers.
DNS servers are connected this way hierarchically, with each server
having its root servers to which it can send resolution queries. The
root servers are designated in the hint zone.
type master;
file “my-site.forward”;
};
zone “another-web-site.com” {
type master;
notify no;
file “another-site.forward”;
};
Directory Option
A critically important option found in most configuration files is the
directory option, which holds the location of the name server's zone and
cache files on your system. The following example is taken from the Red Hat
/etc/named.conf file. This example specifies the zone files are located in
the /var/named directory. In this directory, you can find your zone files,
including those used for your local system.
options {
directory "/var/named";
forwarders { 192.168.0.34;
192.168.0.47;
};
forwarders Option
notify Option
With the notify option turned on, the master zone DNS servers send
messages to any slave DNS servers whenever their configuration has
changed. The slave servers can then perform zone transfers in which they
download the changed configuration files. Slave servers always use the DNS
configuration files copied from their master DNS servers. notify takes one
argument, yes or no, where yes is the default. With the no argument, you
can have the master server not send out any messages to the slave servers,
in effect preventing any zone transfers. (Mentioned in above example)
named.conf Example
/etc/named.conf
logging {
category cname { null; };
};
options {
directory "/var/named";
};
zone "." {
type hint;
file "named.ca";
};
zone "my-site.org" {
type master;
file "my-site.forward";
};
zone "1.168.192.IN-ADDR.ARPA" {
type master;
file "my-site.rev";
};
zone "0.0.127.IN-ADDR.ARPA" {
type master;
file "named.local";
};
Canonical
CNAME Alias hostname for the official hostname.
NAME
A zone or reverse mapping file always begins with a special resource record
called the Start of Authority (SOA) record. This record specifies that all the
following records are authoritative for this domain. It also holds information
about the name server's domain, which is to be given to other name servers.
An SOA record has the same format as other resource records, though its
data segment is arranged differently. The format for an SOA record follows:
Each zone has its own SOA record. The SOA begins with the zone name
specified in the named.conf zone entry. This is usually a domain name. An
@ symbol is usually used for the name and acts like a macro expanding to
the domain name. The class is usually the Internet class, IN. SOA is the
type. Origin is the machine that is the origin of the records, usually the
machine running your name server daemon. The person-in-charge is the e-
mail address for the person managing the name server (use dots, not @, for
the e-mail address, as this symbol is used for the domain name).
The following example shows an SOA record. The machine running the name
server is server.my-site.com, and the e-mail address of the person
responsible for the server is javed.my-site.com.
Name Server: NS
The name server record specifies the name of the name server for this
zone. These have a resource record type of NS. If you have more than one
name server, list them in NS records. These records usually follow the SOA
record. As they usually apply to the same domain as the SOA record, their
name field is often left blank to inherit the server's domain name specified
by the @ symbol in the previous SOA record.
You can, if you wish, enter the domain name explicitly as shown here:
my-site.com. IN NS server.my-site.com.
Address Record: A
Server2.my-site.com. IN A 192.168.0.2
server IN A 192.168.0.1
Name The root name of the zone. The “@” sign is a shorthand
reference to the current origin (zone) in the /etc/named.conf file
for that particular database file.
Type The type of DNS resource record. In the example, this is an SOA
resource record. Other types of records exist, which I’ll cover
later.
Serial-no A serial number for the current configuration. You can use the
date format YYYYMMDD with an incremented single digit number
tagged to the end. This will allow you to do multiple edits each
day with a serial number that both increments and reflects the
date on which the change was made.
Refresh Tells the slave DNS server how often it should check the master
DNS server. Slaves aren’t usually used in home / SOHO
environments.
Expiry Total amount of time a slave should retry to contact the master
before expiring the data it contains. Future references will be
directed towards the root servers. Slaves aren’t usually used in
home/SOHO environments.
Minimum- There are times when remote clients will make queries for
TTL subdomains that don’t exist. Your DNS server will respond with a
no domain or NXDOMAIN response that the remote client caches.
This value defines the caching duration your DNS includes in this
response.
Mail Exchanger: MX
The Mail Exchanger record, MX, specifies the mail server that is used
for this zone or for a particular host. The mail exchanger is the server to
which mail for the host is sent. In the following example, the mail server is
specified as server.my-site.com. Any mail sent to the address for any
machines in that zone will be sent to the mail server, which in turn will send
it to the specific machines. For example, mail sent to a user on server2.my-
site.com will first be sent to server.my-site.com, which will then send it
on to server2.my-site.com. In the following example, the host
192.168.0.1 (server.my-site.com) is defined as the mail server for the
my-site.com domain:
My-site.com. IN MX 10 server.my-site.com.
You could also inherit the domain name from the SOA record, leaving the
domain name entry blank.
IN MX server.my-site.com.
You could use the IP address instead, but in larger networks, the domain
name may be needed to search for and resolve the IP address of a particular
machine, which could change.
My-site.com. IN MX 10 192.168.0.1
My-site.com. IN MX 10 server.my-ste.com.
IN MX 20 server2.my-site.com.
Aliases: CNAME
Resource records of type CNAME are used to specify alias names for a
host in the zone. Aliases are often used for machines running several
different types of servers, such as both Web and FTP servers. They are also
used to locate a host when it changes its name. The old name becomes an
alias for the new name. In the following example, ftp.my-site.com is an
alias for a machine actually called sever.my-site.com:
The term CNAME stands for canonical name. The canonical name is the
actual name of the host. In the preceding example, the canonical name is
server.my-site.com. The alias, also known as the CNAME, is ftp.my-
site.com. In a CNAME entry, the alias points to the canonical name.
server.my-site.com. IN A 192.168.0.1
www.my-site.com. IN A 192.168.0.1
In a PTR record, you can specify just that last number segment of the
address (the host address) and let DNS fill in the domain part of the
1 IN PTR server.my-site.com.
A zone file holds resource records that follow a certain format. The file
begins with general directives to define default domains or to include other
resource record files. These are followed by a single SOA record, name
server and domain resource records, and then resource records for the
different hosts. Comments begin with a semicolon and can be placed
throughout the file. The @ symbol operates like a special macro,
representing the domain name of the zone to which the records apply. The
@ symbol is used in the first field of a resource or SOA record as the zone's
domain name.
A zone file begins with an SOA record specifying the machine the name
server is running on, among other specifications. The @ symbol is used for
the name of the SOA record, denoting the zone's domain name. After the
SOA, the name server resource records (NS) are listed. Just below the name
server records are resource records for the domain itself. Resource records
for host addresses (A), aliases (CNAME), and mail exchangers (MX) follow.
The next example shows a sample zone file, which begins with an SOA
record and is followed by an NS record, resource records for the domain,
and then resource records for individual hosts:
IN NS server.my-site.com.
IN A 192.168.0.1
IN MX 10 server.my-site.com.
IN MX 15 server2.my-site.com.
server2 IN A 192.168.0.2
Nameserver Record
The next resource record specifies the name server for this zone. Here,
it is my-site.com. Notice the name for this resource record is blank. If the
name is blank, a resource record inherits the name from the previous
record. In this case, the NS record inherits the value of @ in the SOA record,
its previous record. This is the zone's domain, and the NS record specifies
IN NS server.my-site.com.
Here the domain name is inherited. The entry can be read as the following.
Notice the trailing period at the end of the domain name:
my-site.com. IN NS server.my-site.com.
Subdomain Zones
zone "beach.my-site.com" {
type master;
file "beach.my-site.com";
};
zone "1.168.192.IN-ADDR.ARPA" {
type master;
file "192.168.0";
};
beach.my-site.com. IN NS beach.my-site.com.
beach.my-site.com. IN A 192.168.0.33.
Slave Servers
A slave DNS server is tied directly to a master DNS server and periodically
receives DNS information from it. You use a master DNS server to configure
its slave DNS servers automatically. Any changes you make to the master
server are automatically transferred to its slave servers. This transfer of
information is called a zone transfer. Zone transfers are automatically
initiated whenever the slave zone's refresh time is reached or the slave
server receives a notify message from the master. The refresh time is the
second argument in the zone's SOA entry. A notify message is automatically
sent by the master whenever changes are made to the master zone's
configuration files and the named daemon is restarted. In effect, slave
zones are automatically configured by the master zone, receiving the master
zone's zone files and making them their own.
Slave Zones
Using the previous examples, suppose you want to set up a slave server on
server2.my-site.com, Zone entries, as shown in the following example, are
set up in the named.conf configuration file for the slave DNS server on
server2.my-site.com. The slave server is operating in the same domain as
the master, and so it has the same zone name, my-site.com. Its SOA file is
named slave.my-site.com. The term "slave" in the filename is merely a
convention that helps identify it as a slave server configuration file. The
masters statement lists its master DNS server—in this case, 192.168.0.1.
Whenever the slave needs to make a zone transfer, it transfers data from
that master DNS server. The entry for the reverse mapping file for this slave
server lists its reverse mapping file as slave.192.168.0.
zone "my-site.com" {
type slave;
file "slave.my-site.com";
zone "1.168.192.IN-ADDR.ARPA" {
type slave;
file "slave.192.168.0";
masters { 192.168.0.1;
};
Ref Book: The Complete Reference Enterprise Linux & Fedora Edition
Package: nfs
Service: nfs, portmap, nfslock,netfs
Configuration file: /etc/exports
VFS
NFS isn't a single program, but a suite of interrelated programs that work
together to get the job done.
• rpcbind: (portmap in older versions of Linux) The primary daemon upon which all
the others rely, rpcbind manages connections for applications that use the RPC
specification. By default, rpcbind listens to TCP port 111 on which an initial
connection is made. This is then used to negotiate a range of TCP ports, usually
above port 1024, to be used for subsequent data transfers. You need to run rpcbind
on both the NFS server and client.
• nfs: Starts the RPC processes needed to serve shared NFS file systems. The nfs
daemon needs to be run on the NFS server only.
• nfslock: Used to allow NFS clients to lock files on the server via RPC processes. The
nfslock daemon needs to be run on both the NFS server and client.
• netfs: Allows RPC processes run on NFS clients to mount NFS filesystems on the
server.
Now take a look at how to configure these daemons to create functional NFS
client/server.
Installing NFS
RedHat Linux installs nfs by default, and also by default nfs is
activated when the system boots. You can determine whether you have nfs
installed using the RPM command in conjunction with the grep command to
search for all installed nfs packages.
Both the NFS server and NFS client have to have parts of the NFS
package installed and running. The server needs rpcbind, nfs, and nfslock
operational, as well as a correctly configured /etc/exports file.
The /etc/exports file is the main NFS configuration file, and it consists
of two columns. The first column lists the directories you want to make
available to the network. The second column has two parts. The first part
lists the networks or DNS domains that can get access to the directory, and
the second part lists NFS options in brackets.
In all cases, use the sync option to ensure that file data cached in memory is
automatically written to the disk after the completion of any disk data
copying operation.
#/etc/exports
/data/files *(ro,sync)
/home 192.168.1.0/24(rw,sync)
/data/test *.my-site.com(rw,sync)
/data/database 192.168.1.203(rw,sync)
1) Use the chkconfig command to configure the required nfs and RPC
rpcbind or portmap daemons to start at boot. You also should activate NFS
file locking to reduce the risk of corrupted data.
2) Use the init scripts in the /etc/init.d directory to start the nfs and portmap
daemons. The examples use the start option, but when needed, you can also
stop and restart the processes with the stop and restart options.
1) Use the chkconfig command to configure the required nfs and RPC
rpcbind or portmap daemons to start at boot. Activate nfslock to lock the
files and reduce the risk of corrupted data.
2) Use the init scripts in the /etc/init.d directory to start the nfs and RPC
rpcbind or portmap daemons. As on the server, the examples use the start
option, but you can also stop and restart the processes with the stop and
restart options.
The /etc/fstab file lists all the partitions that need to be auto-mounted when
the system boots. Therefore, you need to edit the /etc/fstab file if you need
the NFS directory to be made permanently available to users on the NFS.
For the example, mount the /data/files directory on server (IP address
192.16801.100) as an NFS-type filesystem using the local /mnt/nfs mount
point directory.
#/etc/fstab
#Directory Mount Point Type Options Dump FSCK
192.168.1.100:/data/files /mnt/nfs nfs soft 0 0
Each time your system boots, it reads the /etc/fstab file and executes the
mount -a command, thereby making this a permanent NFS mount.
If you don't want a permanent NFS mount, then you can use the
mount command without the /etc/fstab entry to gain access only when
necessary. This is a manual process;
Notice how before mounting there were no files visible in the /mnt/nfs
directory, this changes after the mounting is complete:
You can force your system to re-read the /etc/exports file by restarting
NFS. In a nonproduction environment, this may cause disruptions when an
exported directory suddenly disappears without prior notification to users.
Here are some methods you can use to update and activate the file with the
least amount of inconvenience to others.
When adding a shared directory, you can use the exportfs -r command to
export only the new entries.
1) Unexport the mount point directory on the NFS client using the umount
command. In this case, you're unmounting the /mnt/nfs mount point.
Note: You may also need to edit the /etc/fstab file of any entries related to
the mount point if you want to make the change permanent even after
rebooting.
2) Comment out the corresponding entry in the NFS server's /etc/exports file
and reload the modified file.
Troubleshooting NFS
A basic NFS configuration usually works without problems when the
client and server are on the same network. The most common problems are
caused by forgetting to start NFS, to edit the /etc/fstab file, or to export
the /etc/exports file. Another common cause of failure is the iptables firewall
daemon running on either the server or client without the administrator
realizing it.
Error Description
Too many levels Attempting to mount a filesystem that has already been
of remote in mounted.
path
Permission User is denied access. This could be the client's root user
denied who has unprivileged status on the server due to the
root_squash option. Could also be because the user on
the client doesn't exist on the server.
Stale file handle A file that was previously accessed by the client was
deleted on the server before the client closed it.
Fake hostname Forward and reverse DNS entries don't exist for the NFS
client.
The showmount Command
When run on the server, the showmount -a command lists all the
currently exported directories. It also shows a list of NFS clients accessing
the server; in this case one client has an IP address of 192.168.1.102.
Portmapper Service
The first line of defense is to control access to the portmapper service.
The portmapper tells hosts where the NFS services can be found on the
system. Restricting access does not allow a remote host to even locate NFS.
For a strong level of security, you should deny access to all hosts except
those that are explicitly allowed. In the hosts.deny file, you would place the
following entry, denying access to all hosts by default. ALL is a special
keyword denoting all hosts.
portmap:ALL
In the hosts.allow file, you would then enter the hosts on your network, or
any others that you would want to permit access to your NFS server. Again,
you would specify the portmapper service, then list the IP addresses of the
hosts you are permitting access. You can list specific IP addresses or a
network range using a netmask. The following example allows access only
by hosts in the local network, 192.168.0.0, and to the host 10.0.0.43. You
can separate addresses with commas.
In addition, it is also advisable to add the same level of control for specific
NFS services. In the hosts.deny file, you would add entries for each service,
as shown here:
mountd:ALL
rquotad:ALL
statd:ALL
lockd:ALL
Then, in the hosts.allow file, you can add entries for each service:
Netfilter Rules
To enable NFS for your local network, you will have to allow packet
fragments. Assuming that eth0 is the device used for the local network, you
could use the following example:
Ref: http://www.visolve.com/squid/squid26/logs.php
Ref: http://www.linuxhomenetworking.com/
Package: squid
Service: squid
Configuration file: /etc/squid/squid.conf
The main Squid configuration file is squid.conf, and, like most Linux
applications, Squid needs to be restarted for changes to the configuration file
can take effect.
Squid will fail to start if you don't give your server a hostname. You can set this with the
visible_hostname parameter. Here, the hostname is set to the real name of the server like tipu.
visible_hostname tipu
# http_port 3128
http_port 8080
You can limit users' ability to browse the Internet with access control
lists (ACLs). Each ACL line defines a particular type of activity, such as an
access time or source network, they are then linked to an http_access
statement that tells Squid whether or not to deny or allow traffic that
matches the ACL.
To restrict access to the Squid proxy via the time, use the format:
Detail:
You can create access control lists with time parameters. For example,
you can allow only business hour access from the home network, while
always restricting access to host 192.168.1.23.
#
# Add this at the top of the http_access section of squid.conf
#Recommend minimum configuration
http_access deny RestrictedHost
http_access allow home_network business_hours
2nd Example
By defining ACLs and using them in Squid options, you can tailor your
Web site with the kind of security you want. The following example allows
access to the Web through the proxy by only the mylan group of local
systems, denying access to all others. Two acl entries are set up: one for
the local system and one for all others. http_access options first allow
access to the local system and then deny access to all others.
# File: /usr/local/etc/restricted-sites.squid
www.porn.com
illegal.com
These can then be used to always block the restricted sites and permit the
allowed sites during working hours. This can be illustrated by expanding our
previous example slightly.
#
# Add this to the bottom of the ACL section of squid.conf
#
acl home_network src 192.168.1.0/24
acl business_hours time M T W H F 9:00-17:00
acl GoodSites dstdomain "/usr/local/etc/allowed-sites.squid"
acl BadSites dstdomain "/usr/local/etc/restricted-sites.squid"
#another example
acl blocked_sites url_regex www.xxx.com
acl blocked_sites url_regex www.yyy.com
acl blocked_sites url_regex www.zzz.com
acl blocked_sites url_regex "/var/smoothwall/proxy/badsites.txt"
http_access deny blocked_sites
#
# Add this at the top of the http_access section of squid.conf
#
http_access deny BadSites
http_access allow home_network business_hours GoodSites
#vi /etc/squid/squid.conf
:wq
In `ordinary' proxy, the client specifies the hostname and port number of
a proxy in his web browsing software. The browser then makes requests to
the proxy for internet; this is all fine and good,
• You want to force clients on your network to use the proxy, whether
they want to or not.
• You want clients to use a proxy, but don't want them to know they're
using proxy.
• You want clients to be use proxy, but don't want to go to all the work
of updating the settings in hundreds or thousands of web browsers.
This is where transparent proxy comes in. A web request can be intercepted
by the proxy, transparently. That is, as far as the client software knows,
it is talking to the origin server (Internet) itself,
#vi /etc/squid/squid.conf
httpd_accel_host virtual
httpd_accel_port 80
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
Detail:
The four lines inform Squid to run as a transparent proxy, below is a
list of what each individual line acheives:
httpd_accel_host virtual - This tells the accelerator to work for any URL
that it is given (the usual usage for the accelerator is to inform it which URL
it must accelerate)
Warning
1) Create the password file. The name of the password file should be
/etc/squid/squid_passwd, and you need to make sure that it's
universally readable.
#touch /etc/squid/squid_passwd
# chmod o+r /etc/squid/squid_passwd
#locate ncsa_auth
/usr/lib/squid/ncsa_auth
#
#
# Add this to the auth_param section of squid.conf
#
auth_param basic program /usr/lib/squid/ncsa_auth
/etc/squid/squid_passwd
#
# Add this to the auth_param section of squid.conf
#
auth_param basic program /usr/lib/squid/ncsa_auth
/etc/squid/squid_passwd
#
# Add this to the bottom of the ACL section of squid.conf
#
acl ncsa_users proxy_auth REQUIRED
acl business_hours time M T W H F 9:00-17:00
#
# Add this at the top of the http_access section of squid.conf
#
http_access allow ncsa_users business_hours
Starting Squid
/usr/local/squid/bin/squid -z
/usr/local/squid/bin/squid
the first pass creates the cache directories, and the second starts the
daemon. The first command only needs to be run the first time the proxy is
used.
CACHE DIRECTORIES
Description This is used to define cache directory, its path, type and size
1. ufs is the old well-known Squid storage format that has always
been there.
2. aufs uses the same storage format as ufs, utilizing POSIX-
threads to avoid blocking the main Squid process on disk-I/O.
This was formerly known in Squid as async-io (Asynchronous
I/O, or non-blocking I/O, is a form of input/output processing that
permits other processing to continue before the transmission has
finished) .
3. diskd uses the same storage format as ufs, utilizing a separate
process to avoid blocking the main Squid process on disk-I/O.
Type Usage
ufs cache_dir ufs Directory-Name Mbytes L1 L2 [options]
aufs cache_dir aufs Directory-Name Mbytes L1 L2 [options]s
diskd cache_dir diskd Directory-Name Mbytes L1 L2 [options] [Q1=n] [Q2=n]
Mbytes is the amount of disk space (in MB) to use under this directory. The
default is 100 MB. Change this to suit your configuration Level1 Number of
first-level subdirectories which will be created under the Directory. The
default is 16. Level2 number of second-level subdirectories, which will be
created under each first-level directory. The default is 256.
Option:
read-only Make the cache directory as read only.
Note
Can specify multiple cache_dir lines to spread the cache among different
disk partitions. Click here to find more
informations on file systems and cache_dir.
Example
cache_access_log /var/log/squid_access.log
My Setup:
i) System: HP dual Xeon CPU system with 8 GB RAM (good for squid).
ii) Eth0: IP:192.168.1.1
iii) Eth1: IP: 192.168.2.1 (192.168.2.0/24 network (around 150 windows XP systems))
iv) OS: Red Hat Enterprise Linux 4.0 (Following instruction should work with Debian and all
other Linux distros)
Eth0 connected to internet and eth1 connected to local lan i.e. system act as router.
Server Configuration
First, Squid server installed (use up2date squid) and configured by adding following directives to
file:
# vi /etc/squid/squid.conf
Where,
Iptables configuration
Next, I had added following rules to forward all http requests (coming to port 80) to the Squid
server port 3128 :
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j DNAT --to 192.168.1.1:3128
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128
address (192.168.2.1) as Router/Gateway (use DHCP to distribute this information). You do not
have to setup up individual browsers to work with proxies.
Delay Pools
Another useful squid feature is delay pools. Conceptually, delay pools are bandwidth limitations
- ``pools'' of bandwidth that drain out as people browse the Web, and fill up at a rate you specify
- this can be thought of as a leaky bucket that is continually being filled.
Pool:
A collection of bucket groups as appropriate to a given class.
bucket Pool:
a group of buckets within a pool, such as the per-host bucket group, the per-network bucket
group or the aggregate bucket group (the aggregate bucket group is actually a single bucket).
bucket:
an individual delay bucket represents a traffic allocation, which is replenished at a given rate (up
to a given limit) and causes traffic to be delayed when empty.
Classes:
There are 3 classes of delay pools - class 1 is a single aggregate bucket, class 2 is an aggregate
Class:-
Class of a delay pool determines how the delay is applied, ie, whether the different client IPs are
treated separately or as a group (or both).
class1:-
Class 1 delay pool contains a single unified bucket, which is used for all requests from hosts
subject to the pool.
calss2:-
Class 2 delay pool contains one unified bucket and 255 buckets, one for each host on an 8-bit
network
class3:-
It contains 255 buckets for the subnets in a 16-bit network, and individual buckets for every host
on these networks (IPv4 class B)
How can I limit Squid's total bandwidth to, say, 512 Kbps?
acl all src 0.0.0.0/0.0.0.0 # might already be defined
delay_pools 1
delay_class 1 1
delay_access 1 allow all
delay_parameters 1 64000/64000 # 512 kbits == 64 kbytes per
second
The 1 second buffer (max = restore = 64kbytes/sec) is because a limit is requested, and no
responsiveness to a busrt is requested. If you want it to be able to respond to a burst, increase the
aggregate_max to a larger value, and traffic bursts will be handled. It is recommended that the maximum
is at least twice the restore value - if there is only a single object being downloaded, sometimes the
download rate will fall below the requested throughput as the bucket is not empty when it comes to be
replenished.
You can not limit a single HTTP request's connection speed. You can limit individual hosts to some
bandwidth rate. To limit a specific host, define an acl for that host and use the example above. To limit a
group of hosts, then you must use a delay pool of class 2 or 3. For example:
To enable this, configure squid with the --enable-delay-pools option, There are 3 classes of delay
pools - class 1 is a single aggregate bucket, class 2 is an aggregate bucket with an individual
bucket for each host in the class C, and class 3 is an aggregate bucket, with a network bucket (for
each class B) and an individual bucket for each host.
To configure the amount of delay pools, and specify which pool is which class, use the following
format.
To specify which pool a client falls into, create ACLs which specifies the ip ranges for each
pool, and use the following:
delay_access 1 allow pool_1_acl
delay_access 1 deny all
delay_access 2 allow pool_2_acl
delay_access 2 deny all
Setting the parameters for each pool is done by:
delay_parameters pool aggregate network individual
Where ``aggregate'' is the parameter for the aggregate bucket, ``network'' for the network
bucket, and ``individual'' for the individual bucket. Aggregate is only useful for classes 1, 2 and
3, network for classes 2 and 3, and individual for class 3.
Each of these parameters is specified as restore / maximum - restore being the bytes per second
restored to the bucket, and maximum being the amount of bytes that can be in the bucket at any
time. It is important to remember that they are in bytes per second, not bits. To specify that a
parameter is unlimited, use a -1.
If you wish to limit any parameter in bits per second, divide this amount by 8, and use the value
for both the restore and the maximum. For example, to restrict the entire proxy to 64kbps, use:
delay_parameters 1 8000/8000
Another example
In this chapter, you'll see that sendmail uses a variety of configuration files that require
different treatments for their commands to take effect. This little script encapsulates all
the required post configuration steps.
#!/bin/bash
cd /etc/mail
make
newaliases
/etc/init.d/sendmail restart
It first runs the make command, which creates a new sendmail.cf file from the
sendmail.mc file and compiles supporting configuration files in the /etc/mail directory
according to the instructions in the file /etc/mail/Makefile. It then generates new e-mail
aliases with the newaliases command, and then restarts sendmail service.
This statement is incorrectly disabled:
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
define(`SMART_HOST',`mail.my-site.com')
Once this is done, you need to process the sendmail.mc file and restart sendmail.
To do this, run the restarting script we from earlier.
If the sendmail server is a Linux server, then the /etc/hosts file will also have to be
correctly configured too.
dnl
dnl This changes sendmail to only listen on the loopback
dnl device 127.0.0.1 and not on any other network
dnl devices. Comment this out if you want
dnl to accept email over the network.
dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
dnl
...
...
...
dnl
dnl We strongly recommend to comment this one out if you want
dnl to protect yourself from spam. However, the laptop and
dnl users on computers that do
dnl not have 24x7 DNS do need this.
dnl FEATURE(`accept_unresolvable_domains')dnl
dnl FEATURE(`relay_based_on_MX')dnl
dnl
3.) Comment out the SMART_HOST Entry in sendmal.mc. The mail server doesn't need
a SMART_HOST entry in its sendmail.mc file. Comment this out with a dnl at the
beginning.
dnl define(`SMART_HOST',`mail.my-site.com')
4)Regenerate the sendmail.cf file, and restart sendmail. Again, you can do this with
the restart script from the beginning of the chapter.
5) Make sure sendmail is listening on all interfaces (0.0.0.0).
localhost.localdomain RELAY
localhost RELAY
127.0.0.1 RELAY
192.168.1.16 RELAY
192.168.1.17 RELAY
192.168.2 RELAY
my-site.com RELAY
jd.com RELAY
mail.jd.com RELAY
my-site.com
asiancitizen.org
jd.com
[email protected] webmasters
@asiancitizen.org javed
[email protected] [email protected]
[email protected] dogar
[email protected] dogar
@my-site.com error:nouser User unknown
• All other users at my-site.com receive a bounce back message stating "User
unknown".
VNC Server
First check if you already have them installed on your system, open a terminal and type:
If you get an output something like this then you're all ready, if not you need to install
them.
Add a user(s)
Next we need to add at least 1 VNC user, open the file /etc/sysconfig/vncservers as
root and add the information shown:
$ vi /etc/sysconfig/vncservers
VNCSERVERS="1:bobpeers"
VNCSERVERARGS[1]="-geometry 1024x768 -depth 16"
To add some security we need to add a password that must be given before a
connection can be established, open a terminal and type:
$ vncpasswd
Password:
Verify:
This creates a hidden folder called .vnc in your home folder containing the password
file.
$vncserver haseeb
If .vnc directory is not created in user home folder then run above command.
To start the server we type the command 'vncserver' and the session you wish to start
(if you have set up more than 1 entry in the /etc/sysconfig/vncservers file:
$ vncserver :1
Starting VNC server: 1:bobpeers
New 'linux.bobpeers:1 (bobpeers)' desktop is linux.bobpeers:1
[ OK ]
Now the server is started and a user could connect, however they will get a plain grey
desktop by default as the connection will not cause a new session of X to start by
default, to fix this we need to edit the startup script in the .vnc folder in your home
directory.
$ vi ~/.vnc/xstartup
#!/bin/sh
$ vncserver -kill :1
Killing Xvnc process ID 13728
$ vncserver :1
Starting VNC server: 1:bobpeers
New 'linux.bobpeers:1 (bobpeers)' desktop is linux.bobpeers:1
[ OK ]
Using vncviewer
$ vncviewer localhost:5901
This open a dialog as shown for us to enter our password we set earlier, enter the
password and you should now see a copy of your desktop. Note that unlike the Gnome
Remote Desktop this has started a new session of X so any applications open on the
host machine are not visible to the new session, it's basically a whole new logon running
at the same time.
If you just type 'vncviewer' at the prompt then you will asked for the host to connect to,
then you can type localhost:5901 for example. Remember to use the correct port
number when connecting, if you set your VNCSERVERS to be 2000:myname then you
would need to connect on localhost:7900.
$ vncserver -kill :1
Killing Xvnc process ID 13728
Access it through vnc viewer like 172.16.160.199:2 (2 means 2nd user defined
in /etc/sysconfig/vncserver file)