≡ Menu

unix admin

My 10 UNIX Command Line Mistakes

Anyone who has never made a mistake has never tried anything new. -- Albert Einstein.

Here are a few mistakes that I made while working at UNIX prompt. Some mistakes caused me a good amount of downtime. Most of these mistakes are from my early days as a UNIX admin.
[click to continue…]

It happens all the time. Sooner or later, every organization may run out of qualified UNIX system administrator / staff because of various issues. As a single admin you may have to do lots of work because other people in accouting, sales, or programmers may not have all the skills required to run servers. Also, I don't trust new people or people with Windows background. I also don't have a time for UNIX admin training for new person.

In short, to avoid overloading yourself, I recommend sudo. It allows you to delegate authority to give certain users or groups of users the ability to run some commands as root or another user while providing an audit trail of the commands and their arguments via a log file. With sudo you don't have to share root password with anybody. Another option is Pluggable Authentication Modules (PAM) under UNIX / Linux. Command tasks such can be delegated via sudo program:

  1. Start / stop / restart common services and configurations, e.g. Jboss, Tomcat, Apache, Mysql etc
  2. Shutdown / reboot server
  3. Backup data to tape
  4. Run other individuate tasks and commands as per requirements and so on.

Once you started to trust their skills sets, grant them more privileges or may be promote them as full time UNIX sys admins.

In totally unrelated news : Bill Gates, retired as chairman. Checkout the hits and misses of his leadership of Microsoft.

How do you disconnect inactive user sessions?

One of our regular reader hall sends an interesting question:

I work for a small company and most user login to centralized Linux server. I’d like to
automatically log out all inactive users from server for various reasons. How do I disconnect inactive user sessions?

To be frank, I don’t have any clear cut answer to question. There are at least 4-5 shells installed on a typical Linux installation. Also most user have has control over their own environment and user can switch to a different shell.

I hope our reader or seasoned UNIX admin can help to answer this question. Please share the experiences and advice in the comments.

Update: Checkout answer below in comments!

HP-UX Booting from a system recovery Tape

Recently one of our HP-UX servers went down and it needed recovery. Since I’m new to HP UX one of our senior UNIX admin pointed me that they have a system recovery tape. After going through our internal docs and other resources, I was able to recover system :)

Here is what I did...

First I had put recovery tape into the tape driver

As soon as system started (auto boot) I had to interrupt the autoboot sequence (press ESC key) and load tape into driver
Next I had type 'search ipl' command so that it will search for my recovery tape driver
> search ipl

It will give output of different devices such as Random access media, look for Sequential Access Media (and its path number or hw path).
Here is what I typed to boot from tape (in my system

> boot 8/16/5.0
> boot p2

Replace 8/16/5.0 or p2 with your actual tape drive h/w path. Once booting started, it will automatically restore it.

It took almost an hour to recover but it did the job. This tape made my system bootable. Next task was to restore all data from full and incremental backup and install needed additional software. I had typed following command on HP-UX box to restore all files and directory:

# frecover –f /dev/rmt/0m –rv

This emergency came around 5pm evening last Friday. I was just closing for that day and I was about to go home. I had spent 4 hours to restore box and other stuff.

Well good news it that my diwali holidays starts from coming Friday and it will lasted until November 7, 2005 :). I really need a break guys :D.