10 key skills for "lazy" Linux Administrators

Source: Internet
Author: User

After learning these 10 skills, you will become the world's most powerful Linux®System Administrators are a bit exaggerated throughout the world, but these skills are necessary to work in a large team. Learn about SHH channels, VNC, password recovery, console reconnaissance, and so on. Examples are attached to each technique. You can copy these examples to your system.

Good system administrators are differentiated in terms of efficiency. If an efficient system administrator can complete a task that takes two hours for another person to complete within 10 minutes, he should be rewarded (get more rewards ), because he saves time for the company, and time is money, isn't it?

The skill is to improve management efficiency. Although this article does not intendAllSkills for discussion, but I will introduce the 10 basic magic weapons used by "lazy" administrators. These skills can save time-at least more time to play, even if you don't get more rewards for efficiency.

Tip 1: unmount the unresponsive DVD drive

Experience for new users: When you press the Eject button on the server (running the Redmond-based operating system) DVD drive, it will pop up immediately. He then complained that in most Enterprise Linux servers, if a process is run in that directory, the pop-up will not happen. As a long-term Linux administrator, I will restart the machine. If I don't know what is running and why the DVD drive is not released, I will pop up the disk. However, this is very inefficient.

The following describes how to find the process of keeping the DVD drive and easily pop up the DVD drive: First simulate it. Put the disk in the DVD drive, open a terminal, and load the DVD drive:

# mount /media/cdrom
# cd /media/cdrom
# while [ 1 ]; do echo "All your drives are belong to us!"; sleep 30; done

Now open the second terminal and try to bring up the DVD drive:

# eject

The following message is displayed:

umount: /media/cdrom: device is busy

Before releasing the device, let's find out who is using it.

# fuser /media/cdrom

The process is running and the disk cannot be popped up. This is actually our error.

Now, if you are the root user, you can terminate the process at will:

# fuser -k /media/cdrom

Now you can unmount the drive:

# eject

fuserNormal.

 

Tip 2: Restore the problematic Screen

Perform the following operations:

# cat /bin/cat

Note! Terminal is just like spam. All input content is messy. So what should we do?

Inputreset. However, enterresetAnd inputrebootOrshutdownToo close. It's so chilling-especially on production machines.

Don't worry, the machine will not restart during this operation. Continue operation:

# reset

Now the screen is back to normal. This is much better than logging in again after the window is closed, especially when you have to go through five machines and SSH to reach this machine.

 

Tip 3: screen collaboration

David, a senior maintenance user from the product project, called and said, "Why cannot I compile supercode. c on the new machines you deploy ".

You will ask him: "What machine are you running ?"

David replied: "Posh ". (This virtual enough company named its five production servers in the way Spice Girls was used ). Now you can show your skills. Another machine is operated by David:

# su - david

To posh:

# ssh posh

Run the following code:

# screen -S foo

Then call David:

"David, run the command on the terminal# screen -x foo".

This allows you and David to link sessions in Linux shell. You can enter, but you can see what the other party is doing. This avoids other layers, and both parties have the same control. The advantage of doing so is that David can observe your fault diagnosis skills and understand how to solve the problem accurately.

Finally, we can see the problem: David's compilation script hardcoded an old directory not on this new server. Load it and compile it again to solve the problem, and then David continues to work. You can continue your previous entertainment activities.

Note that both parties must log on to the same user.screenThe command can also implement multiple windows and split screens. Read the manual page for more information.

ForscreenSession. I also have the last technique. To separate and enable it, enterCtrl-A D (That is, press and holdCtrlKey and clickAKey. Then pressDKey ).

Then runscreen -x fooCommand can be respliced.

 

Tip 4: retrieve the root password

If you forget the root password, you must reinstall the entire machine. Even worse, many people will do this. However, it is very easy to start the machine and change the password. This is not applicable in all cases (for example, if you set a GRUB Password, but forget it). But here is an example of Cent OS Linux, which describes the general operations.

First, restart the system. The GRUB screen shown in 1 is displayed when the instance is restarted. Move the arrow keys to keep them on this screen instead of starting properly.


Figure 1. GRUB screen after restart

Then, use the arrow keys to select the kernel to be started and enterEEdit the kernel line. Then you can see the screen shown in 2:


Figure 2: Prepare to edit the kernel line

Use the arrow keys again to highlightkernelStart row, pressEEdit kernel parameters. When the Screen 3 is reached, append the number 1 after the parameters shown in Figure 3:


Figure 3. append the number 1 after the Parameter

Then pressEnterAndBThe kernel is started to single-user mode. Then runpasswdCommand to change the user root password:

sh-3.00# passwd
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully

Now you can restart the instance. The machine will start with a new password.

 

Tip 5: SSH Backdoor

Many times, my website needs someone's remote support, but he is blocked by the company's fire prevention. Few people realize that, if they can reach the outside through the firewall, they can easily bring in external information.

From the original intention, this is called "hitting a hole in the firewall ". I call itSSH Backdoor. To use it, you must have a machine that is used as an intermediary to connect to the Internet.

In this example, the machine is called blackbox.example.com. The machine behind the company's firewall is called ginger. The machines supported by this technology are called te

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.