Thursday, 24 September 2015

Experienced Linux Interview Questions and Answers

16. Kill any user's all processes
killall -u username

17. What we have to do if we do required to rotate logs without moving and creating new log file
We can use "logrotate"'s "copytruncate" option which will simply copy original file and  truncate original file :)

18. What is the difference between cron and anacron
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

19.  Default Port numbers used by ssh,ftp,http,https,telnet,smtp,pop3,pop3s,imap,imaps
SSH 22, ftp 20/21, http 80, https 443, SMTP/SMPTS 25/465, POP3/POP3S 110/995, IMAP/IMAPS 143/993

20.  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)

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

More Questions & Answers:-
Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 Page9 
Page10 Page11

No comments:

Post a Comment