Question 1: What is puppet server?
Answer: Puppet is a configuration management system that allows you to define the state of your IT infrastructure, then automatically enforces the correct state. Whether you're managing just a few servers or thousands of physical and virtual machines, Puppet automates tasks that sysadmins often do manually, freeing up time and mental space so sysadmins can work on the projects that deliver greater business value.
Whether you're deploying vendor-supplied applications or working with a team of internal software developers, Puppet automates every step of the software delivery process: from provisioning of physical and virtual machines to orchestration and reporting; from early-stage code development through testing, production release and updates. Puppet ensures consistency, reliability and stability. It also facilitates closer collaboration between sysadmins and developers, enabling more efficient delivery of cleaner, better-designed code.
Question 2: What is .bashrc file?
Answer: .bashrc is a shell script that Bash runs whenever it is started interactively. You can put any command in that file that you could type at the command prompt. You put commands here to set up the shell for use in your particular environment, or to customize things to your preferences.
Question 3: What is the different between rpm and yum?
Answer: The Red Hat Package Manager or RPM is the default package manager for Linux distributions that use packages with the same name. Initially developed by Red Hat, it eventually found widespread acceptance in a lot of Linux distributions. YUM stands for Yellowdog Updater Modified and is a front end for Linux distributions that utilize the RPM package format. Both of these are only usable with RPM based distros and are not usable with those that use debian packages like Ubuntu.
Although RPM is a very robust tool that a lot of users are already familiar with, there are still some minor flaws that are an annoyance to users. The most prominent problem is a state commonly referred to by most people as ‘dependency hell’. This problem occurs with packages that depend on a lot of other packages, some of those packages also depend on a lot of other packages. It is common knowledge that you must install all dependencies for the program to work correctly. RPM is unable to automatically do this for you. It can only check whether all the required packages are installed prior to installing the needed package. Manually tracking and installing each dependency is a major chore for most people who only want to install a single package initially.
YUM is capable of tracking the dependencies of a package and installing them prior to installing the package that the user wanted to install. This simplifies the whole process as you need only know the name of the package that you want to install and not worry whether the required packages have been installed or not. Packages that can’t be found on the system are searched for in the repositories that are available to the system.
Although both RPM and YUM are what really installs the packages, you would probably not be using either of those unless you are proficient with command lines and the various parameters that need to be passed. To make it easier for ordinary people to quickly grasp total control of their system, there are various graphical user interfaces or GUIs that can be used on top of either YUM or RPM. These GUIs are what people commonly see and interact with and not YUM or RPM.
Summary:
1. RPM is a package manager while YUM is a frontend that can be used with RPM.
2. The RPM package manager is unable to track dependencies while YUM can.
Question 4: What is different between telnet and SSH?
Answer: Telnet vs SSH
Secure Shell, commonly known as SSH, and Telnet are two network protocols that have been used widely at one point in time or another. They are both used to connect to remote servers in order to facilitate some sort of communications. The primary difference, which also led to one superseding the other, is in security. SSH offers security mechanisms that protect the users against anyone with malicious intent while Telnet has no security measures whatsoever.
Telnet was designed to work within a private network and not across a public network where threats can appear. Because of this, all the data is transmitted in plain text, including passwords. This is a major security issue and the developers of SSH used encryptions to make it harder for other people to sniff the password and other relevant information. Telnet also omits another safety measure called authentication. This ensures that the source of the data is still the same device and not another computer. Without authentication, another person can intercept the communication and do what he wishes. This is also addressed in SSH as it uses a public key to authenticate the source of the data.
Due to the security measures that were necessary for SSH to be used in public networks, each packet contains less data to make room for the data of the security mechanisms. In order to transmit the same amount of data, you would need to take-up a lot more bandwidth. This is called overhead and was such a major issue back when internet speeds were very low because it translates to a performance hit.
The security issues of Telnet forced a lot of people to use SSH in order to protect themselves. It didn’t take a long time before SSH replaced Telnet in a great majority of its uses. Telnet did not fade away though as it is still used in some areas, mostly in testing and debugging. Telnet extensions were developed to provide security but they are not used in most Telnet implementations.
Summary:
1. SSH and Telnet commonly serves the same purpose
2. SSH is more secure compared to Telnet
3. SSH encrypts the data while Telnet sends data in plain text
4. SSH uses a public key for authentication while Telnet does not use any authentication
5. SSH adds a bit more overhead to the bandwidth compared to Telnet
6. Telnet has been all but replaced by SSH in almost all uses
Question 5: How can restrict SSH access for a particular user?
Answer: Restricting which users can log in
Open the configuration file vi /etc/ssh/sshd_config
The syntax is:
DenyUsers user1 user2 user3
Use DenyUsers to block user login. You can use wild cards as well as user1@porulagam.com (user1 is not allowed to login from porulagam.com host) pattern.
DenyGroups group1 group2
A list of group names, if user is part of primary of supplementary group login access is denied. You can use wildcards. Please note that you cannot use a numeric group or username ID. If these directives are not used, default is to allow everyone.
PermitRootLogin no
Allowing selected users or group explicitly to log in
The syntax is:
AllowUsers user1 user2
This directive is opposite of DenyUsers directive i.e. user1 and user2 are only allowed to log in into the server.
AllowGroups group1 group2
This directive is opposite of DenyGroups directive i.e. members of group1 and group2 users are only allowed to log in into the server.
Question 6: How to check the running ports?
Answer: # netstat -tulpn
Question 7. How will you restrict ip in FTP server?
Answer: while it is possible to do what you want, only making the public server available out of office hours, this is not the ideal solution. It is reasonable to assume that those abusing your server are not always putting legal material there, which could lead to legal action against you or losing your Internet connection. Remember, this is your server and you are responsible for the content available from it. Providing anonymous upload and download capability is asking for trouble. If you must do this, keep the upload area separate from the downloads, so people cannot download material that has been anonymously uploaded, it has to be moved over by someone with a login account. A better solution is to disable anonymous uploads altogether and provide your clients with their own FTP accounts. If you really want to continue offering unrestricted anonymous access out of office hours, you can use the hosts.allow and hosts.deny files in /etc. You enable this by putting
tcp_wrappers=YES
in /etc/vsftpd.conf. Then ensure your local network has access - add this line to /etc/hosts.allow
vsftpd: 192.168.1.
Note the trailing "." on the address to match the whole subnet, change the address to match your network. Now put these two lines into /etc/ cron.d/vsftpd
0 18 * * 1-5 root sed -i '/^vsftpd/d'
/etc/hosts.deny
0 8 * * 1-5 root echo "vsftpd:
ALL" >>/etc/hosts.deny
and force cron to reload with
killall -HUP cron
This will deny modify hosts.deny to deny all addresses, except those specified in hosts.allow, between 0800 and 1800 Monday to Friday and clear the block at other times.
Question 8: What are daemons?
Answer: A daemon is a type of program on Unix-like operating systems that runs unobtrusively in the background, rather than under the direct control of a user, waiting to be activated by the occurrence of a specific event or condition.
Question 9: What is the default port number of HTTP?
Answer: By default, HTTP uses port 80 and HTTPS uses port 443 but a URL like http://www.example.com:8080/path/ specifies that the web resource be served by the HTTP server on port 8080.
Question 10: How will you change the default port no of HTTP?
Answer:
1. Assume that your new port number is 78
2. cp /etc/httpd/ports.conf /etc/httpd/ports.conf_backupgedit /etc/httpd/ports.conf
3. Find this line- Listen 80
4. Replace with the following line – Listen 78
5. Save the edited file
6. /etc/init.d/httpd restartApache HTTP server, Linux
Question 11: How can I run the particular script file when the user log in?
Answer: You should setup a .bashrc & .bash_profile for your user account
Question 12: Network is not working, What are the trouble shooting?
Answer: Refer the link, which explains the various commands on this question.
http://www.tecmint.com/linux-network-configuration-and-troubleshooting-commands/
http://www.tecmint.com/linux-network-configuration-and-troubleshooting-commands/
Question 13: What is the different between soft links and hard links?
Answer: A symbolic link is a link to another name in the file system. Once a hard link has been made the link is to the inode. deleting renaming or moving the original file will not affect the hard link as it links to the underlying inode. Any changes to the data on the inode is reflected in all files that refer to that inode.
Question 14: What is cron in Linux?
Answer: Crontab is the short form of Chronological Table. Cron is a daemon that executes scheduled commands. Cron is started automatically from /etc/init.d on entering multi-user runlevels. Cron searches its spool area (/var/spool/cron/crontabs) for crontab files (which are named after accounts in /etc/passwd); crontabs found are loaded into memory.
Six fields of crontab in Linux
A number (or list of numbers, or range of numbers), m, representing the minute of the hour;
A number (or list of numbers, or range of numbers), h, representing the hour of the day;
A number (or list of numbers, or range of numbers), dom, representing the day of the month;
A number (or list, or range), or name (or list of names), mon, representing the month of the year;
A number (or list, or range), or name (or list of names), dow, representing the day of the week; and
command, which is the command to be run, exactly as it would appear on the command line.
Six fields of crontab in Linux
A number (or list of numbers, or range of numbers), m, representing the minute of the hour;
A number (or list of numbers, or range of numbers), h, representing the hour of the day;
A number (or list of numbers, or range of numbers), dom, representing the day of the month;
A number (or list, or range), or name (or list of names), mon, representing the month of the year;
A number (or list, or range), or name (or list of names), dow, representing the day of the week; and
command, which is the command to be run, exactly as it would appear on the command line.
Question 15: How would you reset the root password?
Answer:
This method of reseting/recovering of lost Linux root password should work on most of linux distributions. ...
Edit Grub boot menu options. First you need to get into grub menu options. ...
Remount / and /proc. ...
reset / recover forgotten linux root password. ...
Reboot.
This method of reseting/recovering of lost Linux root password should work on most of linux distributions. ...
Edit Grub boot menu options. First you need to get into grub menu options. ...
Remount / and /proc. ...
reset / recover forgotten linux root password. ...
Reboot.
Question 16: Web server is running in the server. What are the troubleshooting, if it is not accessible from the client?
Answer: Check the configuration file /etc/httpd/conf/httpd.conf
Check the default configuration settings
Reset the service
Check the enableness of the port number in the firewall.
Check the SE linux as well
Check the default configuration settings
Reset the service
Check the enableness of the port number in the firewall.
Check the SE linux as well
Question 17: What is the different between locate and slocate commands?
Answer:
locate command is used for finding the output in all locations. But the updatedb command has to be given earlier.
slocate command enables system users to search entire file systems without displaying unauthorized files.
slocate command enables system users to search entire file systems without displaying unauthorized files.
Question 18: I want to search a word Linux in all the text file in the current directory. How can I do it?
Answer:
grep "text string to search” directory-path
OR
grep [option] "text string to search” directory-path
OR
grep -r "text string to search” directory-path
OR
grep -r -H "text string to search” directory-path
OR
egrep -R "word-1|word-2” directory-path
OR
egrep -w -R "word-1|word-2” directory-path
OR
grep [option] "text string to search” directory-path
OR
grep -r "text string to search” directory-path
OR
grep -r -H "text string to search” directory-path
OR
egrep -R "word-1|word-2” directory-path
OR
egrep -w -R "word-1|word-2” directory-path
Question 19: How to send a mail with out a mail client using command line?
Answer:
Mail without attachment
mail -s "Test Subject" user@example.com < /dev/null
Mail with attachment
mail -a /opt/backup.sql -s "Backup File" user@example.com < /dev/null
Mail without attachment
mail -s "Test Subject" user@example.com < /dev/null
Mail with attachment
mail -a /opt/backup.sql -s "Backup File" user@example.com < /dev/null
Question 20: How will you find all the files which are accessed last 30 days?
Answer: Use these options with find command
-mtime +60 means you are looking for a file modified 60 days ago.
-mtime -60 means less than 60 days.
-mtime 60 If you skip + or - it means exactly 60 days.
-mtime +60 means you are looking for a file modified 60 days ago.
-mtime -60 means less than 60 days.
-mtime 60 If you skip + or - it means exactly 60 days.
Question 21: How can I filter only first two columns?
Answer: awk '/^UUID/ {print $1;}' /etc/fstab
Question 22: How will take the backup of mysql database?
Answer: mysqldump -u root -p --all-databases > alldb_backup.sql
Question 23: Basic command to view the content of the table in mysql?
Answer:
create table tablename;
select * from table;
select * from table where (condition);
select * from table;
select * from table where (condition);
Question 24: How to run java program in Linux?
Answer: javac filename.java (for java program compilation)
java classname (for running java program)
java classname (for running java program)
Question 25: What is make command in Linux?
Answer: make is a utility for building and maintaining groups of programs (and other types of files) from source code.
2 Comments:
Greetings Mate,
Jeez oh man, while I applaud for your writing , it’s just so damn straight to the point Linux interview questions.
I have a net book Samsung N150plus,and sometimes I'm having problems with google that crashes and close, even is a bit slow as I'm going to a 2gb ram also, I had re installed it several times but someone told me to install a Linux software on my net book,
can i?are there any disadvantages?
Please keep providing such valuable information.
Obrigado,
Abhiram
Nice blog. Very informative. Thanks for sharing. Keep updating.
Nice and good article.It will helpful for interview perspective.I have suggested to my friends to go through this blog. Thanks for sharing this useful information. If you want to learn Linux course in online, please visit below site.
Linux Online Training
linux online course
Linux Online Training in Hyderabad
Linux Online Training in Bangalore
Linux Online Training in Chennai
Post a Comment