0% found this document useful (0 votes)
5 views

Linux Unit 2

Uploaded by

mefalim212
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Linux Unit 2

Uploaded by

mefalim212
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

LINUX UNIT 2

1. What is Logical Volume Manager? What are the different types of partitions that are created in
Linux?
Ans
1) Partitions offer a rather static way to configure storage on a server, whereas logical volumes offer
a much more dynamic way to configure storage. However, all Red Hat servers have at least one partition
that is used to boot the server
2) If you need only basic storage features, you’ll use partitions on the storage devices. In all other
cases, it is better to use logical volumes
3) The Logical Volume Manager (LVM) offers many benefits. The following are its most interesting
features:
• LVM makes resizing of volumes possible.
• In LVM, you can work with snapshots, which are useful in making a reliable backup.
• In LVM, you can easily replace failing storage devices
4) Creating a partition with fdisk is easy to do. After starting fdisk, you simply indicate you want to
create a new partition. You can then create three kinds of partitions.
5) Primary Partitions These are written directly to the master boot record of your hard drive. After
creating four primary partitions, you can’t add any more partitions—even if there is still a lot of disk space
available.
6) Extended Partition Every hard drive can have one extended partition. You cannot create a file
system in an extended partition. The only thing you can do with it is to create logical partitions
7) Logical Partitions A logical partition (not to be confused with a logical volume) is created inside an
extended partition. You can have a maximum of 11 logical partitions per disk

2. What are different File Systems available on RHEL?


Ans
1) Red Hat Enterprise Linux (RHEL) supports several file systems, each suited for different purposes.
Here are the most common file systems available:
1. ext4 (Fourth Extended File System)
Default file system for many RHEL versions.
Features: Journaling, support for large file sizes (up to 16 TB), and backward compatibility with ext2 and
ext3.
Use Case: General-purpose file system for desktops and servers.
2. XFS (eXtents File System)
Default in newer RHEL versions (e.g., RHEL 7 and 8) for large-scale deployments.
Features: High performance, journaling, and support for very large files and file systems (up to 8
exabytes).
Use Case: High-performance servers, databases, and large storage systems.
3. vfat (Virtual File Allocation Table)
Compatibility file system for Windows environments.
Features: Simple structure, limited features, no journaling.
Use Case: Removable media like USB drives and cross-platform file sharing.
4. NFS (Network File System)
File system protocol for sharing files across a network.
Features: Remote access, stateless architecture, and cross-platform compatibility.
Use Case: Network-based file sharing between systems.
5. tmpfs (Temporary File System)
In-memory file system for temporary data.
Features: Volatile storage, very fast, and automatically cleared on reboot.
Use Case: Temporary storage for applications or system processes.
3. Write a short note on runlevels and services in Linux.
Ans
1) The term ‘Run level’ has been used to set the different modes of Linux. Red Hat or Fedora Linux offers
6 run level.
2) Each run level has a set of process associated with the folder i.e / etc/ rc.d.
3) This folder control the default run level for the system to use when it boots.
4) You can change the run level by using the file /etc/inittab
Following is the run level and it's services
0 - Halt
1 - Single user mode
2 - Not used ( user definable)
3 - Full multi user mode
4 - not used ( user definable)
5 - Multi - user ( With GUI)
6 - Reboot
5) There are many sub folders substituted to this run levels for change in script. Following are the
directories:
rc0.d ; rc1.d ; rc2.d ; rc3.d ; rc4.d ; rc5.d ; rc6.d
6) The number in the directories name correspondence to the run level. Each of these directories
contains script that are used to start and stop service for the run level.
7) Scripts beginning with S denote startup scripts while scripts beginning with K denote shutdown (kill)
scripts.

4. Discuss the steps to configure key based SSH authentication.


Ans
1) The default authentication method in SSH is password based, which means when connecting to a
server you need to enter the password of the user with whom you are connecting.
2) You can make use of key based authentication. When itbus used, make sure the public key is
available on the server to all users you need to use this technology where they want to login or log out.
3) The user create an authentication request i.e sign in with there private key.
4) This authentication request is match to the public key of the same user ton the server where that user
want to authenticate.
5) If it matches, the user is allowed to enter. Of doesn't, the user is denied.

5. Explain group configuration file.


Ans
1) group accounts always represent some sort of logical organization of users.
2) Like user accounts, groups have group identification numbers, or GIDs, and it is common for users to
be members of several groups.
3) Groups are used to tie one or more users together to simplify administrative tasks.
4) The group file used in LINUX is /etc /group. It has one entry per line, and each line has the format:
groupname : password : gid : userlist
• gid is the numeric group ID number
• groupname is the name of the group
• password is an optional field containing the encrypted group password
• userlist is a comma-separated list of the user account names that compose the group
5) To create a new group, use the groupadd command.
Its syntax is:
groupadd [-g gid [-o]] | [-r] [-f] groupname
6) Managing Group MembershipTo manage group membership, you can use the usermod and groupmod
commands.
7) The available usermod options provide three different choices to manipulate group membership.
• -g, --gid GROUP This option is used to set the primary group for the user.
• -G, --groups GROUPS Use this option to defi ne a new list of supplementary groups.
• -a, --append Use this option together with -G to add new supplementary groups to the current list of
supplementary groups.

6. What is use of fstab? Explain contents of fstab.


Ans:
1) It contains information about file system , such as what file type the partitions are, where they are,etc.
2) They are located on the hard drive and what mount point is used to access them.
3) When file system check (fsck) is run at boot time, it also checks all the file system listed in the fstab for
consistency.
4) It then fixes corrupted file system usually because they were not mounted properly when the system
suddenly crashed or lost power.
5) The fstab has 6 fields which represents a different configuration value.
▪ The first field describes the file system which can be the partition name, a logical volume,etc.
▪ The second field is a mounting point used to access the file system.
▪ The third field describes the file system type.
▪ The fourth field is for any mount option that may need.
▪ The fifth field is either ‘0’ or ‘1’ to determine whether to dump or backup this file system.
▪ The last field is for fsck which checks the file system.

7. What is a swap space? Write procedure to add swap space.


Ans
1) Swap space is allocated when your server is completely out of memory, and using swap space allows
your server to continue to offer its services.
2) Therefore, you should always have at least a minimal amount of swap space available.
3) In many cases, it’s enough to allocate just 1GB of swap space, just in case the server is out of
memory.
1. Use dd if=/dev/zero of=/swapfile bs=1M count=1024. This command creates a 1GB swap file in the
root directory of your server.
2. Use mkswap /swapfile to mark this file as swap space.
3. Type free -m to verify the current amount of swap space on your server. This amount is expressed in
megabytes.
4. Type swapon /swapfile to activate the swap file.
5. Type free -m again to verify that you just added 1GB of swap space.
6. Open /etc/fstab w ith an editor, and put in the following line: /swapfile swap swap defaults 0 0.

8. What is NetworkManager configuration file? Explain any five network configuration file
variables.
Ans
1) In the directory /etc/sysconfig/network-scripts, you’ll find a Configuration file for each network interface
on your server. The names of all of these files start with ifcfg- and are followed by the names of the
specific network cards.
2) If your network card is known as p6p1, for example, its Configuration is stored in
/etc/sysconfig/network-scripts/ifcfg-p6p1. Different variables are defined in the Configuration file.
9. What are Snapshots? Give steps to manage Snapshot.
Ans
1) Snapshots are also commonly used to create backups safely.
2)Instead of making a backup of the normal LVM volume where files may be opened, you can create a
backup from the snapshot volume, where no file will be open at any time.
3) When initially creating a snapshot, the file system metadata is copied to the newly created snapshot
volume.
4) The file blocks stay on the original volume, however, and as long as nothing has changed in the
snapshot metadata, all pointers to the blocks on the original volume remain correct.
5) When a file changes on the original volume, the original blocks are copied to the snapshot volume
before the change is committed to the file system.
This means that the longer the snapshot exists, the bigger it will become.
6) Every snapshot has a life cycle; that is, it’s not meant to exist forever.
7) If you no longer need the snapshot, you can delete it using the lvremove command.
8) Steps to Manage Snapshots
1. Creating a Snapshot (LVM Example)
Use the lvcreate command with the -s flag to create a snapshot.
Example:
lvcreate -L <size> -s -n snapshot_name /dev/volume_group/logical_volume
Replace <size> with the desired size of the snapshot (e.g., 1G).
Replace snapshot_name, volume_group, and logical_volume with appropriate names.
2. Mounting a Snapshot
mount /dev/volume_group/snapshot_name /mnt/snapshot
3. Deleting a Snapshot
lvremove /dev/volume_group/snapshot_name

10. Explain useradd, usermod, userdel commands. Explain the following options of passwd
command: -l, -u, -S, -e, -n min, -c warn, -i intact.
Ans
1. useradd : Used to create a new user account in Linux
useradd username
2. usermod : Used to modify an existing user account.
usermod -aG groupname username
3. userdel : Used to delete a user account.
userdel username
1. -l (Lock Account)
Locks a user account by disabling the password.
Example:
passwd -l username
2. -u (Unlock Account)
Unlocks a previously locked user account.
Example:
passwd -u username
3. -S (Status of Password)
Displays the password status of a user.
Example output:
username P 07/17/2023 0 99999 7 -1
(Indicates if the account is locked, password age, and expiration).
4. -e (Expire Password Immediately)
Forces the user to change their password on the next login.
Example:
passwd -e username
5. -n <min> (Set Minimum Password Age)
Specifies the minimum number of days before a user can change their password again.
Example:
passwd -n 7 username
6. -c <warn> (Set Warning Period)
Sets the number of days before expiration that the user is warned to change their password.
Example:
passwd -c 5 username
(Warns user 5 days before the password expires).
7. -i <inactive> (Set Inactivity Period)
Sets the number of days after password expiration that the account will be disabled if not changed.
Example:
passwd -i 10 username
(Disables the account 10 days after password expiration).

11. What are Pluggable Authentication Modules? What are its two parts? Explain.
Ans
1) On Linux, pluggable authentication modules (PAM) are what is used to make authentication pluggable.
2) Every modern service that needs to handle authentication passes through PAM.
3) There are two parts in PAM. First there are the configuration files in use.
4) Every service has its own configuration file in the directory /etc/pam.d.
5) For instance, the login service uses the configuration file /etc/pam.d/login
6) The PAM file for login defines how to handle login.
7) This file has three columns that define the login process.
8) In the first column, the authentication process is split into four different phases: auth, account,
password, and session.
9) These are the stages that are typically passed through in the authentication process, but in the end,
the writer of the PAM module decides which of these to implement.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy