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