Inetd environment variables

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

Increase ad revenue 50-250% with Ezoic

More Articles by

Find me on Google+

© Tony Lawrence

Kerio Samepage

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

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

It all sounds good from the pulpit,but come Monday morning all the sinners are back to business as usual writing crappy code. (Tony Lawrence)

Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it? (Brian Kernighan)

This post tagged: