CS342 Linux Unit 3 Assignment Somil S Chandra
CS342 Linux Unit 3 Assignment Somil S Chandra
Q1. How can we configure cent os 7 for ftp? Explain the steps with proper
command syntaxes.
Q2. Write the boot (or startup) process of Linux. What do you mean by run
level?
<answer of question 2 should be written and attached (if image taken of
your hard copy)>
Note: After completing (i.e. filling SAP, NAME, answers etc.) , submit this
document only either in doc or pdf format.
# firewall-cmd --reload
# cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.orig
Next, open the config file above and set the following options with these
corresponding values:
5. Now configure FTP to allow/deny FTP access to users based on the user
list file /etc/vsftpd.userlist.
By default, users listed in userlist_file=/etc/vsftpd.userlist are denied login
access with userlist_deny option set to YES, if userlist_enable=YES.
However, userlist_deny=NO alters the setting, meaning that only users
explicitly listed in userlist_file=/etc/vsftpd.userlist will be permitted to
login.
userlist_deny=NO
That’s not all, when users login to the FTP server, they are placed in a
chroot’ed jail, this is the local root directory which will act as their home
directory for the FTP session only.
Next, we will look at two possible scenarios of how to chroot FTP users to
Home directories (local root) directory for FTP users, as explained below.
6. Now add these two following options to restrict FTP users to their Home
directories.
chroot_local_user=YES
allow_writeable_chroot=YES
Solution 2 :
The following are the 6 high level stages of a typical Linux boot process.
1. BIOS
BIOS stands for Basic Input/Output System
Performs some system integrity checks
Searches, loads, and executes the boot loader program.
It looks for boot loader in floppy, cd-rom, or hard drive. You can
press a key (typically F12 of F2, but it depends on your system)
during the BIOS startup to change the boot sequence.
Once the boot loader program is detected and loaded into the
memory, BIOS gives the control to it.
So, in simple terms BIOS loads and executes the MBR boot
loader.
2. MBR
3. GRUB
GRUB stands for Grand Unified Bootloader.
If you have multiple kernel images installed on your system, you
can choose which one to be executed.
GRUB displays a splash screen, waits for few seconds, if you
don’t enter anything, it loads the default kernel image as specified
in the grub configuration file.
GRUB has the knowledge of the filesystem (the older Linux loader
LILO didn’t understand filesystem).
Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a
link to this). The following is sample grub.conf of CentOS.
As you notice from the above info, it contains kernel and initrd
image.
So, in simple terms GRUB just loads and executes Kernel and
initrd images.
4. Kernel
Mounts the root file system as specified in the “root=” in
grub.conf
Kernel executes the /sbin/init program
Since init was the 1st program to be executed by Linux Kernel, it
has the process id (PID) of 1. Do a ‘ps -ef | grep init’ and check the
pid.
initrd stands for Initial RAM Disk.
initrd is used by kernel as temporary root file system until kernel is
booted and the real root file system is mounted. It also contains
necessary drivers compiled inside, which helps it to access the
hard drive partitions, and other hardware.
6. Runlevel programs
When the Linux system is booting up, you might see various
services getting started. For example, it might say “starting
sendmail …. OK”. Those are the runlevel programs, executed
from the run level directory as defined by your run level.
Depending on your default init level setting, the system will
execute the programs from one of the following directories.
Run level 0 – /etc/rc.d/rc0.d/
Run level 1 – /etc/rc.d/rc1.d/
Run level 2 – /etc/rc.d/rc2.d/
Run level 3 – /etc/rc.d/rc3.d/
Run level 4 – /etc/rc.d/rc4.d/
Run level 5 – /etc/rc.d/rc5.d/
Run level 6 – /etc/rc.d/rc6.d/
A run level is a state of init and the whole system that defines what system
services are operating. Run levels are identified by numbers. Some system
administrators use run levels to define which subsystems are working, e.g.,
whether X is running, whether the network is operational, and so on.
Whenever a LINUX system boots, firstly the init process is
started which is actually responsible for running other start
scripts which mainly involves initialization of you hardware,
bringing up the network, starting the graphical interface.
Now, the init first finds the default runlevel of the system so that
it could run the start scripts corresponding to the default run
level.
A runlevel can simply be thought of as the state your system
enters like if a system is in a single-user mode it will have
a runlevel 1 while if the system is in a multi-user mode it will
have a runlevel 5.
A runlevel in other words can be defined as a preset single digit
integer for defining the operating state of your LINUX or UNIX-
based operating system. Each runlevel designates a different
system configuration and allows access to different combination
of processes.
Solution 3 :
When the real shutting down starts after any delays, all filesystems (except
the root one) are unmounted, user processes (if anybody is still logged in)
are killed, daemons are shut down, all filesystem are unmounted, and
generally everything settles down.