Permission error while using execve..

Hi,

I have the following scenario..

1\) I have a binary which i launch from command line. It executes fine.

2\) But when I launch it from another file using execve command, it gives a message that it is not able to access a shared object ".so" in /usr/bin \(message is "Permission denied"\).

I searched on internet on this topic and found out that it has something to do with setgid / setuid..

I am correct in this.. Can someone help me recreate this scenario with a simple example..

What's your OS?

Please show us exactly what you're doing, and exactly what error you're getting. Otherwise, we are only guessing...

Hi,

I am trying launch a binary using execve command. The binary that I launch uses the jansson library to parse. 

In such a case, I am getting a permission denied error to load the lib jansson.so.4. \(I had pasted the lib jansson.so.4.4.0 and created a soft link to lib jansson.so.4\).

The binary runs fine if run separately through command line both as root and normal user.

I tried to keep the jansson libraries in the home folder and try to load it with ld_library_path and ld_preload variables.

Ld preload fails to load and says it ignored it.
Ld library path checks the path given but doesn't pick it from there and keeps checking in other defaults library paths.

Can any one help me with this ..

Thanks,
Sathish

Why do you refuse to tell us what OS you're using?

Why do you refuse to show us the exact text of the diagnostic messages that are printed when things fail?

We are trying to help, but refusing to give us this basic information needed to diagnose your problem only makes it hard for us to give you any useful information.

Show us the output from the commands:

ls -l /path/to/binary/you/are/trying/to/exec
ls -l /path/to/binary/that/is/using/execve/to/invoke/above/binary
id

If you think setUID or setGID is an issue, we need to know how the permissions are set on the binary you're trying to exec and we need to know how your UIDs and GIDs are set when you try to run this command from the command line and from the binary whose execve() is failing.

I know that many systems use an LD_LIBRARY_PATH environment variable to set up a list of directories where shared object libraries can be found. I know that when you're running setUJID or setGID programs, that variable is usually ignored to prevent malicious users from overriding system security precautions.

I am not aware of any system that uses ld_library_path and ld_preload variables. If a system does use these variables, it is violating namespace restrictions reserved for use by applications by the standards. (Case distinctions are crucial in environment variable names!)

I guess it is possible, but I have also never seen a system that places shared libraries in /usr/bin ; they are usually somewhere under /usr/lib and/or /lib .