Archive for category centos

CentOS 6 on a Clean Disk Drive

The Live CD image can be downloaded from the mirror sites listed on the CentOS web site at:

Once you have loaded this page into your browser, select either the i386 or x86_64 link depending on whether the target system is a 32-bit or 64-bit platform. Within the next screen select a mirror from the list to view the available downloads and look for a link to download the Live CD image. This will typically be named as follows:


nce you have downloaded the image, burn it to a CD, then make sure your BIOS is configured to boot from the CDROM/DVD drive before the hard disk and then boot from the CD. The system will boot CentOS and you will have a fully functional CentOS environment to explore.

A couple of points should be noted about the Live CD. Firstly, in addition to providing a live, bootable environment in which to try out CentOS 6, the Live CD also provides the ability to install the operating system onto a hard disk drive. Once the live system is running, simply look for the Install to Hard Drive icon on the desktop. Installation from a Live CD involves a preconfigured operating system image being written directly to the disk drive with no control over which packages get installed. Whilst packages may be added and removed post-installation, if detailed control over package selection during installation is required it is necessary to perform the installation using the CentOS 6 installation DVD images.

Secondly, because the Live CD system runs on a virtual disk drive in memory, as soon as you shut down or reboot the system any files you have created will be lost.

Finally, the performance of running an operating system from a CDROM is going to be orders of magnitude slower than running from a disk drive, so don’t be put off by the sluggishness of the system while you are trying it out. This is entirely indicative of the slow speed of CDROM drives, not a reflection of the performance of the operating system.

The Live CD is a good way to quickly get a copy of CentOS 6 up and running without wiping or repartitioning disk drives, but to really appreciate the power of the CentOS 6, you need to install it to a disk drive.

After you decide to install CentOS 6 onto a hard disk drive it is worth keeping the Live CD in a safe place. It is an ideal tool for performing system rescue and maintenance tasks in the event of problems with the installed system.

Obtaining the CentOS 6 Installation Media

An alternative to running the Live CD is to install directly onto a hard disk drive using the CentOS 6 installation media. In addition to installing from within the Live CD, it is also possible to download and install directly from the CentOS 6 installation media. Once again, go to the following URL and select either the 32-bit or 64-bit link to view available download mirrors:

The installation distribution is downloaded in the form of two ISO format DVD images. The DVD images are named using the following convention:


Alternatively, the image may be downloaded using BitTorrent by selecting the corresponding .torrent file.

Having downloaded the DVD images, either burn them to disk or configure your virtualization environment to treat them as virtual DVD drives.

Installing CentOS 6

Insert the first CentOS 6 DVD into the appropriate drive and power on the system. If the system tries to boot from the hard disk drive you will need to enter the BIOS setup menu for your computer and change the boot order so that it boots from the DVD drive first. Once the system has booted you will be presented with the following screen:

The CentOS 6 Boot Screen
To install using the graphical installer, simply select the first installation option and press the <Enter> key. If you encounter problems with the display when the graphical installer begins, reboot and try again with the basic video driver option. Note also that if the host system has insufficient memory or a graphics card is not detected, the installer will run in text mode. To force the installation to take place in text mode, press the Esc key when the above menu screen is displayed and enter linux text at the resulting boot prompt followed by Enter.

Options are also available to boot from the current operating system on the local drive (if one is installed), test the system memory, or rescue an installed CentOS 6 system. The last option alone is reason enough to keep the installation DVD in a safe place in case you need to perform a rescue at some future date.

The CentOS 6 installer will then provide the option to test the installation media for errors. Use the arrow keys to navigate between the options and make a selection with the <Enter> key. After a short delay the first screen of the graphical installer will appear. Navigate through the next few pages to configure your preferred language, keyboard type and storage devices (unless you plan to use a Storage Area Network device, the Basic option is recommended). If the installer detects that the target disk needs to be initialized, a dialog will appear seeking confirmation.

When prompted, enter a suitable host name for the CentOS 6 installation. This is the name by which the system will be identified on the network to which it is attached. Additional network configuration options may be modified by clicking on the Configure Network button, selecting a network interface and clicking on the Edit… button.

Timezone and the Root Password

Subsequent screens will request information about Timezone and the root password of the system.

On the Timezone screen, make a selection corresponding to your geographical location. The option is also provided to use UTC which automatically adjusts the time to account for daylight savings time. If the computer on which CentOS 6 is being installed also runs another operating system which already uses UTC (such as Windows), leave this option unselected.

On the next screen, enter a password for the root account on the system. The root, or super-user account, is a special user that has administrative privileges on the system. Whilst you will generally use your own account to log into the system, you will need to gain root privileges in order to configure the system and to perform other administrative tasks.

The installer will subsequently move on to the disk partitioning screen.

Partitioning a Disk for CentOS 6

When you reach the disk partitioning phase of the installation, the installer will present a screen similar to the one illustrated in the following figure:
CentOS 6 Disk Partitioning options
A number of options are provided for allocating space for the installation of CentOS 6:

  • Use All Space – The entire disk drive will be assigned to the CentOS 6 operating system installation. Any pre-existing partitions, together with any existing operating systems and associated data files contained therein will be deleted to make room for CentOS. This option should only be used if you are absolutely sure you no longer need anything that is currently stored on that disk, or have already backed up all user files.
  • Replace existing Linux System(s) – If the drive was previously configured to support a Windows/Linux dual boot environment or was devoted entirely to another Linux installation, this option may be selected to instruct the installer to delete the pre-existing Linux partition and replace it with CentOS 6. Once again, it is important to backup any user data that may still be needed.
  • Shrink Current system – Allows an existing partition to be reduced in size to make room on the drive for the CentOS 6 installation. More details on this option are provided in a later chapter entitled Installing CentOS 6 with Windows in Dual Boot Environment.
  • Use Free Space – If the current partitions on the drive do not take up the entire disk space available, any unallocated space may be assigned to the CentOS 6 installation using this option.
  • Create Custom Layout – When selected, this option displays the disk partitioning tool allowing each partition on the disk to be manually configured. Unless you have experience with low level disk partitioning this option is not recommended.

we are assuming the entire disk is available to accommodate the CentOS 6 installation so select the Use All Space option.

Beneath the partition menu is the option to encrypt the system. The choice of whether to use encryption will depend on the purpose for which the system is being used, its physical location and type of data it is going to store. Keep in mind that as with any form of encryption there are performance overheads associated with selecting this option.

Having made the partitioning selection, click Next to begin the partitioning process.

Package Selection

Linux is a modular operating system in that it provides a basic operating system kernel and infrastructure upon which a range of different packages may be installed depending on your specific requirements for the system. If, for example, you plan on using the system as a web server you would need to install the Apache web server package.

At this point in the installation the installer needs us to decide which packages should be installed along with the base operating system and displays the screen shown in the following figure:
Making CentOS 6 package installation selections
This screen allows you to make general choices about the type of functions you need the system to perform. Ideally, you should select the option that most closely resembles the intended purpose of the system.

To view or modify the specific package selections, make sure that the Customize now option is selected before proceeding. You will then be provided a complete overview of which packages are selected for installation and which are not together with the ability to make changes to these selections. Don’t worry too much about getting this exactly right at this stage. Packages can be added and removed at any time after the installation is complete by selecting the desktop System -> Administration -> Add/Remove Software menu option. In the interests of security and efficiency it is generally recommended that the minimum number of packages be installed initially and then other packages added on as needed basis once the operating system is up and running.

The Physical Installation

Having made the appropriate package selections, clicking Next will initiate the installation process. During the installation process, the installer will provide a running commentary of the selected packages as they are installed together a progress bar. If you are using the DVD the installation will complete without further interaction. Once the installation process is complete a screen will appear containing a button to reboot the system. Remove the installation media and click the button.

Final Configuration Steps

After the system has started for the first time, the CentOS 6 Setup Agent will appear with a welcome message. Click on the Forward button to display licensing terms and conditions and select the option to accept the terms of the agreement (assuming of course that you do agree to them).

Work through the remaining screens to create a user account for yourself and verify the date and time. If you would like the date and time of your CentOS 6 system to be synchronized with an external Network Time Protocol server, select the Synchronize date and time over network option before proceeding. Finally, choose whether or not to enable Kdump support.

Having worked through all the set up pages, click Finish to exit the setup agent and log in using your newly created account credentials.

Installing Updates

As with most operating systems today, the each particular release of CentOS 6 distribution continues to evolve after it has been released to the public. This generally takes the form of bug fixes and security updates and, occasionally, new features that may be downloaded over the internet and installed on your system.

Best practices dictate that the first step after installing CentOS 6 is to make sure any available updates are applied to the system. This can be achieved either through the desktop environment or via the command-line prompt in a Terminal window. The CentOS 6 desktop environment places an indicator in the top desktop panel to notify the user that updates are available to be applied to the system. This indicator takes the form of orange star with a bug crawling on it. Moving the mouse pointer over this icon will display a message indicating the number of updates that are currently available for the system as illustrated in the following figure:
CentOS 6 Update availability Indicator
To identify and apply updates using the graphical software update tool, either click on the toolbar icon or select the System -> Administration -> Software Update desktop menu option. The resulting dialog will download a list of available updates and provide the option for those updates to be applied to the system:
CentOS 6 Software Updates tool
Clicking the Install Updates button will begin the update process which consists of resolving package dependencies, downloading and installation of the updates. The duration of the update process will depend on the number and size of updates available combined with the speed of the internet connection to which the CentOS system is connected.

The latest updates may also be applied from within a terminal window (Applications -> System Tools -> Terminal) using the yum command:

su –
yum update

Upon execution, the yum tool will provide a list of packages that are available for update and prompt to perform the update. Once the update is complete the installation is essentially finished and CentOS 6 is ready for use.


Leave a comment

Configuring a CentOS 6 Postfix Email Server

Along with acting as a web server, email is one of the primary uses of a CentOS 6 based system, particularly in business environments. Given both the importance and popularity of email it is surprising to some people to find out how complex the email structure is on a Linux system and this complexity can often be a little overwhelming to the CentOS newcomer.

The good news is that much of the complexity is there to allow experienced email administrators to achieve complicated configurations for large scale enterprise installations. The fact is that for most Linux users it is relatively straight forward to set up a basic email system so that they can send and receive electronic mail.

In this chapter of CentOS 6 Essentials, we will explain the basics of Linux based email configuration and step through configuring a basic email environment. In the interests of providing the essentials, we will leave the complexities of the email system for more advanced books on the subject.



  • 1 The structure of the Email System
    • 1.1 Mail User Agent
    • 1.2 Mail Transfer Agent
    • 1.3 Mail Delivery Agent
    • 1.4 SMTP
  • 2 Configuring a CentOS 6 Email System
  • 3 Postfix Pre-Installation Steps
  • 4 Installing Postfix on CentOS 6
  • 5 Configuring Postfix
  • 6 Starting Postfix on a CentOS 6 System

The structure of the Email System

There are a number of components that make up a complete email system. Below is a brief description of each one:

Mail User Agent

This is the part of the system that the typical user is likely to be most familiar with. The Mail User Agent (MUA), or mail client, is the application that is used to write, send and read email messages. Anyone who has written and sent a message on any computer has used a Mail User Agent of one type or another.

Typical Graphical MUA’s on Linux are Evolution, Thunderbird and KMail. For those who prefer a text based mail client, there are also the more traditional pine and mail tools.

Mail Transfer Agent

The Mail Transfer Agent (MTA) is the part of the email system that does much of the work of transferring the email messages from one computer to another (either on the same local network or over the internet to a remote system). Once configured correctly, most users will not have any direct interaction with their chosen MTA unless they wish to re-configure it for any reason. There are many choices of MTA available for Linux including sendmail, Postfix, Fetchmail, Qmail and Exim.

Mail Delivery Agent

Another part of the infrastructure that is typically hidden from the user, the Mail Delivery Agent (MDA) sits in the background and performs filtering on the email messages between the Mail Transfer Agent and the mail client (MUA). The most popular form of MDA is a spam filter to remove all the unwanted email messages from the system before they reach the inbox of the user’s mail client (MUA). Popular MDAs are Spamassassin and Procmail. It is important to note that some Mail User Agent applications (such as Evolution, Thunderbird and KMail) include their own MDA filtering. Others, such as Pine and Basla, do not. This can be a source of confusion to the Linux beginner.


SMTP is an acronym for Simple Mail Transport Protocol. This is the protocol used by the email systems to transfer mail messages from one server to another. This protocol is essentially the communications language that the MTAs use to talk to each other and transfer messages back and forth.

Configuring a CentOS 6 Email System

Many systems use the Sendmail MTA to transfer email messages and on many Linux distributions this is the default Mail Transfer Agent. Sendmail is, however, a complex system that can be difficult for beginner and experienced user alike to understand and configure. It is also falling from favor because it is considered to be slower at processing email messages than many of the more recent MTAs available.

Many system administrators are now using Postfix or Qmail to handle email. Both are faster and easier to configure than Sendmail.

For the purposes of this chapter, therefore, we will look at Postfix as an MTA because of its simplicity and popularity. If you would prefer to use Sendmail there are many books that specialize in the subject and that will do the subject much more justice than we can in this chapter.

Postfix Pre-Installation Steps

The first step before installing Postfix is to make sure that Sendmail is not already running on your system. You can check for this using the following command:

/sbin/service sendmail status

If sendmail is not installed, the tool will display a message similar to the following:

sendmail: unrecognized service

If sendmail is installed, but not running the following output will be displayed:

sendmail is stopped

If sendmail is running you will see the following:

sendmail (pid 2138) is running

If sendmail is running on your system it is necessary to stop it before installing and configuring Postfix. To stop sendmail run the following command as super user:

/sbin/service sendmail stop

The next step is to ensure that sendmail does not get restarted automatically when the system is rebooted. The first step is to find out which run levels will automatically start sendmail. To do this we can use the chkconfig command-line tool as follows:

/sbin/chkconfig --list | grep sendmail

The above command will typically result in output similar to:

sendmail     0:off   1:off   2:on   3:on   4:on    5:on   6:off

This means that if the system boots into runlevels 2, 3, 4 or 5 then the sendmail service will automatically start. To turn off sendmail we can once again use the chkconfig command as follows:

/sbin/chkconfig sendmail off

The chkconfig tool defaults to changing the settings for runlevels 2, 3, 4 and 5. You can configure for specific runlevels using the –levels command line option if necessary.

To verify the settings run chkconfig one more time as follows:

/sbin/chkconfig --list | grep sendmail

And check that the output is as follows:

sendmail  0:off  1:off   2:off   3:off  4:off   5:off   6:off

Sendmail is now switched off and configured so that it does not auto start when the system is booted. We can now move on to installing Postfix.

Installing Postfix on CentOS 6

By default, the CentOS 6 installation process installs Postfix for most configurations. To verify if Postfix is already installed, use the following rpm command in a Terminal window:

rpm -q postfix

If rpm reports that postfix is not installed, it may be installed as follows:

su -
yum install postfix

The yum tool will download and install postfix, and configure a special postfix user in the /etc/passwd file.

Configuring Postfix

The main configuration settings for Postfix are located in the /etc/postfix/ file. There are many resources on the internet that provide detailed information on Postfix so this section will focus on the basic options required to get email up and running.

The key options in the file are:

myhostname =
mydomain =
myorigin = $myhostname
inet_interfaces = $myhostname

Other settings will have either been set up for you by the installation process or are not needed unless you are feeling adventurous and want to configure a more sophisticated email system.

The format of myhostname is host.domain.extension. For example if your Linux system is called MyLinuxHost and your internet domain is you would set the myhostname option as:

myhostname =
The mydomain setting is just the domain part of the above setting. For example: 
mydomain =

The myorigin and inet_interfaces options use the settings we have just created so do not need to be changed (although the inet_interfaces may be commented out by default so you should remove the # at the beginning of this particular line in the file).

Starting Postfix on a CentOS 6 System

Once the /etc/postfix/ file is configured with the correct settings it is now time to start up postfix. This can be achieved from the command line as follows:

/usr/sbin/postfix start

The postfix process should now start up. The best way to check that everything is working is to check your mail log. This is typically in /var/log/maillog and should now contain an entry that looks like:

Nov 21 13:05:46 mylinuxhost postfix/postfix-script: starting the Postfix mail system Nov 21 13:05:46 mylinuxhost postfix/master[10334]: daemon started -- version 2.2.5, 
configuration /etc/postfix

As long as you don’t see any error messages you have successfully installed and started Postfix and you are ready to set up a mail client and start communicating with the outside world.

To configure Postfix to start automatically at system startup, run the following command in a Terminal window:

/sbin/chkconfig --level 345 postfix on

Leave a comment

Configuring a CentOS 6 Based Web Server

Amongst the many packages that make up the CentOS 6 operating system is the Apache web server. In fact the scalability and resilience of CentOS 6 makes it an ideal platform for hosting even the most heavily trafficked web sites.

In this chapter we will explain how to configure a CentOS 6 system using Apache to act as a web server.



  • 1 Requirements for Configuring a CentOS 6 Web Server
  • 2 Installing the Apache Web Server on CentOS 6
  • 3 Starting the Apache Web Server
  • 4 Testing the Web Server
  • 5 Configuring the Apache Web Server for Your Domain
  • 6 Web Server and Firewall Issues

Requirements for Configuring a CentOS 6 Web Server

To set up your own web site you need a computer, an operating system, a web server, a domain name, a name server and an IP address.

The computer can be any system capable of running Linux. In terms of an operating system, we will, of course, assume you are using CentOS 6. As previously mentioned CentOS supports the Apache web server which can easily be installed once the operating system is up and running. A domain name can be registered with any domain name registration service.

If your ISP provides static IP addresses then you will need to associate your domain with your static IP address. This is achieved using a name server. Most domain registration services will provide this service for you.

If you do not have a static IP address (i.e. your ISP provides you with a dynamic address which changes frequently) then you can use one of a number of free services which map your dynamic IP address to your domain name. One such service is provided by

Once you have your domain name and your name server configured the next step is install and configure your web server.

Installing the Apache Web Server on CentOS 6

The current release of CentOS typically does not install the Apache web server by default. To check whether the server is already installed, open a Terminal window (Applications -> System Tools -> Terminal) and run the following command:

rpm -q httpd

If rpm generates output similar to the following, the apache server is already installed:


Alternatively, if rpm generates a “package httpd is not installed” message then the next step, obviously, is to install it. This can be performed either from the command-line or using the Add/Remove Software tool. To use this tool, open the System -> Administration desktop menu and select Add/Remove Software. Enter your root password if prompted to do so. Select the Search tab and search for httpd. After the search completes the Apache HTTP Server should be listed in the search results. Click on the toggle next to the httpd server. Finally, click on the Apply button to begin the installation.

To install Apache from the command-line start a terminal window (Applications -> System Tools -> Terminal) and run the following commands at the command prompt:

su -
yum install httpd

Starting the Apache Web Server

Once the Apache server is installed, the next step is to verify that the server is running and, if it is not yet running, to start it.

The status of the server can be verified from the command-line or via the GUI Service Configuration tool. To check the status of the Apache httpd service from the command-line, enter the following command in a Terminal window:

/sbin/service httpd status

If the above command indicates that the httpd service is not running, it can be launched from the command-line as follows:

su -
/sbin/service httpd start

If you would like the Apache httpd service to start automatically when the system boots (for example when booting to runlevel 3), this can be achieved by running the following command:

/sbin/chkconfig --level 3 httpd on

For more information on runlevels refer to the chapter entitled Configuring CentOS 6 Runlevels and Services.

To configure the Apache service using the Service Configuration tool, select the System -> Administration -> Services menu option and scroll down the list of services until you find httpd. Select the item in the list and click on the Start button.

Testing the Web Server

Once the installation is complete the next step is to verify the web server is up and running. To do this fire up the web browser by clicking on the web browser icon in the top desktop panel and enter in the address bar ( is the loop-back network address which tells the system to connect to the local machine). The browser should load the CentOS Test Page:
The Apache test page on CentOS 6
Congratulations, you have now installed the web server and served up what will hopefully be the first of many web pages.

Configuring the Apache Web Server for Your Domain

The next step in setting up your web server is to configure it for your domain name. This is performed in the /etc/httpd directory. To configure the web server open a terminal window and change directory to /etc/httpd. In this directory you will find a number of sub-directories. Change directory into the conf sub-directory where you will find an httpd.conf file which contains the configuration settings for the Apache server.

Edit the httpd.conf’ file using your favorite editor using the su command to ensure you have write permission to the file. Once loaded, there are a number of settings that need to be changed to match your environment.

The ServerAdmin directive defines an administrative email address for people wishing to contact the webmaster for your site. Change this to an appropriate email address where you can be contacted:


Next the ServerName and ServerAlias directives need to be defined so that the web server knows which virtual host this configuration file refers to:


Next, we need to define where the web site files are going to be located using the DocumentRoot directive. The tradition is to use /var/www/domain-name:

DocumentRoot /var/www/

Next, create the /var/www/ directory and place an index.html file in it. For example:

<title>Sample Web Page</title>
Welcome to

The last step is to restart the apache web server to make sure it picks up our new settings:

su - 
/sbin/service httpd restart

Web Server and Firewall Issues

If your CentOS 6 system is configured to use a firewall, you will need to ensure that HTTP traffic on port 80 is permitted in order for external systems to be able to access your web server. Refer to Basic CentOS 6 Firewall Configuration for details on configuring a CentOS Firewall.

If the CentOS 6 system hosting your web server sits on a network protected by a firewall (either another computer running a firewall, or a router or wireless base station containing built in firewall protection) you will need to configure the firewall to forward port 80 to your web server system. The mechanism for performing this differs between firewalls and devices so check your documentation to find out how to configure port forwarding.

Once everything is configured it should be possible to enter the domain name of your web site into a browser anywhere in the world and access your web server.

Leave a comment

Sharing Files between CentOS 6 and Windows Systems with Samba

Although Linux is increasingly making inroads into the desktop market, its origins are very much server based. It is not surprising therefore that CentOS 6 has the ability to act as a file server. It is also extremely common for CentOS and Windows systems to be used side by side in networked environments. It is a common requirement, therefore, that files on a CentOS 6 system be accessible to Linux, UNIX and Windows based systems over network connections. Similarly, shared folders and printers residing on Windows systems must also be accessible from CentOS based systems.

Windows systems share resources such as file systems and printers using a protocol called Server Message Block (SMB). In order for a CentOS 6 system to serve such resources over a network to a Windows system and vice versa it must, therefore, support SMB. This is achieved using technology called Samba. In addition to providing integration between Linux and Windows systems, Samba may also be used to provide folder sharing between Linux systems (as an alternative to NFS which was covered in the previous chapter).

In this chapter we will look at the steps necessary to share file system resources and printers on a CentOS 6 system with remote Windows and Linux systems.



  • 1 Samba and Samba Client
  • 2 Installing Samba on a CentOS 6 System
  • 3 Configuring the CentOS 6 Firewall to Enable Samba
  • 4 Configuring the smb.conf File
  • 5 Configuring the [global] Section
  • 6 Configuring a Shared Resource
  • 7 Creating a Samba User
  • 8 Testing the smb.conf File
  • 9 Starting the Samba and NetBIOS Name Services on CentOS 6
  • 10 Accessing Samba Shares
  • 11 Accessing Windows Shares from CentOS 6
  • 12 Summary

Samba and Samba Client

Samba allows both CentOS resources to be shared with Windows systems and Windows resources to be shared with CentOS systems. CentOS accesses Windows resources using a package named samba-client. CentOS resources, on the other hand, are shared with Windows systems using a package named samba. Typically, the samba-client is installed and configured by default allowing the user to browse available Windows resources without any additional work (this is covered later in the chapter). In order to allow a CentOS 6 system to share resources with Windows systems, however, some more work is required.

Installing Samba on a CentOS 6 System

The default settings used during the CentOS 6 installation process do not install the samba package. Unless you specifically requested that Samba be installed it is unlikely that you have Samba installed on your system. To check whether Samba is installed, open a terminal window (Applications -> System Tools -> Terminal) and run the following rpm command:

rpm -q samba

If Samba is installed, the rpm command will generate output similar to the following:


If Samba is not installed, rpm will return with “package samba is not installed”. That being the case, it can be installed using the yum command-line tool:

su -
yum install samba

The above command will install both the samba package and the samba-common dependency package.

If you prefer to use the graphical tool to perform the Samba installation, select Applications -> Add/Remove Software, enter the root password if prompted to do so and then perform a search for Samba. When the list of matching packages appears, set the checkbox next to the samba and samba-common packages and click on Apply to initiate the installation.

Configuring the CentOS 6 Firewall to Enable Samba

Next, the firewall currently protecting the CentOS 6 system needs to be configured to allow Samba traffic. To achieve this, run the Firewall Configuration tool by selecting the System -> Administration -> Firewall menu option and select the check box next to Samba in the Trusted Services section of the tool. Click Apply and OK to commit the change.

Before any resources on the CentOS system can be accessed from the Windows systems, however, some additional configuration steps are necessary.

Configuring the smb.conf File

In releases of CentOS prior to version 6, a user friendly graphical tool named system-config-samba was provided to assist in the configuration of Samba. In CentOS 6, however, this tool has been removed. This means that the Samba environment must be configured manually within the /etc/samba/smb.conf file and using the smbpasswd command line tool. Whilst the loss of system-config-samba may be mourned by those who relied on it, the tool’s simplicity actually masked many of the more advanced features of Samba. In practice, much more can be achieved by taking the time to understand the intricacies of the smb.conf file.

Samba is a highly flexible and configurable system that provides many different options for controlling how resources are shared on Windows networks. This flexibility can lead to the sense that Samba is overly complex to work with. In reality, however, many of the configuration options are not needed by the typical installation, and the learning curve to set up a basic configuration is actually quite short.

For the purposes of this chapter we will look at joining a CentOS 6 system to a Windows workgroup and setting up a directory as a shared resource that can be accessed by a specific user.

The first step, therefore, is to gain root privileges and to load the /etc/samba/smb.conf file into a suitable editor, for example:

su –
gedit /etc/samba/smb.conf

Configuring the [global] Section

The smb.conf file is divided into sections. The first section is the [global] section where settings can be specified that apply to the entire Samba configuration. Whilst these settings are global, each option may be overridden within other sections of the configuration file.

The first task is to define the name of the Windows workgroup on which the CentOS 6 resources are to be shared. This is controlled via the workgroup = directive of the [global] section which by default is configured as follows:

workgroup = MYGROUP

Begin by changing this to the actual name of the workgroup. For example, if the workgroup is named WORKGROUP (the default for most Windows networks):

workgroup = workgroup

Configuring a Shared Resource

The next step is to configure a shared resource (in other words a resource that will be accessible from other systems on the Windows network). In order to achieve this, the section is given a name by which it will be referred to when shared. For example, if we plan to share the /tmp directory of our CentOS 6 system, we might entitle the section [tmp]. In this section a variety of configuration options are possible. For the purposes of this example, however, we will simply define the directory that is to be shared, indicate that the directory is browsable and writable and declare the users that are allowed to access the shared resource (in this case a user named demo):

        path = /tmp
        writeable = yes
        browseable = yes
        valid users = demo

Creating a Samba User

Any user that requires access to a Samba shared resource must be configured as a Samba User and assigned a password. This task is achieved using the smbpasswd command line tool. In our example smb.conf file we stated the user demo is entitled to access the /tmp directory of our CentOS 6 system. In order to fulfill this requirement, therefore, we must add demo as a samba user as follows:

# su - 
# smbpasswd -a demo
New SMB password:
Retype new SMB password:
Added user demo.

Now that we have completed the configuration of a very basic Samba server, it is time to test our configuration file and then start the Samba services.

Testing the smb.conf File

The settings in the smb.conf file may be tested using the testparm command line tool as follows:

# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: rlimit_max (1024) below minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[tmp]"
Loaded services file OK.
Press enter to see a dump of your service definitions

        server string = Samba Server Version %v
        log file = /var/log/samba/log.%m
        max log size = 50
        cups options = raw

        comment = Home Directories
        read only = No
        browseable = No

        comment = All Printers
        path = /var/spool/samba
        printable = Yes
        browseable = No

        path = /tmp
        valid users = demo
        read only = No

Starting the Samba and NetBIOS Name Services on CentOS 6

In order for a CentOS 6 server to operate within a Windows network both the Samba (SMB) and NetBOIS nameservice (NMB) services must be started. To identify if the services are already running, the following command may be executed with root privileges in a terminal window:

su –
/sbin/service smb status
smbd is stopped
# /sbin/service nmb status
nmbd is stopped

If the services are reported as currently running and you have made changes to the smb.conf file it will be necessary to restart the services in order to pick up the changes:

/sbin/service smb restart
/sbin/service nmb restart

If, on the other hand, the services are currently stopped, start them as follows:

/sbin/service smb start
/sbin/service nmb start

Accessing Samba Shares

Now that the Samba resources are configured and the services are running, it is time to access the shared resource from a Windows system. On a suitable Windows system on the same workgroup as the CentOS 6 system, open Windows Explorer and navigate to the Network panel. At this point, explorer should search the network and list any systems using the SMB protocol that it finds. The following figure illustrates a CentOS 6 system named CentOS6 located using Windows Explorer on a Windows 7 system:
Accessing CentOS 6 resources from Windows using Samba
Double clicking on the CentOS 6 host will prompt for the name and password of a user with access privileges. In this case it is the demo account that we configured using the smbpasswd tool. Entering the username and password will result in the shared resources configured for that user appearing the explorer window, including the tmp resource previously configured:
Accessing Samba Servers from Windows
Double clicking on the tmp shared resource will display a listing of the files and directories contained therein.

Accessing Windows Shares from CentOS 6

As previously mentioned, Samba is a two way street, allowing not only Windows systems to access files and printers hosted on a CentOS 6 system, but also allowing the CentOS system to access shared resources on Windows systems. This is achieved using the samba-client package which is installed by default under most CentOS 6 configurations. If it is not currently installed, install it from a Terminal window as follows:

su –
yum install samba-client

To access any shared resources on a Windows system, begin by selecting the Places -> Network desktop menu option. This will display the Network browser dialog including an icon for the Windows Network (if one is detected) as illustrated in the following figure:
Accessing Windows networks from CentOS 6 using Samba
To obtain a list of Windows workgroups on the network, double click on the Windows Network icon. From within the list of workgroups double click on the desired group to obtain a listing of servers available for access:
Accessing Windows systems from CentOS 6 using Samba
Finally, double clicking on a computer will list the shared resources available for access from the CentOS client.


In this chapter we have looked at the steps necessary to configure a CentOS 6 system to act as both a Samba client and server allowing the sharing of resources with other systems on a Windows based network. In the case of Samba server configuration in particular we have only scratched the surface of the configuration options available. A full over of Samba would require an entire book. Many such publications and online resources are available if you would like to learn more. Another good place to start is to type man samba in a terminal window.


Leave a comment

OpenSSH Security Tips

OpenSSH is tool used for connecting and managing remote linux machines. And this should be secured. I am here by telling some security tips to make the SSH server perfect.

1.The following iptable rule will drop incoming connections which make more than 5 connection attempts upon port 22 within 60 seconds

iptables -I INPUT -p tcp –dport 22 -i eth0 -m state –state NEW -m recent –set
iptables -I INPUT -p tcp –dport 22 -i eth0 -m state –state NEW -m recent –update –seconds 60 –hitcount 5 -j DROP

2.Disable Empty Passwords

Open the file /etc/sshd/sshd_config and

PermitEmptyPasswords no


open –> vi /etc/hosts.deny


open –> vi /etc/hosts.allo

sshd: (Change to your desired IP)

4.Change the SSH Port

The Idea behind this , suppose we change the port 22 to something other say Oracle 1521 , the attackers thinks that this is an Oracle server and will try oracle hacking tools 🙂

Port 300

5.Force Logout for Idle Sessions
ClientAliveInterval 300
ClientAliveCountMax 0

Leave a comment

Learn Linux

1. What is Linux?

Linux is a free Unix-type operating system for computer devices. The operating system is what makes the hardware work together with the software. The OS is the interface that allows you to do the things you want with your computer. Linux is freely available to everyone. OS X and Windows are other widely used OS.

Linux gives you a graphical interface that makes it easy to use your computer, yet it still allows those with know-how to change settings by adjusting 0 to 1.

It is only the kernel that is named Linux, the rest of the OS are GNU tools. A package with the kernel and the needed tools make up a Linux distribution. Mandrake , SUSE Linux, Gentoo and Redhat are some of the many variants. GNU/Linux OS can be used on a large number of boxes, including i386+ , Alpha, PowerPC and Sparc.

2. Understanding files and folders

Linux is made with one thought in mind: Everything is a file.

A blank piece of paper is called a file in the world of computers. You can use this piece of paper to write a text or make a drawing. Your text or drawing is called information. A computer file is another way of storing your information.

If you make many drawings then you will eventually want to sort them in different piles or make some other system that allows you to easily locate a given drawing. Computers use folders to sort your files in a hieratic system.

A file is an element of data storage in a file system (file systems manual page). Files are usually stored on harddrives, cdroms and other media, but may also be information stored in RAM or links to devices.

To organize our files into a system we use folders. The lowest possible folder is root / where you will find the user homes called /home/.


Behind every configurable option there is a simple human-readable text file you can hand-edit to suit your needs. These days most programs come with nice GUI (graphical user interface) like Mandrakes Control Center and Suses YAST that can smoothly guide you through most configuration. Those who choose can gain full control of their system by manually adjusting the configuration files from foo=yes to foo=no in an editor.

Almost everything you do on a computer involves one or more files stored locally or on a network.

Your filesystems lowest folder root / contains the following folders:

/bin Essential user command binaries (for use by all users)
/boot Static files of the boot loader, only used at system startup
/dev Device files, links to your hardware devices like /dev/sound, /dev/input/js0 (joystick)
/etc Host-specific system configuration
/home User home directories. This is where you save your personal files
/lib Essential shared libraries and kernel modules
/mnt Mount point for a temporarily mounted filesystem like /mnt/cdrom
/opt Add-on application software packages
/usr /usr is the second major section of the filesystem. /usr is shareable, read-only data. That means that /usr should be shareable between various FHS-compliant hosts and must not be written to. Any information that is host-specific or varies with time is stored elsewhere.
/var /var contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files.
/proc System information stored in memory mirrored as files.

The only folder a normal user needs to use is /home/you/ – this is where you will be keeping all your documents.


Files are case sensitive, “myfile” and “MyFile” are two different files.

For more details, check out:

3. Understanding users and permissions

Linux is based on the idea that everyone using a system has their own username and password.

Every file belongs to a user and a group, and has a set of given attributes (read, write and executable) for users, groups and all (everybody).

A file or folder can have permissions that only allows the user it belongs to to read and write to it, allowing the group it belongs to to read it and at the same time all other users can’t even read the file.

4. Who and what is root

Linux has one special user called root (this is the user name). Root is the “system administrator” and has access to all files and folders. This special user has the right to do anything.

You should never log on as this user unless you actually need to do something that requires it!

Use su - to temporary become root and do the things you need, again: never log into your sytem as root!

Root is only for system maintenance, this is not a regular user (LindowsOS don’t have any user management at all and uses root for everything, this is a very bad idea!).

You can execute a command as root with:

su -c 'command done as root'

Gentoo Linux: Note that on Gentoo Linux only users that are member of the wheel group are allowed to su to root.

5. Opening a command shell / terminal

To learn Linux, you need to learn the shell command line in a terminal emulator.

In KDE: K -> System -> Konsoll to get a command shell)

Pressing CTRL-ALT-F1 to CTRL-ALT-F6 gives you the console command shell windows, while CTRL-ALT-F7 gives you XFree86 (the graphical interface).

xterm (manual page) is the standard XFree console installed on all boxes, run it with xterm (press ALT F2 in KDE and Gnome to run commands).

Terminals you probably have installed:

Non-standard terminals should install:

6. Your first Linux commands

Now you should have managed to open a terminal shell and are ready to try your first Linux commands. Simply ask the computer to do the tasks you want it to using it’s language and press the enter key (the big one with an arrow). You can add a & after the command to make it run in the background (your terminal will be available while the job is done). It can be practical to do things like moving big divx movies as a background process: cp movie.avi /pub &. Jobs – the basics of job control

6.1. ls – short for list

ls lists the files in the current working folder. This is probably the first command to try out. It as a number of options described on the ls manpage.



ls -al --color=yes

6.2. pwd – print name of current/working directory

pwd prints the fully resolved name of the current (working) directory. pwd manpage.

6.3. cd – Change directory

cd stands for change (working) directory and that’s what it does. The folder below you (unless you are in /, where there is no lower directory) is called “..”.

To go one folder down:

cd ..

Change into the folder Documents in your current working directory:

cd Documents

Change into a folder somewhere else:

cd /pub/video

The / in front of pub means that the folder pub is located in the / (lowest folder).

7. The basic commands

7.1. chmod – Make a file executable

To make a file executable and runnable by any user:

chmod a+x myfile

Refer to the chmod manual page for more information.

7.2. df – view filesystem disk space usage

df -h

  Filesystem Size  Used Avail Use% Mounted on
  /dev/hda3   73G   67G  2.2G  97% /
  tmpfs      2.0M   24K  2.0M   2% /mnt/.init.d
  tmpfs      252M     0  252M   0% /dev/shm

The flags: -h, –human-readable Appends a size letter such as M for megabytes to each size.

df manpage

7.3. du – View the space used by files and folders

Use du (Disk Usage) to view how much space files and folders occupy. Read the du manual page for flags and usage.

du is a part of fileutils.

Example du usage:

  du -sh Documents/
  409M    Documents

7.4. mkdir – makes folders

Folders are created with the command mkdir:

mkdir folder

To make a long path, use mkdir -p :

mkdir -p /use/one/command/to/make/a/long/path/

Like most programs mkdir supports -v (verbose). Practical when used in scripts.

You can make multiple folders in bash and other shells with {folder1,folder2} :

mkdir /usr/local/src/bash/{old,new,dist,bugs}

mkdir manual page

The command rmdir removes folders.

7.5. passwd – changes your login password

To change your password in Linux, type:


The root user can change the password of any user by running passwd with the user name as argument:

passwd jonny

will change jonnys password. Running passwd without arguments as root changes the root password.

If you need to add several new users and give them password you can use a handy program like Another Password Generator to generate a large set of “random” passwords.

7.5.1. KDE

From KDE you can change your password by going:

  • K -> Settings -> Change Password
  • K -> Settings -> Control Center -> System Administration -> User Account

7.6. rm – delete files and folders, short for remove

Files are deleted with the command rm:

  rm /home/you/youfile.txt

To delete folders, use rm together with -f (Do not prompt for confirmation) and -r (Recursively remove directory trees):

  rm -rf /home/you/foo/

Like most programs rm supports -v (verbose).

rm manual page

7.7. ln – make symbolic links

A symbolic link is a “file” pointing to another file.

To make a symbolic link :

  ln /original/file /new/link

This makes /original/file and /new/link the same file – edit one and the other will change. The file will not be gone until both /original/file and /new/link are deleted.

You can only do this with files. For folders, you must make a “soft” link.

To make a soft symbolic link :

  ln -s /original/file /new/link


  ln -s /usr/src/linux-2.4.20 /usr/src/linux

Note that -s makes an “empty” file pointing to the original file/folder. So if you delete the folder a symlink points to, you will be stuck with a dead symlink (just rm it).

ln manual page

7.8. tar archiving utility – tar.bz2 and tar.gz

tar (manual page) is a very handle little program to store files and folders in archives, originally made for tapestreamer backups. Tar is usually used together with gzip (manual page) or bzip2 (manual page), comprepssion programs that make your .tar archive a much smaller .tar.gz or .tar.bz2 archive.


You can use the program ark (K -> Utilities -> Ark) to handle archives in KDE. Konqueror treats file archives like normal folders, simply click on the archive to open it. The archive becomes a virtual folder that can be used to open, add or remove files just as if you were working with a normal folder.

7.8.1. tar files (.tar.gz)

To untar files:

  tar xvzf file.tar.gz

To tar files:

  tar cvzf file.tar.gz filedir1 filedir2 filedir2...

Note: A .tgz file is the same as a .tar.gz file. Both are also often refered to as tarballs.

The flags: z is for gzip, v is for verbose, c is for create, x is for extract, f is for file (default is to use a tape device).

7.8.2. bzip2 files (.tar.bz2)

To unpack files:

  tar xjvf file.tar.bz2

To pack files:

  tar cvjf file.tar.bz2 filedir1 filedir2 filedir2...

The flags: Same as above, but with j for for bzip2

You can also use bunzip2 file.tar.bz2&nbsp;, will turn it into a tar.

For older versions of tar, try tar -xjvf or -xYvf or -xkvf to unpack.There’s a few other options it could be, they couldn’t decide which switch to use for bzip2 for a while.

How to untar an entire directory full or archives?


for i in `ls *.tar`; do tar xvf $i; done

.tar.gz: for i in `ls *.tar.gz`; do tar xvfz $i; done

.tar.bz2: for i in `ls *.tar.bz2`; do tar xvfj $i; done

Leave a comment

Installing VLC Player on RHEL 6 CentOS 6.x | 32 bit | 64 bit ( x86_64) | Using Script

Following things must exist on your Computer/Linux to execute this script:-

=> Direct Working Internet Connection or Yum Should run from Terminal. If you are using Internet connection with Proxy then it will be problematic for you.

=> RHEL 6.x and CentOS 6.x must be installed with 32bit or X86_64 Arch.

This time couple of addition steps to make it more simple. So This time VLC Installation in 7 Steps.

Perform Following Steps to Install VLC Player on RHEL 6.x / Cent OS 6.x on 32 or 64Bit :-

1) You have to be root to execute this script.

2) Download RPM ( Auto VLC Redhat Centos6) which I have specially created for VLC Installation Script , You can use RPMs for CentOS 6 too.Click on Following link to Download RPM for Your Architecture :-

32 bit Users click on this link :-

64 bit Users click on this link :-

3) Execute Following Commands as per your Respective architecture :-

For 32 Bit Architecture :-

# rpm -ivh avrc6-tejas-barot-linux-0.1.0-1.el6.i386.rpm

For 64(X86_64) bit Architecture :-

# rpm -ivh avrc6-tejas-barot-linux-0.1.0-1.el6.x86_64.rpm

4) Download VLC Installation Script for RHEL6 and CentOS 6 , Click this link :-

5) Execute following Command where you have downloaded the script.
[root@ask4itsolutions ~]# chmod +x

6). Now Execute your script by two ways mentioned below

[root@ask4itsolutions ~]# sh
[root@ask4itsolutions ~]# ./

7) Once you Execute it will ask you 4 Options to Install as per your OS and Architecture and 5th Option for Exit Select Option as per your OS and Architecture

Press (R32) to Install VLC on RHEL 6.x on 32bit
Press (R64) to Install VLC on RHEL 6.x on 64bit

Press (C32) to Install VLC on CentOS 6.x on 32bit
Press (C64) to Install VLC on CentOS 6.x on 64bit
Press (E) to Exit anytime

Please Enter your Selection: <Put Your Option Here and Press Enter>

8) Remember you have to be normal user to run VLC Player, You cannot Run VLC Player as root.

Hope You like this.

Please Click on Google +1 button and Add your ratings if this works for you and you like it.

If this works for you then Show your support and encourage me to write some more howto’s by commenting on the same topic or by sending me mail on blog(at)tejasbarot(dot)com

If this doesn’t work for you then also please do let me know so i can helps you out to solve the issue, If you are facing the error then please send me mail on blog(at)tejasbarot(dot)com with Subject:- VLC Installation Issue


Enjoy Ubuntu 11.10 Oneiric Ocelot :) Enjoy Ubuntu  :) Enjoy Open Source :) Enjoy Linux :)

All Linux User’s Blog Mobile Applications :-

Enjoy VLC on Linux :)


Leave a comment