Results 1 to 8 of 8

Thread: shared library environmental variable problem

  1. #1

    Default shared library environmental variable problem

    Hi,
    I need to run a program from a no root user, this program defend from some shared library .so .
    This library is located in the dir /home/lupin/lib,
    i try to do:

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/lupin/lib
    export LD_LIBRARYN32_PATH=$LD_LIBRARYN32_PATH;/home/lupin/lib

    but i always have this message: "error while loading shared libraries: libsched.so: cannot open shared object file: No such file or directory"

    libsched.so is in the /home/lupin/lib directory.
    if i do the same operation with root user all work properly.
    What is the problem?
    i don't want to use LD_RUN_PATH environmental variable.
    Which kind of environmental variable i have to set???

    Thanks

  2. #2

    Default Re: shared library environmental variable problem

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Your second export is wrong.... you have a semicolon instead of a colon
    (the first export is correct).

    Try posting the output from the 'ldd' command using your binary/executable
    as a parameter, or use chkbin (Novell tool, part of the supportutils
    package) to do 'ldd' plus a bunch of other stuff.

    Good luck.





    lupin982 wrote:
    > Hi,
    > I need to run a program from a no root user, this program defend from
    > some shared library .so .
    > This library is located in the dir /home/lupin/lib,
    > i try to do:
    >
    > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/lupin/lib
    > export LD_LIBRARYN32_PATH=$LD_LIBRARYN32_PATH;/home/lupin/lib
    >
    > but i always have this message: "error while loading shared libraries:
    > libsched.so: cannot open shared object file: No such file or directory"
    >
    > libsched.so is in the /home/lupin/lib directory.
    > if i do the same operation with root user all work properly.
    > What is the problem?
    > i don't want to use LD_RUN_PATH environmental variable.
    > Which kind of environmental variable i have to set???
    >
    > Thanks
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.9 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQIcBAEBAgAGBQJLYF6rAAoJEF+XTK08PnB5UGUQALbvaEI0fsUiiYa3oXv3YbyQ
    RPQzYe+JDkn1QuDfveN1OVuKqB0nob/qmmrCF+rfDHc+ueGaP7y7nC2Wx4TxvJGp
    M97LIHgGnHZ8iM26TAomL/1F3T2YOEcqiCmGXFhg09bgagO4czdyr+1EZbSKtq+c
    HyxV1DhaUxlF2SV71hx5Z7Mdvo94Q2U2SdRO+bowQDpP8spFmGVDG5lnozgQ1oJp
    /UexLBRulsQRA4zg8UrCHgScvoPTXEKYwq8DeVJKYEo0RDVxg0u+p9phNKIIdxwM
    zSWQ7Ud5BDi0CCKHQXqg/IMox68LugLSZO/cX/l2sNYRVWiQdEfG4GSjMoNETjc7
    fFFnuho58NYK7jTpgJVuiEkHIjb6s+yZJfM+k3vh0QAWP3wdAF19PaNnQewowNlU
    MTEEDbxY0GX4iTAMt0GEKVPTDLpvYpw+CgnIrjg0V4k+GIVbofEeHnRg54NqVNfv
    IPPwyIOlzYFr3s4vE65Cb3J57KnU9JQQxkiQw9ec62s7QWEGHi5xcsVpVGGalk9V
    LuRv5K+JijDzfvwsIG1wuHGwqcYTKr8rV7AXV47PRBduJybCcrO6C1Yjlf8xXuNA
    g3WMkO2KJDjzQgjCxIBBuic6dfAiAqO4PMgmg7rT46kGGJ2YEt996Akl8D6b1KNT
    uyjATUUebIdDdx+W4dJN
    =hl7M
    -----END PGP SIGNATURE-----

  3. #3

    Default Re: shared library environmental variable problem

    yes, sorry the semicolon is an error of copy from shell.

    i have the problem of LD_LIBRARY_PATH after execution of setcap for the process

    i do this:

    sudo /sbin/setcap all=eip my_process

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/lupin/lib
    export LD_LIBRARYN32_PATH=$LD_LIBRARYN32_PATH:/home/lupin/lib


    and when i execute my_process i,ve a problem of shred library.

    this is the output of ldd my_process:

    linux-vdso.so.1 => (0x00007fff67fff000)
    libGLU.so.1 => /usr/lib64/libGLU.so.1 (0x00007fcc5fb94000)
    libGL.so.1 => /usr/lib64/libGL.so.1 (0x00007fcc5f9a1000)
    libXmu.so.6 => /usr/lib64/libXmu.so.6 (0x00007fcc5f787000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007fcc5f575000)
    libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007fcc5f237000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fcc5f01b000)
    librt.so.1 => /lib64/librt.so.1 (0x00007fcc5ee12000)
    libsched.so => /home/lupin/lib/libsched.so (0x00007fcc5ec0e000)
    libshm.so => /home/lupin/lib/libshm.so (0x00007fcc5ea0a000)
    libradar.so => /home/lupin/lib/libradar.so (0x00007fcc5aaf2000)
    libpager.so => /home/lupin/lib/libpager.so (0x00007fcc48c78000)
    libstdc++.so.6 => /usr/local/gnat/lib64/libstdc++.so.6 (0x00007fcc48971000)
    libm.so.6 => /lib64/libm.so.6 (0x00007fcc4871b000)
    libgcc_s.so.1 => /usr/local/gnat/lib64/libgcc_s.so.1 (0x00007fcc48503000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fcc481aa000)
    libGLcore.so.1 => /usr/lib64/libGLcore.so.1 (0x00007fcc46ec0000)
    libnvidia-tls.so.1 => /usr/lib64/tls/libnvidia-tls.so.1 (0x00007fcc46dbd000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fcc46bb9000)
    libXt.so.6 => /usr/lib64/libXt.so.6 (0x00007fcc46953000)
    libSM.so.6 => /usr/lib64/libSM.so.6 (0x00007fcc46749000)
    libICE.so.6 => /usr/lib64/libICE.so.6 (0x00007fcc4652c000)
    libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007fcc46328000)
    libxcb-xlib.so.0 => /usr/lib64/libxcb-xlib.so.0 (0x00007fcc46125000)
    libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007fcc45f09000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fcc5fe58000)
    libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fcc45d03000)


    and this is tho output of echo $LD_LIBRARY_PATH

    /usr/lib/qt3/lib:/usr/lib64/mpi/gcc/openmpi/lib64:/usr/local/gnat/lib64:/home/lupin/lib:/home/lupin/lib

    and this is the output when i try to execute my_process:

    ./my_process: error while loading shared libraries: libsched.so: cannot open shared object file: No such file or directory

  4. #4

    Default Re: shared library environmental variable problem

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Do you really have dashes before/after those lines? Please do not add
    them if not.

    Your LD_LIBRARY_PATH is already working:

    libsched.so => /home/lupin/lib/libsched.so (0x00007fcc5ec0e000)

    The problem is probably that you are becoming root and that is trashing
    your environment variable. Try using sudo with ldd after exporting your
    variables and see if libsched.so is no longer found:

    sudo ldd ./my_process

    Good luck.





    lupin982 wrote:
    > yes, sorry the semicolon is an error of copy from shell.
    >
    > i have the problem of LD_LIBRARY_PATH after execution of setcap for the
    > process
    >
    > i do this:
    >
    > -sudo /sbin/setcap all=eip my_process
    >
    > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/lupin/lib
    > export LD_LIBRARYN32_PATH=$LD_LIBRARYN32_PATH:/home/lupin/lib-
    >
    > and when i execute my_process i,ve a problem of shred library.
    >
    > this is the output of ldd my_process:
    > -
    > linux-vdso.so.1 => (0x00007fff67fff000)
    > libGLU.so.1 => /usr/lib64/libGLU.so.1 (0x00007fcc5fb94000)
    > libGL.so.1 => /usr/lib64/libGL.so.1 (0x00007fcc5f9a1000)
    > libXmu.so.6 => /usr/lib64/libXmu.so.6 (0x00007fcc5f787000)
    > libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007fcc5f575000)
    > libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007fcc5f237000)
    > libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fcc5f01b000)
    > librt.so.1 => /lib64/librt.so.1 (0x00007fcc5ee12000)
    > libsched.so => /home/lupin/lib/libsched.so
    > (0x00007fcc5ec0e000)
    > libshm.so => /home/lupin/lib/libshm.so (0x00007fcc5ea0a000)
    > libradar.so => /home/lupin/lib/libradar.so
    > (0x00007fcc5aaf2000)
    > libpager.so => /home/lupin/lib/libpager.so
    > (0x00007fcc48c78000)
    > libstdc++.so.6 => /usr/local/gnat/lib64/libstdc++.so.6
    > (0x00007fcc48971000)
    > libm.so.6 => /lib64/libm.so.6 (0x00007fcc4871b000)
    > libgcc_s.so.1 => /usr/local/gnat/lib64/libgcc_s.so.1
    > (0x00007fcc48503000)
    > libc.so.6 => /lib64/libc.so.6 (0x00007fcc481aa000)
    > libGLcore.so.1 => /usr/lib64/libGLcore.so.1
    > (0x00007fcc46ec0000)
    > libnvidia-tls.so.1 => /usr/lib64/tls/libnvidia-tls.so.1
    > (0x00007fcc46dbd000)
    > libdl.so.2 => /lib64/libdl.so.2 (0x00007fcc46bb9000)
    > libXt.so.6 => /usr/lib64/libXt.so.6 (0x00007fcc46953000)
    > libSM.so.6 => /usr/lib64/libSM.so.6 (0x00007fcc46749000)
    > libICE.so.6 => /usr/lib64/libICE.so.6 (0x00007fcc4652c000)
    > libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007fcc46328000)
    > libxcb-xlib.so.0 => /usr/lib64/libxcb-xlib.so.0
    > (0x00007fcc46125000)
    > libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007fcc45f09000)
    > /lib64/ld-linux-x86-64.so.2 (0x00007fcc5fe58000)
    > libuuid.so.1 => /lib64/libuuid.so.1 (0x00007fcc45d03000)-
    >
    > and this is tho output of echo $LD_LIBRARY_PATH
    >
    > -/usr/lib/qt3/lib:/usr/lib64/mpi/gcc/openmpi/lib64:/usr/local/gnat/lib64:/home/lupin/lib:/home/lupin/lib-
    >
    > and this is the output when i try to execute my_process:
    >
    > -./my_process: error while loading shared libraries: libsched.so:
    > cannot open shared object file: No such file or directory-
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.9 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQIcBAEBAgAGBQJLYG+xAAoJEF+XTK08PnB5MGEQALRN9SMRxlJcCV3KogspiVsU
    LHT8pNMmBVWXX0CbtB87WNtPeY4ZtDxg1B5J8wP4k7N0nRg8ZsVnQU1O8wnsPYwX
    kUDcfjubyWq6h92exYFSidgY4w8uCdKr7Uh1M45NcUUwMz+AzynCWFLlKwfJnQDq
    l+H8VuWQ5uoAQPuz9SKFkQisViTM3YMpqUmZQcVHwkQNC1InRZfHq6LF7jmqZosl
    E2On44fX2bMhVx1MhKGeiXkWJuK4aHvtw7R1xWZoSTVJhZwU+1P5HrI2JwdbiKVV
    NH9c4bd/Ivmak24kV+a6XDWlSRocYh0MRG+3ICIihkC5t3IO4cfTB1QmckhJZJaV
    HvbehlD/f0hqOuHlX+QLTfWK0Uq0ERD0d4XbIK2qwiAg62MreK5FzQogHYeK20Hk
    SLF2KSxZwkZ4ZAmQFzSOHAV0QTQV1p0eWZo6/eRPspDQW9pBHKES1r6jfX9ezaMO
    929EcX6i0CiVpoooP37flqiGooOLXv8Epree1zk8lQqoqQPbxA6qCaJmiavGqYL4
    OT/bGlspSwy3rN45fnU6D9BW4fqXnpTv4fXG6r2DL7gi9aTAit9hGSQts5iCwEIB
    S2oEPPxPOdYY/QO6+nbIkLLI1WgdwwNDPnkmHQrbGL/7HZofFY4LM8poNhps3qHg
    vhJR3h/akRoRABamSvDz
    =0Uz7
    -----END PGP SIGNATURE-----

  5. #5

    Default Re: shared library environmental variable problem

    many thanks for your reply,
    this is true, with
    sudo ldd my_process
    the library libshm.so is not foud.
    I think, after i use setcap for my_process, if i execute it, it is execute with root root.
    But now the problem is how to set LD_LIBRARY_PATH for root from user lupin, i try sudo export, but i have the message
    sudo: export: not found

    Is there a way to set this environmental variable for root, from a not root user?

    thanks

  6. #6

    Default Re: shared library environmental variable problem

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    I would probably do it by creating a script which sets it and then calls
    the executable, and then I would call the script with 'sudo'. Another
    option may be to set the SUID bit on your binary so you can call it
    without sudo at all, though that means anybody with execute rights to the
    file can use it with root permissions.

    Good luck.





    lupin982 wrote:
    > many thanks for your reply,
    > this is true, with
    > -sudo ldd my_process-
    > the library libshm.so is not foud.
    > I think, after i use setcap for my_process, if i execute it, it is
    > execute with root root.
    > But now the problem is how to set LD_LIBRARY_PATH for root from user
    > lupin, i try -sudo export-, but i have the message
    > -sudo: export: not found-
    >
    > Is there a way to set this environmental variable for root, from a not
    > root user?
    >
    > thanks
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.9 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQIcBAEBAgAGBQJLYUR2AAoJEF+XTK08PnB5r58P/3BVf5vgPx6gNy2p+pjRgoRC
    ZkEty3Q6hnhN2Fag8shLta25F73AdLBiiRcR+dYR5hq+Uzw15UecWb9qmxMdjHMH
    +sBWu0Fw4elvPCxm3yX2zVRcfISr8JAAcxtm/oDKSjlkqCHmtK3kubRjC8Sif5M8
    rYLHQnOmZxu3reRzvuFC+4kB2mitP/bqGmz6aSLUxe86KdJCaAuy01XOFh63W8Kk
    pRl+IkycvJGCmaZFClgg+ioQaJL6DuNo4mN8qu7ODZG5cgXwfZWiUReVcsELTsWm
    3mRFKQUoVUO14NJsK4emZDHu9sPlFV7wy/9ZK0EgCN5//jHE1sYMNyZtG40xZbeD
    gmeWpD+FbKt5ewaa9PDMWT2Na42fvLk1Fz8GOiXcEh1vUrTfGXhPLGYIqWqMIs3a
    R8AysqBQxg5aMmcr5Kzwz2/sKSUOk/6CnP+NY05NQvrZSPAloNLSKqF9s1OPFGwL
    YyThpagQlVU3F224sxgYg/792kMyXC4GeKBi4YFl4ELgQ/bjoYgBc8vQCXFwcRle
    3RkarvgDhmcwkayAyR5s4CHefl4ssZLYCLEiiVYZQwibWcP5gmylwWo2gSGtLE2+
    B2bMxVuSsxZbtkl5J2FgxIVA7uUs+dLYVUixnBb3vXlGNN60jy0h4/SVQ1TBIgHf
    KPd5A7Kjpkwit4Eiq0Ni
    =p2/j
    -----END PGP SIGNATURE-----

  7. #7

    Default Re: shared library environmental variable problem

    thanks for your fast reply,
    i try with script that export LD_LIBRARY_PATH and execute the process, but when i execute the script with sudo i have an error, because in the script i execute my_process in a xterm.
    the error is the follow:

    xterm Xt error: Can,t open display:%s

    i try also from shell the command:
    sudo xterm

    and i have the same error.

    do you have any suggestion?

    many Thanks

  8. #8

    Default Re: shared library environmental variable problem

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Use 'gnomesu' or 'kdesu' for X-ish apps if you are not familiar with the
    process to allow apps to access your desktop as another user manually.

    Good luck.





    lupin982 wrote:
    > thanks for your fast reply,
    > i try with script that export LD_LIBRARY_PATH and execute the process,
    > but when i execute the script with sudo i have an error, because in the
    > script i execute my_process in a xterm.
    > the error is the follow:
    >
    > -xterm Xt error: Can,t open display:%s-
    >
    > i try also from shell the command:
    > -sudo xterm-
    >
    > and i have the same error.
    >
    > do you have any suggestion?
    >
    > many Thanks
    >
    >

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.9 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQIcBAEBAgAGBQJLYa0DAAoJEF+XTK08PnB51fMP/2QFHvN9kONNO3N16Q/Ht9BE
    6OH+Jsuw9Q/hC1fvTU05tEpIxYWz4ksDY6EMrAOICoyN2HwW+jK+ZP0X1oMAOpz1
    cXTySnppdLwr2Vw9dlJ3ZyA4fRGm6uf2Fbu821gOObcI3+7Cr8gFmt3UQy4JQZsg
    NInWXBOHiGtM3pHa5Xg36PwCjdX2XeAmqDzDrCvHw8CDaCpEnW6eNnaSii8zYjp9
    evIp11wGuSvFawAb9q2/dweh30s1Jt2VkHRgt0UMypZ2N3l1ntmV6MqY/EesDiku
    DO7+yIQJpmdUoU/eMZ3ljph4AKC5xdpcQUIHezVjbdlB1GQ1B2EapfqEs5ZoSA+5
    bmhXCcp10Gez/Vs/ZL8iGizulNkzRTPMr5KGqj9QGU/QmgRZotb7poypmK3lT6cZ
    5UkXbb/g75TWRs9JTn4QDKWuDyrzFEFohHhATeGVS9PbTzMywkyRKWOR48hsWi6F
    GA8S69gP6D80SX+iI8/bB+GS3yDkxYdINUOclVELg2+RQLw8PtUgt4E/HQH4XoIQ
    kbWOV4FRLbxwamM7W76b7YIuH8mtd1YsUSVuXvBdtou9Du3flImrJ7GFJUlCiihC
    auw6RmUmbuliS4TnfHTsEt9xlP0S4h3902BpdqoWc2M8rDE4IUnwvu51apPAQjrT
    9XvaiWCsDCu+GlLKE06H
    =G3BT
    -----END PGP SIGNATURE-----

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •