I am using the following in openssh/telnet code, which sets the user environment.
setenv("TEST_ENV", "testing", 1);
But this can be modified by the user, is there anyway to make it readonly env variable?
|
I am using the following in openssh/telnet code, which sets the user environment.
But this can be modified by the user, is there anyway to make it readonly env variable? |
||||
| show 3 more comments |
|
There's nothing in the conventional process environment to make a variable read only, only shells have that concept for their own environment/variables (the two overlap in ways, but they must be understood as distinct). The same applies for type properties like integer, array, function etc. Have you considered using a restricted shell, like The environment is a read/write part of each process (see here and here for details), not only can a process write directly to the data part (via If there are specific commands that users run that must have a certain environment you may be able to set only group-execute and use As a last option you may be able to use The most robust approach is to filter the |
|||
|
|
|
Readonly variables can be set in POSIX compliant shells using the
This is in no way a security feature to prevent the user from changing it. The user can always spawn a new shell and change the variable. |
|||||||||
|
[t]csh? – jordanm Mar 2 at 6:19