Thanks a lot. After checking the super document carefully, it seems like there's no easy way to slove this problem with super.
Then I try to excute shell export before my script. It works: $ export LD_LIBRARY_PATH=/whatever/ But when I use python to set the LD_LIBRARY_PATH, it failed: os.environ["LD_LIBRARY_PATH"] = /whatever/ The code above is working well directly, but not in super command: $ su admin $ super bzytest Regards Shuai > Date: Tue, 31 Mar 2015 13:51:54 +0200 > From: simon.raffei...@kit.edu > To: sanyechon...@live.com; ubuntu-devel-discuss@lists.ubuntu.com > Subject: Re: super , keep LD_LIBRARY_PATH > > Hi, > > you can't. The variable is not removed by super or sudo, but by the > dynamic linker for security reasons. > > > From the manpage of ld.so(8): > > "LD_LIBRARY_PATH > A colon-separated list of directories in which to search for ELF > libraries at execution-time. Similar to the PATH environment variable. > Ignored in set-user-ID and set-group-ID programs." > > > The corresponding source code line is > https://sourceware.org/git/?p=glibc.git;a=blob;f=elf/dl-load.c;h=41b91fcc86664b39ea8c0ce5ed35109ab494c925;hb=HEAD#l817 > , the __libc_enable_secure flag gets set when a binary is executed > setuid root and prevents the use of untrusted paths LD_LIBRARY_PATH. The > list of trusted paths is generated at compile time, so you can't change > it later. > > > I have never used super and the only solution I know is the following: > > > $ export LD_LIBRARY_PATH=/whatever/ > $ sudo LD_LIBRARY_PATH=${LD_LIBRARY_PATH} env > > > > kind regards, > > Simon > > > > > On 31.03.2015 10:13, sanyechon...@live.com wrote:> Hi everybody! > > How can I keep the enviromet variable LD_LIBRARY_PATH when I excute > > a super command? > > > > I have modified /etc/super.tab: > > :global env=PATH,LD_LIBRARY_PATH,PYTHONPATH > > bzytest /root/test admin > > > > /root/test: > > #!/bin/bash > > export > > > > I can get PATH, PYTHONPATH kept. But LD_LIBRARY_PATH is not. > > > > Forgive my bad english. > > > > Best wishes > > > > > > > Shuai > > sanyechon...@live.com > > > -- > Karlsruhe Institut of Technology (KIT) > Steinbuch Centre for Computing (SCC) > > M. Sc. Simon Raffeiner > High Performance Computing Administrator
-- Ubuntu-devel-discuss mailing list Ubuntu-devel-discuss@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss