APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Inetd environment variables

© November 2004 Tony Lawrence

Someone asked me recently where inetd gets its environment from. I said I didn't know for sure, but (since there's no place I know of to set them anywhere) I would expect it would inherit from whatever starts it. The person asking was running a SCO system, so that would be /etc/tcp. Most Linuxes now run xinetd, which lets you specify "env" in its xinetd.conf, but even those values are just added to (or replace) whatever it picks up from its startup heritage.

Well, he tested it by adding to /etc/tcp and found that yes, it picks that up. It would have surprised me if it didn't, because the underlying exec (fork and exec) of a shell script is going to pass the environment, and it would be a strange program indeed that didn't read what it had been passed.

If you only wanted this for a specific program that inetd or xinetd runs, it might make more sense to wrap that program in a script that set whatever you wanted, thus avoiding suddenly changing the environment of every other network program. Don't forget to export anything set that way.

Later on, he reported this:

Clarification on inetd and its environment.
The environment that inetd inherits from /etc/tcp is not passed onward as I first thought. The actual environment seen by any process started by inetd comes from /etc/default/login, which is very limited in scope. About the only thing that would be of interest there would be the PATH statement, usually /bin:/usr/bin.

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> Inetd environment variables

Inexpensive and informative Apple related e-books:

Are Your Bits Flipped?

Photos: A Take Control Crash Course

Take Control of iCloud

Digital Sharing Crash Course

Take Control of IOS 11

More Articles by © Tony Lawrence

Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

A common and not necessarily apocryphal example portrays a solo practitioner starved for business in a small town. A second lawyer then arrives, and they both prosper. (Deborah L. Rhode)

Linux posts

Troubleshooting posts

This post tagged:




Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode