Poll: Your Favorite Scripting Language?

Posted on in Categories Ask nixCraft, C Programming, Linux, Perl, php, Poll, programming, python, Shell scripting, Sys admin, UNIX last updated March 17, 2009

Like most sys admin, I’m lazy. I try to automate almost all things in order to save time. Inexperienced sys admin and help desk staff working under me finds all these tools useful. It saves their time and avoids security issues. Automation allows help desk staff to do things that they don’t have enough direct system knowledge to do themselves. However, selecting correct tool and applying correct methodology is very important.

Note: There is a poll embedded within this post, please visit the site to participate in this post’s poll.

What Do You Use to Debug Linux / UNIX C/C++ Programs?

Posted on in Categories Ask nixCraft, GNU/Open source, Linux, programming, UNIX last updated February 24, 2009

The purpose of a debugger is to allow you to see what is going on inside another program while it executes. It is useful to find out what another program was doing at the moment it crashed. I know most people will recommend GNU gdb, Nemiver, Valgrind or IDE such as Eclipse. I use gdb when it is really required; otherwise I debug the old fashioned way using printf() or cout statements.

Why Did You Switch From IE ( Internet Explorer ) ?

Posted on in Categories Ask nixCraft, Linux, Linux desktop, UNIX, Windows, Windows server, windows vista last updated February 11, 2009

I was going though my server logs / Google Analytics settings and found that over 60% users are on MS-Windows. However, each and every month visitors are switching to Firefox or Google browser and so on. So I would like to know your reasons for making switch from IE to another browser. Why did you switch and which browser did you switch to?

UNIX / Linux Professional Salary Potential Ranges

Posted on in Categories Ask nixCraft, Sys admin last updated February 8, 2008

From my mail bag:

I’m seriously considering getting trained myself with a UNIX / Linux education. Can you give me some general idea about salaries for computer professionals with diploma or degree education?

Salaries depends upon many factors such as:
=> Your country / location
=> Your credentials
=> Your level of experience
=> Your education level
=> Employer size
=> Industry
=> Job title etc

The best way to find information is just contact to your local recurring agency. Another old good option is LUG members. If you are located in U.S see Bureau of Labor Statistics website. After a quick search, I found following data (again valid for USA):

a] Tech support staff – US $50-55k p.a.
b] UNIX Sys / Net Admin – US $75-90k p.a.
c] UNIX Systems Manager – US $120k+ p.a.

There is no such data exists for India and salaries vary depending on diffrent factors. Please note that:

More Experience + Additional skillset   ==  More money

See also:

=> Salary Survey Report for Job: UNIX System Administrator

=> Another Salary Survey Report for Job: Linux System Administrator (City and State search supported)

Feel free to share your experience in the comments.

Linux Identifying ~ Which NIC Is Which – Which NIC is eth0?

Posted on in Categories Ask nixCraft, Hardware, Howto, Linux, Networking last updated January 17, 2008

From my mailbag the other day I received an interesting question about network interface:

I’ve 4 network card installed in my server and I need to find out which NIC is which? How do I tell which physical card is eth0 and which one is eth1 and so on using command line options? If my server is 5000 miles away, how do I tell which NIC is eth0 w/o interrupting network traffic?

I’ve got some thoughts on this myself such as:
[a] use ping command – Easy to use

[b] udev persistent-net rules – See /etc/udev/rules.d/*persistent-net.rules

[c] ethtool -p eth0 5 – It will initiates adapter-specific action intended to enable an operator to easily identify the adapter by sight. Typically this involves blinking one or more LEDs on the specific ethernet port. But, it will not work with all drivers

Anyway, I thought that it would be interesting to throw this to you the reader to comment on.

Does Ubuntu Linux kill / shorten hard disk life?

Posted on in Categories Ask nixCraft, File system, Hardware, Linux, Linux laptop, Ubuntu Linux last updated November 18, 2007

I got lots of emails asking about Ubuntu Linux and hard disk issue. Does it really shorten hard disk life?

Noop.

Unfortunately, some news and blogs reported news wrongly. Ubuntu doesn’t touch your hard drive power management settings by default. In almost all cases, it’s more likely to be your BIOS or the firmware on your hard drive (source).

Check out this official bug report for more information. On a related note, always consider backing up hard disk / data on regular basis.

Is Linux server more secure than Windows server?

Posted on in Categories Ask nixCraft, Linux, Windows last updated October 9, 2007

Many new Linux user / admin asks:

Is Linux more secure than Windows?

That depends. 😉 Let me explain:

Fan boys on both sides argue to the death that their religion operating system is the best and safest to use.

Windows is harder to secure than Linux. It is the simple truth. Many IT professionals including RHCEs and MCSEs believe that Linux is more secure than Windows. However you cannot blindly accept Linux is more secure than Windows. On both operating systems you need to:
a) Restrict user access
b) Restrict service access
c) Restrict network access
d) Create backup / restore policy
e) Install and manage app level security
f) Continuously install, configure, and patch the system etc

As you see both Windows and Linux administrators requires same levels of skills. Linux is secure by design i.e. Linux is inherently more secure than Windows. Linux designed as a multi-use, network operating system from day one. For example IE / FF bug can take down entire windows computer. However, if there were the same bug in FF it won’t take down entire Linux computer. Under windows almost any app level bug (read as vulnerability) can be used to take down the entire system and turn into a zombie computer.

In short,

  1. No operating system is secure
  2. Both Linux / Windows admin requires same level of skills
  3. By default Linux is more secure than Windows, but it is also open to attack.
  4. You can just make attackers job hard.
  5. Remember, security is an on going process and nothing is secure once connected to network, period.

This is based upon my own experience. I don’t have a good answer here. What do you think? Do you run Windows and Linux? Please add your experience in the comments.

Why my Linux server ext3 filesystem go read-only?

Posted on in Categories Ask nixCraft, CentOS, File system, Linux, RedHat/Fedora Linux, Sys admin, Tips, Troubleshooting, Ubuntu Linux last updated August 28, 2007

From my mailbag:

We have 5 Dell server collocated running CentOS 4.x and 5.x server operating system. Sometime my file system (ext3) goes read-only. I’d like to know what could be causing such a problem?

My guess:
a) Hardware problem / hard disk problem, check harddisk for errors.

b) High disk I/O aka busy I/O retry error can mark low level disk call as failed. This will force ext3 to go into read only mode.

c) High disk I/O on SAN

d) SAN is not configured properly for the path failover.

In all sort of problems ext3 goes read-only to protect the filesystem and further damage. If you are using VMWARE, check out official webpage to download SCSI patches or workaround for vmware problems.

So what could be causing the file system on Linux go read-only?

Apart from above generic problem, any other error can trigger filesystem on Linux go read only. I hope our reader / seasoned Linux admin can help to answer this question. Please share the experiences and advice in the comments.

Download: Linux distribution for PPC / PowerPC architecture

Posted on in Categories Ask nixCraft, Debian Linux, Download of the day, Gentoo Linux, GNU/Open source, Linux desktop, Linux distribution, RedHat/Fedora Linux, Ubuntu Linux last updated August 27, 2007

Camira asks:

Where can I find the Linux distribution for the ppc architecture?

I guess the best distro for the PowerPC based PC is Yellow Dog Linux (YDL). Just like other distro it is a free software and open-source Linux distribution for Power Architecture hardware. It is based on Fedora Linux. According to wikipedia:

PowerPC is a RISC microprocessor architecture created by the 1991 Apple–IBM–Motorola alliance, known as AIM. Originally intended for personal computers, PowerPC CPUs have since become popular embedded and high-performance processors as well. PowerPC was the cornerstone of AIM’s PReP and Common Hardware Reference Platform initiatives in the 1990s, but the architecture found the most success in the personal computer market in Apple’s Macintosh lines from 1994 to 2006 (before Apple’s transition to Intel).

PowerPC based system includes Sony PlayStation PS3, IBM Power and pSeries, Mercury Cell, Apple Macintosh G3, G4 & G5 computers, including iBooks, PowerBooks and Apple PowerPC etc.

Download PowerPC Linux distributions

Please note that you can also try out FreeBSD, OpenBSD and NetBSD for the PPC architecture based system.

Lighttpd block wget useragent for specific urls

Posted on in Categories Ask nixCraft, lighttpd, Linux, Security, Tips, Tuning, UNIX last updated August 12, 2007

One of regular reader asks a question:

My website powered by Lighttpd web server. I’d like to block Wget useragent for entire my domain.com site except for /downloads/ url section. How do I configure lighttpd?

You need to use $HTTP filed useragent and url combination. Just open your lighttpd.conf file and append code as follows.

Lighttpd block useragent wget configuration

# vi /etc/lighttpd/lighttpd.conf
Append config directive as follows:

$HTTP["useragent"] =~ "Wget" {
        $HTTP["url"] !~ "^/download($|/)" {
                url.access-deny = ( "" )
        }
  }

Where,

  • $HTTP[“useragent”] : Match on useragent i.e. Wget
  • $HTTP[“url”] : Match on url section such as /download/*. If there are nested blocks, this must be the most inner block.
  • =~ : Perl style regular expression match
  • !~ : Perl style regular expression not match

Just restart the webserver, enter:
# /etc/init.d/lighttpd restart

Now user can run wget on http://domain.com/download/* urls but not on http://domain.com/file.html or http://domain.com/dir/file