You are on page 1of 41

UNIT-1

Overview of FOSS:
Free Software:
―Free software‖ means software that respects users‘ freedom and
community. Roughly, it means that the users have the freedom to run, copy,
distribute, study, change and improve the software. The term ―free software‖
is sometimes misunderstood—it has nothing to do with price. It is about
freedom.
Advantages:
 Cost: Free software is typically free to use, modify and distribute.
 Freedom: Free software is often accompanied by a set of ethical
principles that promote users‘ freedom to use, study, modify, and share
the software.
 Collaboration: Free software often encourages collaboration among
developers and users, leading to faster development and better quality
software.
 Transparency: Free software is often developed in a transparent way,
with the source code and development process available for public
scrutiny.
 Flexibility: Free software can be used on a wide range of platforms and
devices.

Disadvantages:
 Support: While free software does have a community of developers and
users, it may not always have the same level of professional support as
commercial software.
 Compatibility: Free software may not always be compatible with other
software applications and hardware devices.
 Security: Because free software is available for everyone to use and
modify, it may be easier for malicious actors to identify and exploit
vulnerabilities.
 Complexity: Free software can be more complex and difficult to use than
commercial software, especially for non-technical users.
 Documentation: Free software may not always have the same level of
documentation and user guides as commercial software.
Open Source Software:
Open Source Software is something that you can modify as per your needs,
and share with others without any licensing violation burden. When we say
Open Source, the source code of the software is available publicly with Open
Source licenses like GNU (GPL) which allows you to edit the source code
and distribute it. Read these licenses and you will realize that these licenses
are created to help us.
1. Coined by the development environments around software produced by
open collaboration of software developers on the internet.
2. Later specified by the Open Source Initiative (OSI).
3. It does not explicitly state ethical values, besides those directly
associated with software development.
Advantages:
 Cost: Open source software is typically free to use, modify and distribute.
 Customization: The source code of open source software is available to
everyone, allowing users to modify and customize it to suit their needs.
 Community support: Open source software often has a large community
of developers and users who contribute to its development and provide
support.
 Transparency: The source code of open source software is open for
everyone to see, making it easier to identify and fix bugs and
vulnerabilities.
 Flexibility: Open source software can be used on a wide range of
platforms and devices.

Disadvantages:
 Support: While open source software does have a large community of
developers and users, it may not always have the same level of
professional support as commercial software.
 Compatibility: Open source software may not always be compatible with
other software applications and hardware devices.
 Security: Because the source code of open source software is available to
everyone, it may be easier for malicious actors to identify and exploit
vulnerabilities.
 Complexity: Open source software can be more complex and difficult to
use than commercial software, especially for non-technical users.
 Documentation: Open source software may not always have the same
level of documentation and user guides as commercial software.

Similarities:

 Both free software and open source software have access to the source
code, allowing users to modify and improve the software.
 Both types of software often rely on a community of users and developers
to provide support and contribute to the development of the software.
 Both free software and open source software are often distributed under
open licenses, allowing users to use, modify, and distribute the software
without restrictions.

Difference between Free Software and Open Source Software:

S.No. FS Philosophy OSS Philosophy

1. It was coined by the Free Software In response to the restrictions of free


S.No. FS Philosophy OSS Philosophy

Foundation in the 1980s. software, the phrase “open source”


was coined in the late 1990s.

Software is an important part of Software is just software. There are no


2. people’s lives. ethics associated directly with it.

Software freedom translates to social Ethics are to be associated with the


3. freedom. people not with the software.

Freedom is a value that is more Freedom is not an absolute concept.


important than any economical Freedom should be allowed, not
4. advantage. imposed.

Every open-source software is not free


Every free software is open source.
5. software.

There are many different open-source


There is no such issue that exists in software licenses, and some of them
free software. are quite restricted, resulting in open-
6. source software that is not free.

No restrictions are imposed on free Open-source software occasionally


7. software. imposes some constraints on users.

Examples: The Free Software


Examples: Prime examples of open-
Directory maintains a large database of
source products are the Apache HTTP
free software packages. Some of the
Server, the e-commerce platform Open
best-known examples include the
Source Commerce, internet browsers
Linux kernel, the BSD and Linux
Mozilla Firefox, and Chromium (the
operating systems, the GNU Compiler
project where the vast majority of
Collection and C library; the MySQL
development of the freeware Google
relational database; the Apache web
Chrome is done), and the full office
server; and the Sendmail mail transport
suite LibreOffice.
8. agent.

What is GNU/Linux?
GNU/Linux is a Unix-like operating system made up of different OS components
and services that create the Linux OS.
GNU stands for GNU's not Unix, which makes the term a recursive acronym, or an
acronym in which one of the letters stands for the acronym itself. The GNU
Project initially created most of the components and services used in GNU/Linux
and later added the Linux kernel to create the GNU/Linux OS. The Linux kernel is
the core component of GNU/Linux, as it provides basic services and allocates OS
resources.

GNU/Linux is not one organization's product, as several organizations and


individuals contribute to it. The OS comes with source code that can be copied,
modified and redistributed. GNU/Linux also branches off into many different
software packages, called distributions. Distributions change the appearance and
function of GNU/Linux, making it an especially flexible OS.

Although there are numerous distributions, Debian, Fedora and Ubuntu are three
user-friendly examples of GNU/Linux desktop distributions.

Debian was developed by the community-supported Debian Project and is one of


the oldest OSes based around the Linux kernel. It is developed openly and
distributed following the principles of the GNU Project. The Free Software
Foundation (FSF) sponsored Debian between 1994 and 1995.

Fedora was developed by the Fedora Project and is sponsored by Red Hat Inc. Its
goal is to lead in open source technologies by focusing on integrating new
technologies and working closely with Linux-based communities.

The Ubuntu OS, which is based on the Debian Linux distribution, is composed of
free and open source software. Ubuntu is an OS typically used for cloud computing
and is supported by OpenStack.

Free software movement activist and programmer Richard Stallman announced the
GNU/Linux project and, with others, formed FSF in 1985.

How is GNU/Linux used?


GNU/Linux is not much different from Microsoft Windows. Commercial-quality
software is available for users to work with, with additional free, high-quality
applications users can find and install.

The original purpose of the GNU Project was to create a free OS. Free -- not in the
context of cost -- but in terms of giving users the freedom to run, copy, distribute,
study, change and improve the software as needed. As such, individuals can
change the OS and exchange its components however they want. The Linux
community participates in the development and improvement of the OS.

Software developers profit by selling support and services around their own
GNU/Linux distribution. Corporate customers buy security updates and support.
Other organizations contribute to GNU/Linux by pre-installing the OS
on servers they sell.

What are the advantages of GNU/Linux?


GNU/Linux comes with the following benefits:

 Software customization. Users can customize the OS' software to their liking.
For example, users can choose from different command-line shells, which are
programs that enable them to process or give commands to a computer program
in text. It is referred to as a shell, as it is an outer layer of the OS.

 Stability. The OS is stable, as it rarely crashes.

 Open standards. GNU/Linux integrates with other open source platforms, as it


supports open

 Community. The GNU/Linux user base is a wide and varying group that can
create, distribute and help support software.

 Transparency. Users can study the source code, as well as modify and share it.
Distributions are also developed in the open.
What are the disadvantages of GNU/Linux?
Some disadvantages of GNU/Linux include the following:
 Learning curve. If a user is accustomed to Windows or macOS, it might take
time to get used to the new system and applications.

 Different software. Users might miss familiar applications, such as Microsoft


Office or the Adobe Creative suite.

 Potential lack of hardware support. Even though a lot of hardware supports


GNU/Linux, not all does. Users must know beforehand if the hardware they
want supports their OS.

What is the Free Software Movement?


The free software movement campaigns to win for the users of computing the freedom that
comes from free software. Free software puts its users in control of their own computing.
Nonfree software puts its users under the power of the software's developer. See the video
explanation.

What is Free Software?


Free software means the users have the freedom to run, copy, distribute, study, change
and improve the software.

Free software is a matter of liberty, not price. To understand the concept, you should think of
“free” as in “free speech,” not as in “free beer.”

More precisely, free software means users of a program have the four essential freedoms:

 The freedom to run the program as you wish, for any purpose (freedom 0).

 The freedom to study how the program works, and change it so it does your computing
as you wish (freedom 1). Access to the source code is a precondition for this.

 The freedom to redistribute copies so you can help others (freedom 2).

 The freedom to distribute copies of your modified versions to others (freedom 3). By
doing this you can give the whole community a chance to benefit from your changes.
Access to the source code is a precondition for this.
 What is an Open Source License?
 Open source software licenses govern how others – besides the originator –
can use, modify, or distribute software code. They grant other users the
permission and rights to use or repurpose the code for new applications or to
include the code in other projects.
 One of the main advantages of open source code is its visibility, which makes
it easier to troubleshoot problems and to understand better how something
works when the documentation is either lacking or incorrect.
 Depending on the type of open source license, you may even be allowed to
modify the original source code to tailor it to your needs or fix any issues you
find. The license will determine whether this is possible, and under what
terms. For example, you may be required to make any modifications publicly
availabl
 What are the different open source licenses?
 There are over 80 variations of open-source licenses, but they generally fall
into one of two primary categories: copyleft and permissive:

Copyleft Licenses
The most popular copyleft open source licenses, in order of restrictiveness,
are AGPL, GPL, LGPL, EPL, and Mozilla:
 The GNU General Public License (GPL)preserves license notifications and
copyright terms and is suitable for commercial, patent, and private use.
Any software that uses GPL code must distribute all its source code
under the same license. So if you use GPL code in your software (e.g., by
using a GPL library), and distribute your application, all your source code
must be made available under the same GPL license. This restriction
makes the GPL a strong copyleft license.
 The Affero GPL (AGPL) only adds only one clause, but an important one
for some software. Because the GPL license is only triggered when
software is distributed, there is a loophole for software that is made
available over the network only, i.e., not explicitly “distributed”. The
AGPL license closes this loophole by including a remote network
interaction clause that triggers the GPL license for any software used
over a network.
 The Lesser General Public License (LGPL) provides the same level of
terms as the AGPL and GPL copyleft open source licenses, including
preserving copyright and license notifications. The prime variation is that
smaller projects or objects accessed through larger licensed works do
not require distribution of the larger project. Moreover, the modified
source does not have to be distributed under the same terms that apply
to the larger code project.
 The Eclipse Public License (EPL)is commonly used for business
software.With EPL, software developed using EPL, non-EPL, and even
proprietary code can be combined and sub-licensed – provided any non-
EPL elements reside independently as separate modules or objects.
Modifications can be made under the EPL license, but they must be
released under the same terms.
 The Mozilla Public License (MPL) is the least restrictive copyleft open
source software license. They make it easy to modify and use their code
in closed-source and/or proprietary software, as long as any code
licensed under the MPL is kept in separate files and these files are
distributed with the software. The MPL also includes patent grants and
enforces that copyright notices be retained

Permissive licenses
The most popular permissive open source licenses are: Apache, MIT, BSD
and Unlicense.
 The Apache License requires license notifications and copyrights on the
distributed code and/or as a notice in the software. However, derivative
works, larger projects, or modifications are allowed to carry different
licensing terms when distributed and are not required to provide source
code. Apache licenses contain a patent grant.
 The MIT License, which bears the name of the famous university where
it originated, is perhaps the most used open source license in the world,
perhaps because it is very short and clear and easy to understand. Iit
allows anyone to do whatever they wish with the original code, as long
as the original copyright and license notice is included either in the
distributed source code or software. It removes any liability from
authors and does not explicitly contain a patent grant.
 The Berkeley Source Distribution (BSD) License is another permissive
open source license that preserves license notices and copyrights but
allows larger or licensed works to be distributed without source code
and under different license terms. The 2- clause BSD License is very
similar to the MIT open source license, while the 3-clause and 4-clause
BSD licenses add more requirements or restrictions related to reuse and
other terms.
 Unlicense: As its name indicates, this is the least restrictive of open
source licenses because it amounts to making the open source open to
the public domain. No conditions apply, meaning these unlicensed works
can be distributed without source code and under different terms

Which Open Source License is Best?


Selecting an open source license type depends largely on the intention
of the licensor or developer for use of the software. Here are some
considerations to keep in mind during license comparison:
 Care must be taken when choosing a copyleft license. If the original
license is very permissive, the modified code is equally unrestricted,
which may not be to the advantage of the author.
 That having been said, copyleft licenses generally provide more
restrictions – and possibly less liability – than permissive licenses.
 When the intention is to make the code as reusable and shareable as
possible, a level of permissive license is probably the best choice.
 If you develop software that is used over a network, it can be highly
advantageous to choose the AGPL. A common example of this are open
source databases: by not licensing under the AGPL, any company (such
as a major cloud provider) could improve on your product and monetize
it without being required to distribute their modifications.
 There are two main versions of the GPL license: GPLv2 and GPLv3. There
are many differences in GPLv3, most of which address issues not
covered in GPLv2 such as patents. GPLv3 also improves compatibility
with other open source licenses such as the Apache License v2.
However, take note that the two versions of GPL are not compatible
with one another.
 Because MIT licenses are so commonly used, there's the advantage that
they are well recognized and commonly understood. When it comes to
using software licensed under the MIT license, there are no restrictions
regarding redistribution or monetization, which makes them very
attractive for any sort of usage. It is also compatible with many other
open source licenses, meaning that MIT licensed code can be used in
other open source projects that use different licenses

What are intellectual property rights?


Intellectual property rights are the rights given to persons over the
creations of their minds. They usually give the creator an exclusive right
over the use of his/her creation for a certain period of time.
Intellectual property rights are customarily divided into two main areas:
(i) Copyright and rights related to copyright.back to top
The rights of authors of literary and artistic works (such as books and
other writings, musical compositions, paintings, sculpture, computer
programs and films) are protected by copyright, for a minimum period of
50 years after the death of the author.
Also protected through copyright and related (sometimes referred to as
“neighbouring”) rights are the rights of performers (e.g. actors, singers
and musicians), producers of phonograms (sound recordings) and
broadcasting organizations. The main social purpose of protection of
copyright and related rights is to encourage and reward creative work.
(ii) Industrial property.back to top
Industrial property can usefully be divided into two main areas:
 One area can be characterized as the protection of distinctive signs, in
particular trademarks (which distinguish the goods or services of one
undertaking from those of other undertakings) and geographical
indications (which identify a good as originating in a place where a given
characteristic of the good is essentially attributable to its geographical
origin).

The protection of such distinctive signs aims to stimulate and ensure fair
competition and to protect consumers, by enabling them to make
informed choices between various goods and services. The protection
may last indefinitely, provided the sign in question continues to be
distinctive.
 Other types of industrial property are protected primarily to stimulate
innovation, design and the creation of technology. In this category fall
inventions (protected by patents), industrial designs and trade secrets.

The social purpose is to provide protection for the results of investment


in the development of new technology, thus giving the incentive and
means to finance research and development activities.

A functioning intellectual property regime should also facilitate the


transfer of technology in the form of foreign direct investment, joint
ventures and licensing.

The protection is usually given for a finite term (typically 20 years in the
case of patents).
While the basic social objectives of intellectual property protection are
as outlined above, it should also be noted that the exclusive rights given
are generally subject to a number of limitations and exceptions, aimed
at fine-tuning the balance that has to be found between the legitimate
interests of right holders and of users.
Open-source Software:
Open source software is computer software developed either by an
individual, group, or organization to meet certain requirements and it is
available for any modifications based on its developing body‘s interest. Open
source software is published openly for the general public and here the
source code is open for all. For open-source software, the users do not need
to spend any cost. It is available under free licensing. It depends on
donations and support as its main source of funds. Some examples of open-
source software are Firefox, OpenOffice, Zimbra, VLC media player, and
Thunderbird.
Advantages:
 Cost: Open-source software is typically free to use, modify, and distribute.
 Customization: The source code of open-source software is available to
everyone, allowing users to modify and customize it to suit their needs.
 Community support: Open source software often has a large community
of developers and users who contribute to its development and provide
support.
 Transparency: The source code of open-source software is open for
everyone to see, making it easier to identify and fix bugs and
vulnerabilities.
 Flexibility: Open-source software can be used on a wide range of
platforms and devices.

Disadvantages:
 Support: While open-source software does have a large community of
developers and users, it may not always have the same level of
professional support as commercial software.
 Compatibility: Open-source software may not always be compatible with
other software applications and hardware devices.
 Security: Because the source code of open-source software is available
to everyone, it may be easier for malicious actors to identify and exploit
vulnerabilities.
 Complexity: Open source software can be more complex and difficult to
use than commercial software, especially for non-technical users.
 Documentation: Open source software may not always have the same
level of documentation and user guides as commercial software.
2. Commercial Software :
Commercial software is computer software that only the person, team, or
organization that created it can modify also they have exclusive rights over
the software. Anyone who needs to use it has to pay for it valid and
authorized license. Here the source code is protected. For commercial
software, the users need to spend moderate to expensive costs. It is
available at a high licensing cost. It depends on its software sale/product
licensing as its main source of funds. Some examples of commercial
software are Windows Operating System, MS Office, SAP, Oracle, and
Adobe Photoshop.
Advantages:
 Professional support: Commercial software often comes with professional
support services, including technical support and customer service.
 Compatibility: Commercial software is often designed to work seamlessly
with other software applications and hardware devices.
 Security: Commercial software often includes security features and is
subject to rigorous testing and validation.
 Ease of use: Commercial software is often designed with a user-friendly
interface and can be easier to use than open-source software.
 Documentation: Commercial software often has extensive documentation
and user guides to help users get started.

Disadvantages:
 Cost: Commercial software can be expensive to purchase and may
require ongoing licensing fees.
 Customization: Commercial software is often proprietary, meaning that
users are not able to modify or customize it.
 Flexibility: Commercial software may be limited in terms of the platforms
and devices on which it can be used.
 Transparency: Commercial software is often closed source, meaning that
the source code is not available for public scrutiny.
 Dependence: Commercial software is often subject to the decisions and
business practices of the company that produces it, which may not always
align with the needs of users.
Similarities between Open source Software and Commercial
Software :
 Both types of software are designed to solve specific problems or meet
specific needs of users.
 Both types of software can be used for personal or business purposes.
 Both types of software can be updated and improved over time.
 Both types of software can have user communities and support systems
that help users troubleshoot problems or learn how to use the software.
 Both types of software can be subject to licensing agreements and
intellectual property laws.

Difference between Open source Software and Commercial


Software :
S.No. OPEN SOURCE SOFTWARE COMMERCIAL SOFTWARE
Open source software is
computer software Commercial software is
developed either by an computer software that only
individual, group, or an the person, team, or
organization to meet certain organization that created it
requirements and it is can modify also they have
available openly for the exclusive rights over the
general public for any software. Anyone who needs
modifications based on its to use it has to pay for its
01. developing body’s interest. valid and authorized license.

The cost of commercial


The cost of open-source software varies from
02. software is free. moderate to expensive.

Commercial software
Open source provides provides guaranteed
03. limited technical support. technical support.

Open source software is Commercial software is


available under free available under high
04. licensing. licensing cost.

In open source software In commercial software


users need to rely on users get dedicated support
05. community support. from the vendor.

In open-source software
In open source software installation and updates are
installation and updates are administered by the software
06. administered by the user. vendor.

Limited hands-on training On-site and Online training


and online resources are are available from the
available for open-source commercial software vendor
software application side for software application
07. training. training.

Here in open source But in commercial software


software users can mainly vendor offers
08. customize. customization.
In this rapid community In this mainly the vendor is
response helps in fixing the responsible for fixing the
09. bugs and malfunctions. malfunctions.

In open source software the In commercial software, the


10. source code is public. source code is protected.

The source of funds for The source of fond


open-source software commercial software
mainly depends on depends on its software
11. donations and support. sale/product licensing.

Firefox, OpenOffice, Zimbra, Windows Operating System,


VCL media player, and MS Office, SAP, Oracle, and
Thunderbird are some Adobe Photoshop are some
examples of open source examples of commercial
12. software. software.
UNIT-2

4.1. Creating an Installation Diskette


The first step in getting Red Hat's distribution of Linux onto a system, you need to
find a way of starting the installation program. The usual method of doing so is to
create an installation disk, although if you are installing from CD-ROM, and your
system's BIOS supports it, you should be able to boot directly into the installation
program from the CD.

Otherwise, to create an installation diskette, you'll need to copy the `` boot.img''


(which is simply an image of an ext2-formatted Linux boot diskette with an
additional installation program) onto a floppy diskette. The ``boot.img'' file can be
obtained from the /images directory of the Red Hat CD-ROM disk, or downloaded
via FTP from ftp://ftp.redhat.com in the /pub/redhat/redhat-
6.1/i386/images directory (assuming you are installing Linux on an Intel box).

You can create the boot diskette either from a DOS or Windows system, or from
an existing Linux or Unix system. For your destination diskette, you can use either
an unformatted or a pre-formatted (for DOS) diskette -- it makes no difference.

Under DOS: Assuming your CD-ROM is accessible as drive D:, you can type:

d:
cd \images
..\dosutils\rawrite

For the source file, enter ``boot.img''. For the destination file, enter ``a:'' (assuming
the diskette you are created is inserted into the A: drive). The `` rawrite'' program
will then copy the ``boot.img'' file onto diskette.

Under Linux/Unix: Assuming the ``boot.img'' file is located in the current directory
(you may need to mount the CD-ROM under /mnt/cdrom and find the file in
/mnt/cdrom/images), you can type:

dd if=boot.img of=/dev/fd0

The ``dd'' utility will copy, as its input file ("if"), the ``boot.img'' file, onto the
output file ("of") /dev/fd0 (assuming your floppy drive is accessible from
/dev/fd0).

Unless your Linux or Unix system allows write permissions to the floppy device,
you may need to do this command as the superuser. (If you know the root
password, type ``su'' to become the superuser, execute the ``dd'' command, and then
type ``exit'' to return to normal user status).
4.2. Booting Linux Installation Program
To begin setting up your new Red Hat system, either boot from the installation CD,
or insert the installation diskette in the system's A: drive, and reboot or power-on
the system. After a few moments, the Red Hat installation program screen should
appear.

In most cases, you can just press <Enter> to begin the installation process, but if
you are a more experienced user who knows exactly how your hardware devices
should be set up, you can enter ``expert'' for the additional information and
prompts this feature provides. (If you do nothing, the default installation procedure
will start in about 10 to 15 seconds after the installation screen first appears.)

You will then be asked to choose your language (usually "English") and your
keyboard type (even in Canada I choose "US 101-key"), as well as where you are
installing from (such as from your CD-ROM or over the network). Red Hat is very
flexible in where it can be installed from.

Most likely you will choose ``Local CDROM'' to install from your Red Hat CD-ROM
(which should be inserted into your CD-ROM device). However, if your system is
not equipped with a CD-ROM device, there are a number of other installation
methods you can choose.

If you have another Linux system (or any other operating system that supports NFS
file mounting), you can use ``NFS'' to install from an NFS mount. To do this, you'll
need to have your CD-ROM mounted in the other system (or otherwise have the
Red Hat distribution tree somewhere on the other system -- it is possible to
download everything via FTP and then install from your other system's hard drive),
make sure you have an entry in your /etc/exports file allowing access by the new
system to the appropriate directory (see Section 7.6 for details on how to set up and
use NFS), and then enter the appropriate details. Here's an example walk-through:

 Insert the Red Hat CD into the other system (eg. a system called
``spock'').
 To mount the CD, type:

mount /dev/cdrom /mnt/cdrom -t iso9660

 Edit, as the superuser, your ``/etc/exports'' file and put an entry like:

/mnt/cdrom newsys.mydomain.name(ro)

 (This says that the new system at newsys.mydomain.name is allowed


read-only access to the directory ``/mnt/cdrom/'' and any
subdirectories under it).
 If your new system does not yet have a domain name assigned to it,
you can instead use its IP address:

/mnt/cdrom 10.23.14.8(ro)

 (Assuming your new system has 10.23.14.8 as its IP address).


 Again, as superuser, type:

killall -HUP rpc.nfsd ; killall -HUP rpc.mountd

 This will restart your NFS and mountd daemons, which is necessary
before your new NFS export will work.
 Now, from your new system, you can choose ``NFS'' as your
installation source. You'll be asked to provide information on your
network card, as well as your IP settings. You'll likely use static IP
settings if your system is sitting on a local LAN, or DHCP settings if,
for example, your system is connected to a cable modem. Enter the
settings as appropriate for your new system.
 You'll then be asked to enter the NFS server name and Red Hat
directory. For our example system, we would type in `` spock'' as the
NFS server name, and ``/mnt/cdrom/'' as the Red Hat directory.

There are other ways of installing Red Hat, such as using a Samba (Windows-style
networking) connection, from an existing partition (such as your DOS or Windows
95 partition) on your hard drive, or via FTP. Check the Red Hat users guide for
more details on installing using these methods, or just try to struggle through them
(the procedures are really not very difficult!)

Once you have chosen your installation source, Red Hat will ask you if you wish
to "Install" or "Upgrade" your system. As you are installing a new system, you
should choose "Install". (As an aside, I'm a fairly anal person who never upgrades
new distribution releases over existing systems -- I guess having suffered through
so many problems with Microsoft products I have developed a significant mistrust
for upgrading systems as a whole. I prefer to install from scratch, and simply
restore from backup my personal/user and local site files.)

The installation program will then ask you if you have a SCSI adapter. If you
answer yes, you'll be asked to choose the appropriate driver. In some
circumstances, Red Hat will be able to detect your adapter automatically.

Next, you'll be asked to set up your file systems (ie. partition one or more drives
for Linux). There are two tools available for setting up these partitions, including
the Red Hat-supplied "Disk Druid", and the standard Linux "/fdisk" utility.
Both tools are similar in function, allowing you to specify the partition types and
sizes. However, Disk Druid seems to be a bit more "user friendly", and a bit more
complete than fdisk. In fact, if you use fdisk to partition your drives, you'll then be
presented with the Disk Druid screen for specifying your mount points anyway.
That being said, as an ex-Slackware user, I personally always use fdisk -- force of
habit, I guess! :-)

The next section will detail how and why you should set up your partition
information.

4.3. Partitioning Hard Drive(s)


Why partition, anyway? Well, although it is possible to get a perfectly functioning
Linux system running on a single-partition system, and, in fact, is a bit easier to
configure this way, there are a number of benefits from partitioning one or more of
your storage devices into multiple partitions.

While it is true that Linux will operate just fine on a disk with only one large
partition defined, there are several advantages to partitioning your disk for at least
the four main file systems (root, usr, home, and swap). These include:

First, it may reduce the time required to perform file system checks (both upon
bootup and when doing a manual fsck), because these checks can be done in
parallel. (By the way, NEVER run an fsck on a mounted file system!!! You will
almost certainly regret what happens to it. The exception to this is if the file system
is mounted read-only, in which case it is safe to do so.) Also, file system checks
are a lot easier to do on a system with multiple partitions. For example, if I knew
my /home partition had problems, I could simply unmount it, perform a file system
check, and then remount the repaired file system (as opposed to booting my system
with a rescue diskette into single-user mode and doing the repairs).

Second, with multiple partitions, you can, if you wish, mount one or more of your
partitions as read-only. For example, if you decide that everything in /usr will not
be touched even by root, you can mount the /usr partition as read-only.

Finally, the most important benefit that partitioning provides is protection of your
file systems. If something should happen to a file system (either through user error
or system failure), on a partitioned system you would probably only lose files on a
single file system. On a non-partitioned system, you would probably lose them on
all file systems.

This little fact can be a big plus. For example, if your root partition is so corrupted
you can't boot, you can basically boot from the rescue diskette set, mount your root
partition, and copy what you can (or restore from backup; see Chapter 8 for details
on how files can be backed up and restored), to another partition such as home, and
then reboot once again using the emergency boot disk, typing "mount
root=/dev/hda3" (assuming the partition containing your temporary root file
system is on the third partition of hda) and boot your fully functional Linux box.
Then you can run an fsck on your unmounted corrupt root partition.

I have had personal experience in file system catastrophies, and I was very grateful
for having had the damage limited due to the use of multiple partitions.

Finally, since Linux allows you to set up other operating system(s) (such as
Windows 95/98/NT, BeOS, or what-have-you), and then dual- (or triple-, ...) boot
your system, you might wish to set up additional partitions to take advantage of
this. Typically, you would want to set up at least one separate partition for each
operating system. Linux includes a decent boot loader (called LILO on Intel-based
systems, although much the same thing is available as MILO on Alpha, and SILO
on Sparc) which allows you to specify which operating system you want to boot at
power on, with a time-out default boot of your favorite operating system (probably
Linux, right?)

You should partition a disk (or disks) according to your needs. In my experience
on Intel, Alpha, and Sparc platforms, for a fairly loaded system (feature-wise),
doing a fair amount of tasks (as a desktop system at home, or as an Internet server
at work), I have found the following approximation of space works pretty
effectively for determining a partition size.

Given:

A given disk of X Mb/Gb (eg. 2 Gb)


(Or, more than one disk with a combined total of X Mb/Gb)

Calculate:

(swap) about double main RAM (eg. 64 Mb system gets 128 Mb swap)
/ (root) about 10% of available (eg. 200 Mb)
/home about 20% of available (eg. 400 Mb)
/usr any remaining space (eg. 1272 Mb)

/var (optional -- see below)


/boot (optional -- see below)
/archive (optional -- see below)

Of course, the above amounts are approximate guidelines only. Obviously you are
going to want to juggle those percentages around a bit depending on what you are
going to use your Linux system for. If you are going to be doing stuff like adding
lots of bulky applications such as WordPerfect or Netscape, or perhaps adding
Japanese character support, you would probably benefit from a bit more /usr space.

I always seem to have a lot of space available on /home, so if your users aren't
doing much (or you have imposed strict quota sizes), or you aren't offering shell
accounts and personal web pages, etc., you probably could lower /home space and
raise /usr.

Here is a description of the various mount points and file system information,
which may give you a better idea of how to best define your partition sizes for your
own needs:

 / (root) - used to store things like temporary files, the Linux kernel and boot
image, important binary files (things that are needed before Linux can
mount the /usr partition), and more importantly log files, spool areas for
print jobs and outgoing e-mail, and user's incoming e-mail. It is also used for
temporary space when performing certain operations, such as building RPM
packages from source RPM files. Therefore, if you have a lot of users with a
lot of e-mail, or think you will need plenty of temporary space, you might
want more space available. The partition type should be left as the default of
83 (Linux native). In addition, you'll probably toggle the bootable flag on
this partition to allow boot information to be stored here.
 /usr/ - should be the largest partition, because most of the binary files
required by Linux, as well as any locally installed software, web pages,
Squid proxy cache, Samba share services, some locally-installed software
log files, etc. are stored here. The partition type should be left as the default
of 83 (Linux native).
 /home/ - typically if you aren't providing shell accounts to your users, you
don't need to make this partition very big. The exception is if you are
providing user home pages (such as school web pages), in which case you
might benefit from making this partition larger. Again, the partition type
should be left as the default of 83 (Linux native).
 (swap) - Linux provides something called "virtual memory" to make a larger
amount of memory available than the physical RAM installed in your
system. The swap partition is used with main RAM by Linux to accomplish
this. As a rule of thumb, your swap partition should be at least double the
amount of physical RAM installed in your system.

If you have more than one physical hard drive in your system, you can
create multiple swap partitions. This can improve the performance of
swapping by taking advantage of parallel disk access. For example, on a 256
Mb system with four drives, I would probably create four 128 Mb swap
partitions, for a total of 256 Mb RAM, 512 Mb swap (for a combined total
of 768 Mb available as virtual memory). The partition type needs to be
changed to 82 (Linux swap).

Note: Note: It is a common misconception that Linux has a 128 Mb


swap size limit. This was true in the past, but in modern Linux
distributions, the size depends on your architecture (for example, Intel
systems can have swap sizes as large as 2 Gb). Type ``man mkswap''
for more information.

 /var/ (optional) - You may wish to consider splitting up your / (root)


partition a bit further. The /var directory is used for a great deal of runtime
storage, including mail spools (both ingoing and outgoing), print jobs,
process locks, etc. Having this directory mounted under / (root) may be a bit
dangerous because a large amount of incoming e-mail (for example), may
suddenly fill up the partition. Since bad things can happen (eg. system
crash?) when the / (root) partition fills up, having /var on its own partition
may avoid such problems. I've had success in taking whatever space I've
allocated to / (root), perhaps doubling it, and then creating separate
partitions for / (root) and for /var. The partition type should be left as the
default of 83 (Linux native).
 /boot/ (optional) - In some circumstances (such as a system set up in a
software RAID configuration) it may be necessary to have a separate
partition from which to boot the Linux system. This partition would allow
booting and then loading of whatever drivers are required to read the other
file systems. The size of this partition can be as small as a couple Mb; I
recommend approximately 10 Mb (which should give you plenty of room to
store the kernel, initial RAMdisk image, and perhaps a backup kernel or
two). The partition type should be left as the default of 83 (Linux native).
 /archive/ (optional) - If you have any extra space lying around, perhaps you
would benefit from a partition for a directory called, for example, /archive.
You can then use the /archive directory to store backup material, large or
infrequently accessed files, samba file services, or whatever else you can
find a use for it. The partition type can be left as the default of 83 (Linux
native), or if you want to access it from both Linux as well as from another
operating system, you could change it to a different ID, such as 6 (DOS 16-
bit >=32M).

As extra drive(s) are added, further partitions can be added to the new drives,
mounted at various mount-points as required -- this means a Linux system never
needs to worry about running out of space. As an example, if in the future it is
clear that sda6 is starting to get filled up, we could add another drive, set a nicely
sized partition with a mount-point at /usr/local -- and then transfer all the
information from /usr/local over to the new drive. But no system or application
component would "break" because Linux would see /usr/local no matter where it
was located.

To give you an example of how one might set up partitions, I have used the
following partitioning scheme on an Intel system (dual boot, Windows 95 and
Linux):

Device Boot Begin Start End Blocks Id System


/dev/hda1 * 1 1 254 1024096+ 6 DOS 16-bit >=32M
/dev/hda2 255 255 782 2128896 5 Extended
/dev/hda5 255 255 331 310432+ 83 Linux native
/dev/hda6 332 332 636 1229728+ 83 Linux native
/dev/hda7 637 637 749 455584+ 83 Linux native
/dev/hda8 750 750 782 133024+ 82 Linux swap

The first partition, /dev/hda1, is a DOS-formatted file system used to store the
alternative operating system (Windows 95). This gives me 1 Gb of space for that
operating system.

The second partition, /dev/hda2, is a physical partition (called "extended") that


encompasses the remaining space on the drive. It is used only to encapsulate the
remaining logical partitions (there can only be 4 physical partitions on a disk; in
my case I required more than 4 partitions, therefore I had to use a logical
partitioning scheme for the others).

The third through fifth partitions, /dev/hda5, /dev/hda6, and /dev/hda7, are all e2fs-
formatted file systems used for the / (root), /usr, and the /home partitions,
respectively.

Finally, the sixth partition, /dev/hda8, is used for the swap partition.

For yet another example, this time an Alpha box with two hard drives (sole boot,
Linux only), I have chosen the following partitioning scheme:

Device Boot Begin Start End Blocks Id System


/dev/sda1 1 1 1 2046 4 DOS 16-bit <32M
/dev/sda2 2 2 168 346859 83 Linux native
/dev/sda3 169 169 231 130851 82 Linux swap
/dev/sda4 232 232 1009 1615906 5 Extended
/dev/sda5 232 232 398 346828 83 Linux native
/dev/sda6 399 399 1009 1269016 83 Linux native
/dev/sdb1 1 1 509 2114355 83 Linux native
/dev/sdb2 510 510 1019 2118540 83 Linux native

The first partition, /dev/sda1, is a DOS-formatted file system used to store the
MILO boot loader. The Alpha platform has a slightly different method of booting
than an Intel system does, therefore Linux stores its boot information in a FAT
partition. This partition only needs to be as large as the smallest possible partition
allowed -- in this case, 2Mb.

The second partition, /dev/sda2, is an e2fs-formatted file system used for the /
(root) partition.

The third partition, /dev/sda3, is used for the swap partition.

The fourth partition, /dev/sda4, is an "extended" partition (see previous example


for details).
The fifth and sixth partitions, /dev/sda5, and /dev/sda6, are e2fs-formatted file
systems used for the /home and /usr partitions, respectively.

The seventh partition, /dev/sdb1, is an e2fs-formatted file system used for the
/archive partition.

The eighth and final partition, /dev/sdb2, is an e2fs-formatted file system used for
the /archive2 partition.

After you finish setting up your partition information, you'll need to write the new
partition to disk. After this, the Red Hat installation program reloads the partition
table into memory, so you can continue on to the next step of the installation
process.

4.4. Setting up Swap Space


Once you've set up your partition information, and have assigned "mount
points" (ie. /usr is the mount point for the /usr file system), the installation program
will ask you which partition(s) it should used for swap space. Since your swap
partitions should already be identified as such (partition ID # 82), you can
press <Enter> to begin formatting those partition(s) for swap usage. I recommend
you enable the "Check for bad blocks during format" to ensure the partition is
free of potentially damaging problems. It does slow down the formatting process
substantially but I believe it is worth the tradeoff.

4.5. Choosing Partitions to Format


Now, the installation program will display a list of the partitions you have assigned
to Linux, and ask you to select which, if any, of these partitions you want to format
as new file systems. Likely, you will want to format all of them, except if you are
upgrading your system or perhaps have some information (eg. on /home) that you
don't want to lose.

Again, I recommend you enable the "Check for bad blocks during
format" option.

4.6. Choosing Desired Packages to Install


Next, you'll be presented with a list of system components and asked to specify
which ones should be installed. If you are an experienced Linux user, you can pick
and choose according to your needs. If you are new to Linux, you'll likely want to
select the bottom option, "Everything".
What I usually do is select the components I know I'll need, and then enable
the "Select individual packages" option, which allows me to control the
installation in finer detail.

Once you have chosen your desired components, select "Ok" to begin installation. If
you have enabled the "Select individual packages", you'll be asked the specify
which individual packages should be installed. This is fairly straightforward, and if
you are unsure of what a given package is for, you can press the <F1> key for a
brief description of what it does.

Don't worry if you make a mistake choosing (or not choosing) a package or two.
After all, all the packages are on your CD-ROM (or other source media), so you
can use the handy Red Hat RPM tool to make adjustments after your system is up
and running (see Section 10.1 for details).

After you have chosen the packages you wish to install, the installation program
will now format the partitions you have defined. This may take several minutes,
especially for larger partitions or if you've enabled bad block checking, so please
don't think your system has frozen during this procedure!

After the format completes, Red Hat Linux will begin installation of the selected
packages. This should take between five and fifteen minutes to complete,
depending on the speed of your system.

4.7. Hardware Configuration


After package installation, Red Hat will begin configuring the devices on your
system. In most cases, except with very new hardware that may not be fully
supported by Linux, the installation program does a good job of automatic
configuration.

The prompts you will see are very straightforward:

 Detection of your mouse (including choosing between 2- and 3-button


models. If you have a 2-button mouse you'll likely want to enable 3-button
emulation.)
 Detection of your video card
 Choosing your monitor
 Running of ``XConfigurator'' to configure the X Window System (you'll
want to "Probe" your card. If you get an error here, don't worry as you can
take care of X configuration later, after your system is up and running;
see Chapter 5 for details.)
 Selection of video modes (you can choose the defaults, or you can fine- tune
the video modes you'll want to use under the X Window System)
 LAN configuration
 Clock and timezone configuration
 Startup services (the default selection is probably best, but again, you can
press <F1> for a description of what a given service does)
 Printer configuration
 Assignment of root password (choose something secure!)
 Creation of a boot disk [ don't be lazy! Make one! :-) ]

4.8. Booting with LILO

Next, the installation program needs to write a boot loader to your hard drive. The
boot loader (LILO on Intel systems) is responsible for booting Linux along with
any other operating systems if you have set up your system for multi-boot
(see Section 4.8.1 for details on this).

The "Lilo Installation" dialog box will ask you to choose where the boot loader
image should be written to. You'll likely want to install it on the master boot record
of your first drive (usually /dev/hda for IDE, /dev/sda for SCSI).

Once you have selected the location for writing the boot loader, a second dialog
box will appear, allowing you to enter extra boot-time configuration parameters.
Usually you don't need to enter anything here, but if you have more than 64 Mb of
RAM you'll need to enter a special parameter in order to have Linux make use of
the extra RAM (otherwise, it will only use the first 64 Mb). For example, if your
system has 128 Mb of RAM, you should enter:

append="mem=128M"

If your system has SCSI drives, or you wish to install LILO on a partition with
more than 1023 cylinders, it may be necessary to enable the option to "Use linear
mode". If it is not, enabling this option shouldn't hurt anything, so it is probably a
good idea to do so.

4.8.1. Multi-boot with Other Operating Systems


Finally, if you've set up your system to multi-boot Linux with other operating
system(s), you'll be presented with a third dialog box which lists the available
partitions. Here, you can assign names to your other operating systems (which you
enter at the "LILO" prompt at boot time to boot your desired operating system. The
installation program does assign default names to each bootable partition, so it isn't
necessary to change them unless you don't like the defaults.
The default operating system that will boot upon system start up will, of course, be
Linux. However, if you wish, you can change the default to any of the other
operating systems you have defined.

After installing the boot loader on your hard drive, the installation program should
hopefully present you with a "Congratulations" dialog box, indicating that Linux
has been successfully installed. Remove the installation floppy diskette (if any),
and press <Enter> to reboot your system...into Linux!

Linux will boot, and if all goes well you should see a "login" prompt. From here,
you should be able to log in as "root" using whatever password you have assigned
during the installation process.

4.9. Downloading and Installing Red Hat


Updates
Red Hat has produced some pretty impressive versions of their distribution so far,
but seems to have a history of releasing them when they are not quite "ready for
prime time". Therefore in order to take full advantage of your Linux system, it is
necessary to download and apply updated packages. These packages, also
called "rpm files" are applied using the RPM utility (for details on this utility,
see Section 10.1).

This will prove to be one of the more time-consuming parts of getting your Linux
system ready (unless you have a stellarly fast Internet connection). However, take
the time to do this! You will likely save yourself a lot of grief!

First, download all files from:

ftp://ftp.redhat.com/redhat/updates/6.1/i386/

(The above assumes you are using Linux on an Intel box).

You should probably download everything into a single directory, and then you
can simply type: ``rpm -Uvh *'' which will upgrade all the packages. If you've
downloaded any kernel rpm files, you should probably move them to another
directory for now. Upgrading or customizing your kernel is a bit more complicated
and needs to be done with great care (see Section 10.4 for details on this).
Therefore before you apply the upgrades, you may wish to consider moving all the
kernel-*.rpm files out of your temporary upgrade directory.
To apply the upgrades, you can simply run ``rpm'' against all the packages at once
(ie. "rpm -Uvh *"), or if you prefer, you can upgrade them one at a time (ie. "rpm -
Uvh file_to_upgrade.rpm"). The latter method is for us anal types who wish to
ensure that each update is applied correctly without error. :-)

Perhaps you are curious to see if a given package is installed before you attempt to
upgrade it. Or perhaps you wish to find out what version of a given package is
installed. All this can be done with the RPM utility; see Section 10.1 for details.

Disk Partitioning in Linux



Disk Partitioning is the process of dividing a disk into one or more logical
areas, often known as partitions, on which the user can work separately. It is
one step of disk formatting. If a partition is created, the disk will store the
information about the location and size of partitions in the partition table.
With the partition table, each partition can appear to the operating system as
a logical disk, and users can read and write data on those disks. The main
advantage of disk partitioning is that each partition can be managed
separately.
Why do we need it?
 To upgrade Hard Disk (to incorporate a new Hard Disk into the system)
 Dual Booting (Multiple Operating Systems on the same system)
 Efficient disk management
 Ensure backup and security.
 Work with different File Systems using the same system.

How to Partition Disks in Linux?

(For the purpose of demonstration Cent OS 7 and VMware are used in


the screenshots of the article.)
In order to successfully partition a disk and to make it useful, we need to
ensure that we have completed the below four steps, regardless of the
Operating system and Hardware of the system.

What are Basic shell Commands in Linux?


Basic shell commands in Linux are fundamental instructions used within
the command line interface (CLI) to perform various tasks and operations
on a Linux-based operating system. These commands allow users to
interact with the system, manage files and directories, manipulate data,
perform administrative tasks, and execute programs or scripts.

Some of the essential basic shell commands in Linux include:


 cd (Change Directory): Allows navigation between directories. For
instance, cd moves into a specific directory, while cd .. moves up one level
in the directory structure.
 ls (List): Lists the contents of a directory. ls -l provides a detailed list with
permissions, ownership, size, and modification date.
 mkdir (Make Directory): Creates a new directory. For example, mkdir
creates a directory with the specified name.
 cp (Copy): Copies files or directories from one location to another. Syntax:
cp .
 rm (Remove): Deletes files or directories. Use rm to remove a file and rm -
r for recursive deletion of directories.
 cat (Concatenate): Displays the contents of a file in the terminal. cat
shows the entire content of the specified file.
 grep (Global Regular Expression Print): Searches for specific text
patterns within files. For example, grep "search_term" looks for
occurrences of "search_term" in the specified file.
 man (Manual): Displays the manual page for a specific command. man
provides detailed information and documentation about the command.

These basic commands form the building blocks for interacting with a Linux
system through the command line interface. Understanding and using
these commands efficiently enable users to perform routine tasks, manage
the file system, process data, and automate tasks, thereby enhancing
productivity and control over the Linux environment.

Examples For Basic shell Commands in Linux

Here are some examples of basic shell commands in Linux:

1. ls (List Directory Contents):

To list files and directories in the current directory:

ls

To list detailed information (permissions, ownership, size, etc.) about files


and directories:
ls -l

2. cd (Change Directory):
To change to a specific directory:

cd /path/to/directory

To move up one directory level:

cd ..

3. mkdir (Make Directory):

To create a new directory:

mkdir new_directory

4. cp (Copy):

To copy a file to a new location:


cp file.txt /path/to/destination

To copy a directory and its contents recursively:

cp -r directory_name /path/to/destination

5. rm (Remove/Delete):

To remove a file:

rm file.txt

To delete a directory and its contents recursively:

rm -r directory_name

6. cat (Concatenate):

To display the contents of a file:

cat file.txt

7. grep (Global Regular Expression Print):

To search for a specific pattern in a file:

grep "pattern" file.txt


8. man (Manual):

To access the manual pages for a specific command:

man ls

Use arrow keys or the spacebar to navigate through the manual pages.
Press ‗q‘ to exit the manual.
These examples demonstrate how these basic shell commands are used in
Linux to perform various tasks such as file manipulation, navigation, and
data retrieval within the command line interface.

Managing users
Users must authenticate to any system they need to use. This authentication
provides access to resources and a customized, user-specific environment. The
user's identity is based on their user account. What skills do sysadmins need to
manage user accounts?

1. Understand the /etc/passwd file

User account information is stored in the /etc/passwd file. This information includes
the account name, home directory location, and default shell, among other values.
Linux sysadmins should be able to recognize these fields.

Each field is separated by a : character, and not all fields must be populated, but
you must delineate them.

Here's an example of the /etc/passwd fields:

username:password:UID:GID:comment:home:shell
In this example, the comment field is empty:

dgarn:x:1001:1001::/home/dgarn:/bin/bash
Observe how the two colons still exist to delineate the comment field.

Here is an example with the comment field populated:

dgarn:x:1001:1001:Damon Garn:/home/dgarn:/bin/bash
I'll discuss passwords more below, but expect to see an x in the password field of
this file.

For more information, see:

 Linux sysadmin basics: User account management


 Linux sysadmin basics: User account management with UIDs and GIDs

2. Understand the /etc/shadow file


Skip to the bottom of list

Image

Download now
Long ago, password hashes were stored in the /etc/passwd file. This file was world-
readable, allowing inquisitive users to pull password hashes for other accounts from
the file and run them through password-cracking utilities. Eventually, the password
hashes were moved to a file readable only by root: /etc/shadow. Today, the
password field in the /etc/passwd file is marked with an x.

Administrators should recognize each field in /etc/shadow. Several of the fields


pertain to password requirements.

Here's an example of /etc/shadow fields:

username:password:last password change:min:max:warning:inactive:expired


The first two fields identify the user and a hashed version of the password, while the
remaining six fields represent password change information. The password
information is manipulated with the chage command.

Look at these articles for additional details:

 The effects of adding users to a Linux system


 Forcing Linux system password changes with the chage command

3. Create, modify, and delete user accounts

The process for managing user accounts is very straightforward. Sysadmins either
add, modify, or delete users, and the related commands are quite intuitive.

The commands to manage user accounts on RHEL and RHEL-like distributions are:

 useradd
 usermod
 userdel
Ken Hess documents these commands in Linux sysadmin basics: User account
management. There are many options available to customize the user accounts and
their related resources.

My companion article provides specifics about the useradd, usermod,


and userdel commands.

[ You might also be interested in downloading the Bash shell scripting cheat
sheet. ]

4. Manage password requirements

Many organizations rely on password policies to define appropriate password


requirements. Sysadmins can enforce those requirements by using various
mechanisms on Linux.

Two common ways of managing password settings are using


the /etc/login.defs file or Pluggable Authentication Module (PAM) settings. Be sure
to understand the options, fields, and settings for this important security
configuration.

For more detail on password security settings, read:

 Managing Linux users with the passwd command


 Linux security: 8 more system lockdown controls
 How to enhance Linux user security with Pluggable Authentication Module
settings
 An introduction to Pluggable Authentication Modules in Linux

Managing groups
It's more efficient to group user accounts with similar access requirements than to
manage permissions on a user-by-user basis. Therefore, sysadmins need to be
comfortable with the process of creating, modifying, and deleting groups.

[ Practice your Linux skills in the free online course RHEL technical overview. ]

1. Understand the /etc/group file

Similar to the /etc/passwd file above, the /etc/group file contains group account
information. This information can be essential for troubleshooting, security audits,
and ensuring users can access the resources they need.

Understand each field of the file to make life easier as a sysadmin.

The fields in the /etc/group file are:

groupname:password:GID:group members
Here is an example of the editors group with two members:
editors:x:2002:damon,tyler
Tyler Carrigan's article Managing local group accounts in Linux presents this
information nicely.

Linux groups are significantly different from local groups in Windows, so be sure to
understand the differences.

2. Create, modify, and delete groups

Like the user account commands described above, the group management
commands are very intuitive and provide a lot of flexibility. There is an easy-to-
remember command for each function you might need to carry out for a group:

 groupadd
 groupmod
 groupdel

The following articles provide a good overview of working with groups:

 Managing local groups account in Linux


 3 basic Linux group management commands every sysadmin should know

Linux File Permissions


Every file and directory in your UNIX/Linux system has following 3
permissions defined for all the 3 owners discussed above.

 Read: This permission give you the authority to open and read
a file. Read permission on a directory gives you the ability to
lists its content.
 Write: The write permission gives you the authority to modify
the contents of a file. The write permission on a directory gives
you the authority to add, remove and rename files stored in
the directory. Consider a scenario where you have to write
permission on file but do not have write permission on the
directory where the file is stored. You will be able to modify the
file contents. But you will not be able to rename, move or
remove the file from the directory.
 Execute: In Windows, an executable program usually has an
extension ―.exe‖ and which you can easily run. In Unix/Linux,
you cannot run a program unless the execute permission is
set. If the execute permission is not set, you might still be able
to see/modify the program code(provided read & write
permissions are set), but not run it.

File
Permissions in Linux/Unix
Let‘s see file permissions in Linux with examples:

ls – l on terminal gives
ls - l

Here, we have highlighted ‘-rw-rw-r–‘and this weird looking code is


the one that tells us about the Unix permissions given to the owner,
user group and the world.

Here, the first ‗–‗ implies that we have selected a file.p>


Else, if it were a directory, d would have been shown.

The characters are pretty easy to remember.

r = read permission
w = write permission
x = execute permission
– = no permission

Let us look at it this way.

The first part of the code is ‘rw-‘. This suggests that the owner
‗Home‘ can:

 Read the file


 Write or edit the file
 He cannot execute the file since the execute bit is set to ‗-‗.

By design, many Linux distributions like Fedora, CentOS, Ubuntu,


etc. will add users to a group of the same group name as the user
name. Thus, a user ‗tom‘ is added to a group named ‗tom‘.

The second part is ‘rw-‘. It for the user group ‗Home‘ and group-
members can:

 Read the file


 Write or edit the file

The third part is for the world which means any user. It says ‘r–
‘. This means the user can only:

 Read the file


Changing file/directory permissions in Linux
Using ‘chmod’ command
Say you do not want your colleague to see your personal images.
This can be achieved by changing file permissions.

We can use the ‗chmod’ command which stands for ‗change


mode‘. Using the command, we can set permissions (read, write,
execute) on a file/directory for the owner, group and the world.

Syntax:
chmod permissions filename
There are 2 ways to use the command –

1. Absolute mode
2. Symbolic mode

Absolute(Numeric) Mode in Linux


In this mode, file permissions are not represented as characters
but a three-digit octal number.

The table below gives numbers for all for permissions types.

Number Permission Type


0 No Permission —
1 Execute –x
2 Write -w-
3 Execute + Write -wx
4 Read r–
5 Read + Execute r-x
Number Permission Type
6 Read +Write rw-
7 Read + Write +Execute rwx
Let‘s see the chmod permissions command in action.

In the above-given terminal window, we have changed the


permissions of the file ‗sample to ‗764‘.

‗764‘ absolute code says the following:

 Owner can read, write and execute


 Usergroup can read and write
 World can only read

This is shown as ‘-rwxrw-r–

This is how you can change user permissions in Linux on file by


assigning an absolute number.

Symbolic Mode in Linux


In the Absolute mode, you change permissions for all 3 owners. In
the symbolic mode, you can modify permissions of a specific owner.
It makes use of mathematical symbols to modify the Unix file
permissions.

Operator Description
+ Adds a permission to a file or directory
– Removes the permission
= Sets the permission and overrides the permissions set earlier.
The various owners are represented as –

User Denotations
u user/owner
g group
o other
a all
We will not be using permissions in numbers like 755 but characters
like rwx. Let‘s look into an example

Changing Ownership and Group in Linux


For changing the ownership of a file/directory, you can use the
following command:
chown user filename
In case you want to change the user as well as group for a file or
directory use the command
chown user:group filename
Let‘s see this in action

In case you want to change group-owner only, use the command


chgrp group_name filename
‗chgrp’ stands for change group.

Tip
 The file /etc/group contains all the groups defined in the
system
 You can use the command ―groups‖ to find all the groups you
are a member o

 You can use the command newgrp to work as a member a


group other than your default group

 You cannot have 2 groups owning the same file.


 You do not have nested groups in Linux. One group cannot be
sub-group of other
 x- eXecuting a directory means Being allowed to ―enter‖ a dir
and gain possible access to sub-dirs
 There are other permissions that you can set on Files and
Directories which will be covered in a later advanced tutorial

You might also like