To set SGID
* What are the process states in linux
To check the kernel version use any of the following command.
[root@node213 ~]# uname -a
Linux node213.example.com 2.6.18-348.el5 #1 SMP Wed Nov 28 21:22:00 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
[root@node213 ~]# uname -r
2.6.18-348.el5
[root@node213 ~]# cat /proc/version
Linux version 2.6.18-348.el5 (mockbuild@x86-002.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-54)) #1 SMP Wed Nov 28 21:22:00 EST 2012
To upgrade the kernel , download the kernel rpm file and install it using rpm -ivh command. Don’t use rpm -Uvh, because it will upgrade the existing kernel and we won’t able to go to the previous kernel version at any point of time. If we require to remove the old kernel, use rpm -e and also remove the entry form /etc/grub.conf file.
* List the 6 stages of boot process ?
BIOS, MBR, GRUB, Kernel, init, runlevel.
* How to mount an ISO file ?
[root@node213 mnt]# mount -o loop /tmp/rhel-server-7.0-x86_64-dvd.iso /mnt
* Which are the runlevels in linux ?
runlevel 0 – Halt/ Shutdown .
runlevel 1 – Single user mode.
runlevel 2 – Multi user mode without network.
runlevel 3 – Multi user mode with network.
runlevel 4 – unused.
runlevel 5 – Graphical.
runlevel 6 – Reboot
* Explain the entries in fstab ?
[root@node213 mnt]# cat /etc/fstab
LABEL=/1 / ext3 defaults 1 1
LABEL=/home /home ext3 defaults 1 2
LABEL=/boot /boot ext3 defaults 1 2
device to mount mount point file system type mount options dump fscheck.
Mount Options :
ro – read only, rw – read write, user – user can mount, exec – script can be execute, noexec – script can’t be execute, noauto – partition will not mount automatically, auto – mounts automatically, sync – input and output will synchronize.
Dumping and fsck
Dumping is an outdated option for backup for cases when system went down, 0 – stands for False and 1 – stands for true. Now a days we can leave this as 0.
fsck – This parameters is for file system check . The partitions will go for fsck based on the order given. The / partition should have value 1 and next partitions can take 2,3.. as well. 0 stands for no fsck.
* Explain about file system ?
File system is the hierarchy of directories that is used to organize files in computer.Each file system contains a control block ( which contains information about that file system ) and inodes ( Which contains information about each files and data blocks).
Metadata contains the information about the entire data (one or more pieces of data) , ie file name, owner,creation date, location etc. whereas inode is a type of metadata which contains the information about a regular file, directory, or other file system object such as permission, owner and group, file size, access and modification time, number of links etc . Linux never store the file creation time.
Superblock is a filesystem metadata which defines the file system type, size, status, and information about other metadata structures.The superblock is the very critiical to the file system and thus in each file system there may be multiple copies of superblock. Incase superblock become corrupt and at that point of time fsck will automatically select an alternate backup of the superblock and attempt to recover the filesystem. For the manual recovery of superblock, we can use dumpe2fs command to find out the backup and then fsck.
[root@node213 mnt]# dumpe2fs /dev/sda2 |grep -i superblock
dumpe2fs 1.39 (29-May-2006)
Primary superblock at 0, Group descriptors at 1-5
Backup superblock at 32768, Group descriptors at 32769-32773
Backup superblock at 98304, Group descriptors at 98305-98309
Backup superblock at 163840, Group descriptors at 163841-163845
Backup superblock at 229376, Group descriptors at 229377-229381
Backup superblock at 294912, Group descriptors at 294913-294917
superblocks are existing on the first sector of a filesystem. It contains the location of inode table.
* What is SGID and SUID
SUID (Set owner User ID up on execution) is a special type of file permissions given to a file. Normally in Linux/Unix when a program runs, it inherits access permissions from the logged in user. SUID is defined as giving temporary permissions to a user to run a program/file with the permissions of the file owner rather that the user who runs it. In simple words users will get file owner’s permissions as well as owner UID and GID when executing a file/program/command.
[root@server1 ~]# ls -ltr /usr/bin/passwd
-r-sr-sr-x. 1 root root 30768 Feb 17 2012 /usr/bin/passwd
The first s stands for SUID and second S stands for SGID.
SUID can be used in such situations,
To set SUID
[root@server1 ~]# chmod 4555 .
[root@server1 tmp]# ls -ltr
-r-sr-xr-x 1 root root 0 Mar 1 23:47
SGID permission is similar to the SUID permission, only difference is – when the script or command with SGID on is run, it runs as if it were a member of the same group in which the file is a member.
[root@server1 ~]# chmod 2555
* How we can check system performance?
a) CPU utilization – To check CPU performance use the following commands,
1) top – It display CPU usage, Memory usage, Swap Memory, Cache Size, Buffer Size, Process PID, User, Commands and much more
2) vmstat – To display statistics of virtual memory, kernerl threads, disks, system processes, I/O blocks, interrupts, CPU activity and much more.
3) lsof – To display list of all the open files and the processes. The open files included are disk files, network sockets, pipes, devices and processes.
4) tcpdump – A command-line network packet analyzer or packets sniffer program that is used capture or filter TCP/IP packets that received or transferred on a specific interface over a network.
5) netstat – A command line tool for monitoring incoming and outgoing network packets statistics as well as interface statistics.
6) iotop – monitor and display real time Disk I/O and processes. This tool is much useful for finding the exact process and high used disk read/writes of the processes.
7) iostat – This will collect and show system input and output storage device statistics.This tool is often used to trace storage device performance issues including devices, local disks, remote disks such as NFS.
8) iptraf – An open source console-based real time network (IP LAN) monitoring utility for Linux. It collects a variety of information such as IP traffic monitor that passes over the network, including TCP flag information, ICMP details, TCP/UDP traffic breakdowns, TCP connection packet and byne counts. It also gathers information of general and detaled interface statistics of TCP, UDP, IP, ICMP, non-IP, IP checksum errors, interface activity etc.
9) sar – Sar is part of the sysstat package. Using sar utility you can do two things: 1) Monitor system real time performance (CPU, Memory, I/O, etc) 2) Collect performance data in the background on an on-going basis and do analysis on the historical data to identify bottlenecks.
10) free – Free command displays information about the physical (RAM) and swap memory of your system.
b) RAM usage – free , cat /proc/meminfo, top, can be used to monitor memory usage.
c) HDD usage – iotop, iostat,
d) buggy Software – Check the software logs .
e) Network Checking
* What is Server hardening?
It is the process of enhancing server security through a variety of means which results in a much more secure server operating environment. Eg, System access level, fies or directories permission, unwanted services disabling, patch installtion etc..
* How to scan and mount newly added LUN in RHEL without reboot?
Once after a new LUN connected to a Linux box through HBA card, we can run the “rescan-scsi-bus.sh ” command which comes with sg3_utils rpm. Once we finished the script execution, we can able to see the new LUN as raw disk through fdisk utility.
[root@server1 ~]# which rescan-scsi-bus.sh
/usr/bin/rescan-scsi-bus.sh
[root@server1 ~]# rpm -qf /usr/bin/rescan-scsi-bus.sh
sg3_utils-1.28-4.el6.x86_64
* Explain system/ kernel level tuning with example?
The default UNIX kernel behavior is sub-optimal out of the box because it is difficult to anticipate what type of work or workload the operating system will be assigned. Therefore, UNIX products provide parameters that may change the allocation of critical resources.
Eg. File Handling Limit – The kernel has built-in limits on the number of files that a process can open.
[root@server1 ~]# cat /proc/sys/fs/file-max
66034
* What is the impact of inode fill in file system.
* What is multipathing in linux
* What is hotspare and hotswap ?
* Explain about Nagios monitoring tool ?
The NRPE ( Nagios Remote Plugin Executor ) agent will send all the alerts related CPU load, Swap, Memory usage, Online users, etc. to the nagios monitoring server through port 5666.
* Why xinetd daemon required ?
The xinetd stands for Extended Internet Services.The xinetd service listens on all ports used by the daemons it controls. When a connection is requested, xinetd determines if the client is allowed access. If the client is allowed access, xinetd starts up the desired service and allows the client to connect.
* What is the status code 403,404 represented in apache server?
Zombie often called process is a process state when the child dies before the parent process. In this case the structural information of the process is still in the process table
* Which daemon tracks the events on the linux server.
Soft Link
Hard Link
Inode
Inode will be different for both the files
Inode will be same for both the files
Deletion of original file
Deletion of original file, impact on link. Another file will not be accessible.
Deletion of original file, no impact on link. Another file will be accessible.
Time to execute
Access time is slow as compared to hard link
Access time is fast as compared to soft link
Cross File System
In Cross file system, Soft link works
In cross file system, hard link is not working. Needed same file system
The first one is the user name (root) . Second field stands the password, x indicates encrypted password in the /etc/shadow file. Third field is user id (UID), UID 0 is assigned for root user and 1 to 499 is using by other predefined accounts. Fourth field is the group id (GID) stored in /etc/group file. Fifth field is the user ID info location where we can add users such as users full name,phone number etc. . The sixth field is for user home directory . The last and seventh field provides the shell path assigned for the user.
* What is the importance of updating the kernel and package versions.
* What command we can use to find currently mounted drives
these question really helpfull in my placement
LikeLike