Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. DISCLAIMER: Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility. If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.

Monday 25 September 2017

Linux Interview Question & Answer part-3


21) How to setup never expired user password

Ans chage -E never username

22) Restricting insertion into file if full permission are assigned to all

Ans chattr +i filename

23) Display or Kill all processes which are accessing any folder/file

Ans Display User who are using file/folder : fuser -u file/folder
Kill All Processes which are using file/folder: fuser -k file/folder

24) Kill any user's all processes

Ans killall -u username

25) How can we have system analysis and reports over mail

Ans Use logwatch

26) What we have to do if we do required to rotate logs without moving and creating new log file

Ans We can use "logrotate"'s "copytruncate" option which will simply copy original file and 
truncate original file :)

27) Command to collect detailed information about the hardware and setup of your system

Ans dmidecode , sysreport

28) Command to check PCI devices vendor or version

Ans lspci

29) What is the difference between cron and anacron

Ans  Cron :
                     1) Minimum granularity is minute (i.e Jobs can be scheduled to be executed
                         every minute)
                     2) Cron job can be scheduled by any normal user ( if not restricted by super
                          user )
                     3) Cron expects system to be running 24 x 7. If a job is scheduled, and
                         system is down during that time, job is not executed
                     4) Ideal for servers
                     5) Use cron when a job has to be executed at a particular hour and minute

      Anacron :
                     1) Minimum granularity is only in days
                     2) Anacron can be used only by super user ( but there are workarounds to
                         make it usable by normal user )
                     3) Anacron doesn’t expect system to be running 24 x 7. If a job is scheduled,
                         and system is down during that time, it start the jobs when the system
                         comes back up.
                     4) Ideal for desktops and laptops
                     5) Use anacron when a job has to be executed irrespective of hour and
                          minute

30)  Default Port numbers used by ssh,ftp,http,https,telnet,smtp,pop3,pop3s,imap,imaps

Ans SSH 22, ftp 20/21, http 80, https 443, SMTP/SMPTS 25/465, POP3/POP3S 110/995, IMAP/IMAPS 143/993

31)  How to setup ACLs in following case:
         1) Create a file FILE1 and this should be read,write,executable for all user but Read only  for user USER1
        2) Copy FILE1 ACLs to FILE2 ACL
        3) Delete a USER1's rule for FILE1 which were setup in step 1)

Ans 1) touch FILE1 ; chmod 777 FILE1 ; setfacl -m u:USER1:r FILE1
        2) getfacl FILE1 | setfacl --set-file=- FILE2
        3) setfacl -x u:USER1 FILE1

32)  How to make USB bootable?

Ans Write efidisk.img from RHEL 6 DVD images/ subdirectory to USB

dd if=efidisk.img of=/dev/usb (usb device name)

33)  How can we check disk/device status/failure/errors using smartctl utility?

Ans Try following to check:

        Enable/Disable SMART on device/disk : smartctl -s on /dev/sda
        Check device SMART health : smartctl -H /dev/sda
        Check device SMART capabilities : smartctl -c /dev/sda
        Enable/Disable automatic offline testing on device : smartctl -o on/off /dev/sda
        Show device SMART vendor-specific Attributes and values : smartctl -A /dev/sda
        Show device log [TYPE : error, selftest, selective, directory,background, 
                                     scttemp[sts,hist]] : smartctl -l TYPE /dev/sda
        Run test on device [TEST: offline short long conveyance select,M-N pending,N 
                                     afterselect,[on|off] scttempint,N[,p] : smartctl -t /dev/sda

34)  What is the difference between ext2 vs ext3 vs ext4?

Ans - dear friends read our next blog to get diffrences.

35)  Disable ping to avoid network/ICMP flood

Ans Set following in /etc/sysctl.conf : net.ipv4.icmp_echo_ignore_all = 1

      Then "sysctl -p"
  
      or 
   
   echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all

36)  What is SYN Flood, ICMP Flood

Ans SYN Flood : A SYN flood occurs when a host sends a flood of TCP/SYN packets, often with a 
          fake/forged sender address. Each of these packets is handled like a connection request, causing the 
          server to spawn a half-open connection, by sending back a TCP/SYN-ACK packet(Acknowledge), and 
          waiting for a packet in response from the sender address(response to the ACK Packet). However, 
          because the sender address is forged, the response never comes. These half-open connections 
          saturate the number of available connections the server is able to make, keeping it from responding to 
          legitimate requests until after the attack ends

      ICMP Flood : There are three types of ICMP Flood :
    
       1) Smurf Attack : http://en.wikipedia.org/wiki/Smurf_attack
       2) Ping Flood :  http://en.wikipedia.org/wiki/Ping_flood
       3) Ping of Death : http://en.wikipedia.org/wiki/Ping_of_death

37)  What is the difference between Unix vs Linux Kernels?

Ans- wait for new update blog.

38) How to setup Password less remote login/ssh?

Ans Use "ssh-keygen -t dsa or rsa" at local system for creating public and private keys

        Then copy /root/.ssh/id_dsa.pub to remote_server by name /root/.ssh/authorized_keys
        Change permissions of /root/.ssh/authorized_keys file at remote_server "chmod 0600 ~/.ssh/authorized_keys"

        Now try to login from local system to remote_server "ssh root@remote_server"

39) Command to see default kernel image file

Ans "grubby --default-kernel"

40) How to create lvm mirror

Ans lvcreate -L 50G -m1 -n LVMmirror vg0

No comments:

Post a Comment