sxwas intended for use by more than one person ata time, Multiuser
aipable many people to have accounts on a single fons
viedata kept secure from others. Multitasking enables many people
ny programs on the compute tthe same ime, with each person
porn more than one program. The person assigned to manage all ofa
tinux systemn’s resources is called the system administrator.
There are mainly
aad system user
oot user; This is also called super user and would have complete
‘aj unfettered control of the system. A super user can Tun any commands
without any restriction. This user should be assumed as a system
sninistrator, The default prompt for the root user is @ pound sign (also
cileda hash mark):#.
the
al
three types of users in Linux: root user, regular user,
users have the necessary privileges to perform
running word processors,
files in their own home
ally have administrative
Regular user: Regular
Sindard tasks on a Linux computer such as
tabases, and Web browsers. They can store
ectories Since regular users do not norm:
Mivilees, they cannot accidentally delete critical operating system
iein Files, The default prompt fora regular users Simpy © on
needed for the ‘operation of
System
user: System accounts are those
Pecific: compon i yecounts
eo example mail accounts: ‘These a
se ‘i ur system, and any
‘sully needed for some specific function on ¥°ration
pe on
accounl Only the
ser TOOL User
fare) J+ ‘ecounts and group accounts,
rk interfac
on — It used 10 be
' configure network interfaces as wo
jnterfaces- Now, many Linux deskto
and stoP network interfaces from
totally up
to
Mas to he r00t user tg
ta
Pa allow nese tn 81 hong
their ¢ Fegular users to stg
lesktop Using aa
many
lege
Managet-
servers — Configuring web servers, filesery
servers, mail servers, and dozens of other s,
privilege, as does starting and stopping th
Pe
{itty
ers, domain name
eIVETS require root
Bes,
t i lose ‘i
that services Fun as Non-Toot users, and content, such sre Often,
tet, | geadded to servers by non-root users if you configure yor earn
jour system
to allow that.
« Security features — Setting up security features, such as firewalls
and user access lists, is usually done by the root user. It’s also up to
the root user to monitor how the services are being used and make
sure that server resources are not exhausted or abused.
Common Administrative Tasks
The Common Administrative Tasks can be classified as:
Judes: the free disk space checking
for the system performance, user
yecific functions
etc.)
System automation which. inc!
‘ad reporting periodic backups, data
‘count maintenance (creation, deletion etc), Business sp
‘monthly/quarterly/yearly report,
(Pushing data to a web server, running
1d document
p Documentation: ‘A good system é
licies, Procedures, and Changes- :
stem administrator should be ® &
ware of at least
ee do, what
cscs cree
dministrator shoul
Communication; A good SY
/ nicator too, All the users shoule
2 system administrator: what he 18 going
he has done.128
raentifying Administrative Files Configuration and Log fic,
entify
ckofitself Linux files are grouped according 1.4, J
go there are separate directories for configu ia
og file 10 store the data of logins and the 1
people are trying to access the comm
ing with system admin. The functions
Linux k
functionality and usagi
and log files keep th
user can monitor the system (0
illegally, These files are dea
administrative files are the following:
+ Setting the Run Level
+ System Services
+ User Management
+ Network Settings
+ Scheduling Jobs
* Quota Management
| + Backup and Restore
+ Adding and Removing software/packages
+ Setting a Printer
| + Monitoring the system (general, logs)
| * Monitoring any specific services running. Eg. DNS, DHCP,
! NIS, NPT, Proxy etc,
Configuration Files
Configuration files on a Linux system that control user p
system applications, daemons, services, and other administrative ta
multi-user, multi-tasking environment. These tasks include
accounts, allocating disk quotas, managing e-mails and news;
configuring kernel Parameters, In Linux each
the configuration file format.
accounts, network addresses,
files (configuration fil
The advantage of plai
€s, or GUI pteferences— is stored i ]
le). This has some advantages and some d
intext files is that it’s easy to read andva administration
any text editor will do. The d
guration files, nO error checki
rogram tat reads these files to find out Svar tayal a eed
Bore erie oe the won ‘YOU set up the files
votre interface t0 fail,
The two major locations of cor nfigu -
uration files are ;
where your personal configuration files asiloa) adic eee
(which holds system-wide configuration fles).The following ate s
interesting configuration files in /etc: lowing are some
« etc/passwd — Stores account information for all valid users for
the system. Also includes other information, such as the home
directory and default shell.
/etc/printcap— Contains definitions for the printers configured for
your computer.
/etc/shadow — Contains encrypted passwords for users who are
defined in the passwd file.
/etc/shells — Lists the shells that are available on the system, as
well as their locations.
Jete/group — Identifies group names and group IDs (GIDs) that
are defined on the system.
/ete/gshadow — Contains shadow passwords for groups.
/ete/hosts — Contains IP addresses and host names that you can
teach from your computer.
Jetc/inittab — Contains information that defines which programs
start and stop when Linux boots, shuts down, or goes into different
sates in between. This configuration file is the first one read when
Linux starts the init process. :
/ete/login.defs - Configuration file for the login command. :
[ete/skel- Contains files and directories that are automatically copied
ii ed.
over to a new user’s home directory when new uae creat “2
/ete/default/useradd - Contains default values for adding mew users:ee ts
130 a
Log Files
ages about the system, inclu
and applications running on it, There are diferen
formation. For example, there is a default System jg
security messages, anda log file for cron tasks, (gg
scripts at a given date and time)
i SS
Log files ar files that contain me
the kernel, services,
files for different in!
file, a log file just for
allows users to run commands or
ful when trying to troubleshoot a probjg
with the system such as trying to load a kernel driver or when looking. f
unauthorized login attempts to the system. So we can use Jog files to hal
tracking the different problems. Most log files are located in the /var/ 4
directory. The following are some interesting log files in /var/log:
Log files can be very use
© /var/log/messages: Contains many general informational messag
about the system.
/varflog/secure: All user authentication events are logged here.
stores all security related messages including authentication failu
¢ /var/log/boot.log: This is the repository of booting rel
information and messages logged during system startup
¢ /var/og/kern.log: It contains information logged by the kem
¢ /var/log/faillog:This file contains information on failed log
attempts.
* /var/log/cron:This log file records information on cron j0
Whenever a cron job runs, this log file records all rele)
information including successful execution and error mes
case of failures,
ppd; ee Alnsl servers related logs are stored here.
re sent or received during a particular p
Role of system administrator i
activities; following are the Service to its users, This involves a Vse bain —
‘Adding new users to the system a
directories and basic privileges,
131
nd configuring their home
Installing any new software, includin
ofthe operating system, or bug fixes,
Monitoring the usage of the file s
c a yystem, ensuring that
using too much disk space and t) Tee
a hat all backups are carried out
‘¢ Responding to problems from users, attempti
7 F s S, ipting to track de
and meeting with suppliers as appropriate. Se sgee
Installing new hardware components.
applications, new versions
«Ensuring the smooth operation of any network services, such as
electronic mail or remote access to other machines. ;
Managing user accounts-adding & deleting users
Adding and managing users are common tasks for Linux systems
administrator. User accounts keep boundaries between the people who use
your systems and between the processes that run on your systems: Groups
area way of assigning rights to your system that can be assigned to multiple
users at once. :
Users who want to log in to a Linux computer must have an existing
user account, which consists of properties that allow a user to access files
mation can be created
and folders stored on the computer. This account info :
and stored on the computer itself or on another computer on the neswork.
‘Accounts stored on the computer are called local user accounts. ‘Accounts
stored in eDirectory are called eDirectory user accounts.
Adding, users - useradd
The command to add new user is
useraad [options]
useradd ‘command for sae a
useradd. The synatx is:
Ifthe system administrator uses
then he must set an initial password for the user using pass
passwd [options] Options used wi
Options
‘comm
| -dhome dir
| -e expire date
|
bee 1 in the /et
The new user
inserts necessar
Set the home directory to use for the account. The. deta
TMs Atm
ra
ssw
information se da stop flee
file
Al,
Jetc/shado so
ry entries in
ith useradd command
Meaning. -
Provide a description of the new user account, Typical
this will be the person’s full name. Replace Comment
with the name of the user account
is to name is the same as the login name and to place ig)
in /home. Replace home_dir with the directory name toll
use
Rather than create a new account, save the supplied
information as the new default settings for any new
accounts that are created.
Assign the expiration date for the account in YYYY-
MM-DD format. Replace expire_date with a date you,
want to use,
-f days. Set the number of days after a password expires. until]
the account is Permanently disabled. The default, -1,|
disables the option. Setting this to 0 disables the account|
immediately after the password has. expired. Replace -
(that’s minus one) with the number to use. 3
-8 group Set the primary group the new user will be in. Rep
Sroup with the group name. Without this option, anew
cep is serene’ that is the same as the user name and
used as that user’s Primary grou
-G grouplist i Ev.
= Ee mate list of groups that user belongs to. :
the cea Create the user’s home directory and oP)
[eles in theskeleton directory (/etc/skel) to it.
re]
|a adiration —
= | Allow the creation of
2
133
f
|
Fost | Enter a password for the account y
?
must be an enerypted password,
awed |
Specify the command shell to us
Options used with passwd command
h 4 User account with a duplicate
(non-unique) UID.
Du are adding, This
for this account
Specify the user ID number for the
n-separated fields; each
word(x) stored in
Be Shell.
Fi f seven colo!
The above entry contains a set o!
field has its own meaning. The fields eee directory,
‘“c/shadow file, User ID, Group ID, :
ting: it fo eradd command performs
n for Torvalds, the us‘ idd command pe!
the accoun'
————— ||Lint Ady
Mira
jult/useradd fi}
134 ;
Reads ein. deps and /e
ead
les to
é BCL dep
ne /etc/los : : ; :
jh reat eating accounts.
values to us
It
n cre va Si
. .¢ parameters to find out which defi,
Checks command-line pat mall
to override,
as a new user entry in #
he /ete/passwd and /etc/shady,
e Create:
: he default values an‘
, fi
d.command-line parameters,
based on #l @ iu
Creates any new group entries in the /efc/group file.
© é : the user’s name, i
‘Creates a home directory, based on the home
directory. .
©. Copies any files located within the /etc/skel directory to the ney
home directory. This usually includes login and application stay
scripts.
Example2:
The useradd command is told to create a home directory
Tarvalds (-m), make users theprimary group Torvalds belongs to (-2)
add to the groups Linux and Unix and assign fcsh as primary command
shell (8).
I$ sudo useradd -c "Linus
Leora rir
Pari
or eoer Tar
‘ion tokens updated successfully
Modifying users with usermod command
After creating user accounts,
charige the attributes of
directory, login name, logi
case “usermod’ comman
, in some scenarios where we nee
an existing user such as, change uset’s hom
in shell, password expiry date, ete, wherei™
is used. Syntax is as follows:
usermod [options] “Susername>— =
—- 135
Fe omment” | Provide a description ofthe new
i , User account, Typica
will be the person’s full name. Replace cera aly this
name of the user account ment with the
Le dir | Set the home directory to use for the account
\¢ di The default is |
Frome dit eit ome rectory to use for the account. The default is
fe same as the login name and to place it in /
home. Replace home_dir with the directory name to use
“expire date | Assign the expiration date for the account in YYYY-MM-
DD format. Replace expire date with a date you want to use.
Ta Set the number of days after a password expires until the
account is permanently disabled, The default, -1, disables
the option. Setting this to 0 disables the account immediately
after the password has expired. Replace -I (that’s minus one)
with the number to use. a
-g group Set the primary group the new user will be in. Replace group
with the group name. Without this option, a new group is
created that is the same as the user name and is used as that
R ‘user’s primary group.
F | egrouplist || Set the list of groups that user belongs to.
i \a moving the contents ‘of the home directory from existing home
wi dir to new dir.
a ‘A group having the same name as the user being added to the
a system will be created by default.
1
Enter a password for the account you are adding, This must
be an encrypted password.
Specify the command shel to use for this account
ify the user ID number for the account
a fo the name supplied after 1
q change login name of account
ample
~usermod -s /bin/esh Torvalds
Deleting users- userdel cena
command from the system,
js used to remove a user me
mere : ies pertaining t© the specified user from ts three fil
che General format is:
‘etcipasswd,Jercshadow, an4 /ee/270¥?-Line Ady,
sry
ie
ie me>
=: userdel [options]
The chmod utility support two modes for modifying permissions:
* Symbolic Mode
* Absolute(Numeric) Mode
1. Symbolic Mode
e operators to set the
The symbolic mode uses letters and som
Demission, Wz asing the symbotic mode the chmod comimans Iss the
‘lowing syntax:
chmod [ug 0 aff -=}
The name of group will change into newname.
To change the group ID ary eos
To change the group GID to a non-unique value,
To change the encrypted password
xample:
groupadd oldgroup //Creates new group oldgroup
groupmod -n newgroup oldgroup //Change the group name to
newgroup
groupmod —g 9090 newgroup //Change the group ID of
newgroup to 9090
‘Temporary disabling of users accounts
Linux systems allow you to disable access to particular user account
without changing anything from the account. This might be useful ifyou
do not want to remove user account permanently but, you Just want it
disabled and no longer able to use the system. The disabled vse" will still
ceive emails for example, but he will not be able to login and check tee
Rae care tcamporarily disabled or permanently SO
disable user account:
‘There are two methods to temporary
1. Editing /etc/shadow file
2. using passwd command
ting /etc/shadow file - ee
s jorarily by J
event Sa sfites en fed inthe file etc/shadow.
or“! at- Liner Adminisy
won't permit login for this account. Whenever
This means that “*” and “! ine asterisk and the user acc
you want to enable the account, just case f
is back in operation, with its old passwor
For example you want to disable user “Torvalds” then you can do jig
as follows:
vi /ete/shadow
Torvalds:*$1$narMEFm6$fhA | puOU422HiSL Saget ip
211193:0:99999:7:-1:-1:134539228
Here, the second field is the encrypted password. You can prefix the
password with “*” or “!”, This will render user account inaccessible and i
will mean that no login is permitted for that user.
2. Using passwd command
user password.
Torvalds;!!$1$eFd7EIOgSEeCk6X gk ktWSUgi2pGUpk.:13852:0:99999:7:::
Now in case if you want enable the account just unlock it using -U
option as follows:
‘You can also
enable account by removing manually the “!” chara
from the user’s
Password line in /etc/shadow.
Creating and mounting file system
A fille system is the me
uses to keep track of files
organized on the disk,
that is used to store th
thods and data structures that an operating system
Ona disk or partition; that is, the way the files are
The word is also used to refer to a partition or 4
e files or the type of the file system.efore any partition or
and actual data structures need to be
x of all the records on the disk, This
Sk is used ag 'ystemy, ni
14
file system, it is i tial
ilized
Written to the disk w ep:
a onto thedisk which ke
Process is called making , fi
g a file
A file system is either the device file associated
pice ons the directory where the fle system is momen nent
requirement fo mount a partition or to use a parti a eae The basic
wet frst be installed on it, This is al ae
data blocks.
Creating a file system writes information to the device and create
iyder of the empty space. This file system-related data consumes a iT
ntage of the space. The remaining space on the disk drive is mk into
‘small, consistently sized segments called blocks. Linux supports a number
offile system types, some of which are described as follows
eu ae oa
High performance for fixed disk and removable media
file system
SO a process of creating inodes
ext3 Journaling version of ext2 |
ext4 Supports larger files and file system sizes
Vfat MS-DOS file system useful when sharing files between |
Windows and Linux
High-performance journaling file system
storage system:
|__Birfs [| Addresses scalability requirements of large tems_|
Creating a file system
The command to build a
mkfs, The syntax for the comma!
a 5
mbfs [options] device
for each file s:
a device, or hard disk
Linux file system 0
ind is:
stem type: The
depending on the
ee vumarized lO"a Ui han,
an a,
uth filesystem, (ext2,¢;
Select,he-type of the filesy me
ext2.
default file system tY1 Bios
Search for bad blocks and initialize the bad Doris
© accordingly Ennai
duce verbose output, all fle ya
Beis commands that are executed. Specifying
gption more than once inhibits execution of an, |
system-specific commands. This is really only yor
for testing. es
Display version information and exit. Option -V disig~
version information only when it is the only parame.
otherwise it will work as —verbose. ,
“version
Example: To make a ext2 files system on a hard disk, use the following
The default file system type created when using thé mkfs command:
ext2. Following commands create an ext2 file system on the specified device
Here sda2 means second partition of the first HDD:
mkfs /dev/sda2
mke2fs /dev/sda2
mkfs.ext2 /dev/sda2
To create an ext3 file system, use any of the following commands
mkfs —t ext3 /dev/sda2
mke2fs -t ext3 /dev/sda2
mkfs.ext3 /dev/sda2
To create an ext4 file system, use any of the following command
; mkfs +t ext4 /dev/sda2
‘ mke2f —t ext /dev/sda?
eet mkfs.ext4 /dev/sda2
To see which supported = ‘ehh
use the Is /sbin/mkfs* ae types are installed in yousnaivtaion
F punting He _— —=-— a
The meaning of Mounting is to attacy
tem 10 the currently accessible file Sana int
Sony structure begins with the root directory, wh
Ber contains allother diectories and files onthe oe
forward slash (/). The currently accessible files
that can DE accessed at given time w: Y
ly created. file
. On Linux 08,
ichis the directory
j ea ands referred by
stem isthe file syste
ithout special programming orsertnes,
File systems on different partitions and remoy: .
(os DVDS or USB Mash crives, mstbeatachedo eee
jp be accessed. To attach a partition or device, a mount point a @
created. Mount point refers to the empty directory the caneaty
svailable file system with which a newly created or additional filesystem
t mounted. The /mnt directory already exists in Linux. This directory
‘vith its subdirectories like /mnt/floppy, /mnvlusb are intended specifically
fo be used as mount points for removable media such as CDROMS,
USB key drives and floppy disks. So a mount point is simply 2 directory
created with the mkdir command. After a directory, or mount point, is created,
attach the partition by using the mount ‘command. Syntax for the mount
command is:
mount
-b sectorsize
Specify the sector size of the disk.
Specify the number of cylinders of the disk.
Specify the number of heads of the disk.
Specify the number of sectors per track of the disk
List the partiti : mare
ie ie oaioa tables for the specified devices
3 :
7 splay the size of the Partition (in blocks)
:To lists all the pattitions on your system, use:artitions on the Specific device, use
sk’s partitions, you have to enter incor
Il commands which are available for fdisk,
ommand mode for the first disk device:
Silisk /dev/sda
The followingiW Ady
vag display units
{verify the pation te
write table co isk and exit
pperts only)
cal
Command (m for help):
Meaniny
[Command mode option | [To print listof commands
—_1“To create a new partition
fi To delete a partition
To print current partition table
eee |
Create a New Disk Partition:
To create a new partition; type ‘n’ in command mode. While creating
anew partition, it will ask you two options ‘extended* or ‘primary’ partition
creation. Press ‘e* for extended partition and ‘p‘ for primary partition. Yo. 1
will then be prompted to enter the first cylinder or sector number of the
partition to be created. You may press Enter to accept the defaults, whichis
the first free sector on the disk. Then, specify the last sector number of ie
Partition to be created. You may press Enter to use all available space ai
the first sector or enter a specific size such as +2G or +256M for a2 gigabyte
or 256 megabyte partition respectively.
—~
=|
5 After creating a new Partition, you should run ‘w‘ command to alttt
and’ save new changes to partition table and
i ‘p
Verify newly created partition, Ea
After the new.
ae Partition i
partition using ion is creat
ite
cee ted, you need to format the newly creat
re mifs.extd /dev/sda2
er formattis Sa:
flag ‘s* (displays sen ets Check the size of that partition 1
size of any specifig on with fdisk command. This way YO
Siisk-s feyjagyfdisk dev/ada
nin memory only,
‘w),
Until you decide to write them
‘To delete a partition for the hard disk and free up space occupied by
that partition enter ‘d* in command mode. Then you will be prompted to
cnler partition numbet that you want to delete, Then run “w* command to
alter andisave new changes to partition table and reboot for changes. For
example, if you want to delete the partition 4 from /dev/sda hard disk, then
justtype 4. Then it will delete partition number 4° (je, /devisda4) disk and
free space in partition table. :
—
Tae156 = .
Installing and removing packages with rpm command
Jageisa consolidation of files needed to Provide a fey
i ‘An RPM pack gor, a photo viewer, or a file server. Inside an Rp
such as a word pro onfiguration files, and documentation that maja
can be the contre, However, an RPM file also contains metadata jl
ise es sida about the contents of that package, where the pack,
Se eat jt needs to run, and other information. Each sof
Pela is actually an RPM package, consisting of an archive of so
files and information about how to install those files. Each archive regi
asa single file with a name that ends with .7pm, indicating it isa softy
package that can be installed by the RedHat Package Manager.
RPM (Red Hat Package Manager) is a default open source and mg
popular package management utility for Red Hat based systems
(RHEL, CentOS and Fedora). The tool allows system administrators
users to install, update, uninstall, query, verify and manage
software packages in Unix/Linux operating systems. The RPM fon
knowns .rpm file, that includes compiled software programs and
needed by the packages. This utility only works with packages that bu
on .rpm format.
© RPMis free and released under GPL (General Public License).
© RPM keeps the information of all the installed packages unde
var/lib/rpm database,
* RPMis the only way to install packages under Linux systems.
* RPM deals with .rpm files, which contains the actual inform
about the packages such it i
a as: what it is, from where
comes, dependencies info, version info etc,
There are five basic modes for RPM command
is Install : It is used to install
on any RPM package.a ’
Tnstall the package
[Giastallithe packag
‘date package, same
removed.
s install but any previou =
ly Previous y ~
version
is
ee
Perform query operation
List all installed packages in system
‘List all configuration files from package
List all documentation files from fee
List all dependent packages
Provide information about package
all files from package
ind the package which belon:
Perform query jn individual package
package we use -i options.
h
Eg: rpm —-q MySql
‘To listall installed packages insystem, We
pm —qa
6 We can use -ga option with last, it will
rpm packages.
rpm —qa —last
7. To get more detailed information about a package s
release, architecture, group, size, build date, install
vendor we can use following command.
rpm -qi
Eg: rpm—qi MySql
8, To view all the files of an installed rpm packages, use the
list) with rpm command. =
rpm -4l
Ss
Be the fem superuser,
tare the different users i
Users in Li
Differentiate sudo Sie in Linux?
Define useradd command
He
low to set a Password for the ‘TeW user?
Define userde] ot
What is chmod aes
What is the us,
© OF chown
Svmcommand?
1
2
3.
4,
ot
6 Defi
T Den Pade Command,
8
9,"what is the
+ hat is disk partitioning?
__ pansion
powto-aztete ® grouy
jch command is used for mot z fi
whi unting file system?
an ferentiate uname and hostname command.
what is apm?
use of mkfs command?
Part B
‘What are the roles of system administrator?
Write note on configuration and log files.
Write note on how to add and delete a user.
How to set permission for a file?
| Howto change the ownership of a file?
. Write note on how to add and delete a group.
‘What are the different methods to temporary disable a user account?
What are the commands used for monitoring system performance?
| Write note on creating and mounting file system.
How disk partitioning is performed?
|. Write note on rpm packages.
Part C
Explain the common administrative tasks in Linux. 5
What is file system? Explain how to create and mount a file system in Linux.
Explain the following commands:
a, Useradd b) userdel ¢) Groupadd d)groupdel
b. Chmod and chown