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
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
Got something to add? Send me email.
Increase ad revenue 50-250% with Ezoic
More Articles by Tony Lawrence
Find me on Google+
© 2009-11-07 Tony Lawrence