Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am observing a curious behavior when running a program with setuid bit enabled.

Program foo is owned by user bar with setuid bit set.

User execbar runs foo

foo reports that one of the dynamic libraries is inaccessible.

The dynamic library in question is located in a directory outside the normal ld.so.conf search paths so it's set via LD_LIBRARY_PATH for user execbar

The question is: Is running a program with setuid clears the environment set by user execbar?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

No, but the dynamic linker will ignore some environment variables when run with setuid as otherwise you could make it load and run any code as the target user. That goes for LD_LIBRARY_PATH, LD_PRELOAD and more. See ld.so(8).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.