Deciding which services in inetd can be disabled

In securing Unix systems, one of the first items people generally recommend is to disable services in /etc/inetd.conf that are not needed. Unfortunately, it's often not clear which services are needed and which are not. The following tip can help with that.

The basic assumption here is that when your system is backed up the last access time of the binaries used by inetd get updated (along with all other files on the system). The last access time of a binary is also updated each time inetd opens that binary to provide a given service.

To take advantage of this, we first create a file somewhere that no one has a reason to open (e.g. /etc/flagfile). Now, let the machine sit for awhile (how long depends on your environment). Probably at least one full backup cycle.

Next run the attached code. This will list the last access time of all binaries used in /etc/inetd.conf -- you'll need to add a line to do the same "ls -lLu" on your flagfile.

Now, look over the output for services that show a last access time that's different from your flag file. Now you know that service is in use.

Of course, you need to repeat this process over a large enough period of time to get good data. Running it right before your backups begin will give you the best results.

Why people are using some of the services it finds is another exercise...

for i in `grep -v ^# /etc/inetd.conf | awk '{print $6}'`; do

    Requires Free Membership to View

if [ $i = "internal" ]; then
ls -lLu $i

# Change this to your own flag file
ls -lLu /etc/flagfile

This was first published in November 2001

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.