LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Way (ways) to change uid of a process (https://www.linuxquestions.org/questions/linux-security-4/way-ways-to-change-uid-of-a-process-712031/)

psea 03-16-2009 01:36 PM

Way (ways) to change uid of a process
 
Hello All!

I'm newbie in unixes and in doubt in one question.
How we can change a euid of a process? Become a root for example.
The only possibility that i found is to exec() suid Program. Owner of the Program must be root. Is it the only way to change euid of a Program? or there is another possibility to change euid of a process to whatever i want. If so can i remove all set-uid-programs from my system? Or set-uid-programs is always the case (necessity) in all unixes?

PS sorry for my english. hope you understand the question.

David1357 03-16-2009 04:43 PM

Quote:

Originally Posted by psea (Post 3477398)
Hope you understand the question.

No. I really do not understand what you are trying to do. Are you trying to prevent all programs from calling the setuid or seteuid functions?

I am pretty sure that would break your system. Some programs use setuid and seteuid to drop all their user privileges and do some unprivileged work.

psea 03-17-2009 10:17 AM

yes, my english is awful. I'll try to explain better.
The question is: how a program can get root privileges? One way everybody knows. it is to call exec() function on file that has set-uid bit on and the owner of the file is root, then call setuid(0) and here it is. you are root now.
is it the only possibility to get root privileges or there another ones?
I'm asking becouse there are so many different technologies (PAM, SELinux, RBAC etc) appeared, so maybe i miss something and the program can get root privileges somehow else?

David1357 03-17-2009 03:04 PM

Quote:

Originally Posted by psea (Post 3478332)
so maybe i miss something and the program can get root privileges somehow else?

Questions about hacking violate the rules of this site. Be gone with you before you get reported.

psea 03-18-2009 07:29 AM

Quote:

Originally Posted by David1357 (Post 3478583)
Questions about hacking violate the rules of this site. Be gone with you before you get reported.

The question is not about hacking (hacking in the meaning of "do smth that is not legal"). The question is about legal things. I'm asking because I'm newbie in *nix world. Maybee there is a syscall in linux that deal with user privilegues or something else that i don't know.
So is a set-uid executable files the oldest and the only possibility to become root and modern unixes do not have another way?

David1357 03-18-2009 09:34 AM

Quote:

Originally Posted by psea (Post 3479321)
So is a set-uid executable files the oldest and the only possibility to become root and modern unixes do not have another way?

Look at the man pages for "setuid" and "seteuid".

unSpawn 03-18-2009 05:45 PM

Quote:

Originally Posted by David1357 (Post 3478583)
Be gone with you before you get reported.

Drawing out ones intentions is the only and best way to get clarity.
Even then please remain respectful towards your fellow LQ members.

David1357 03-19-2009 01:50 PM

Quote:

Originally Posted by unSpawn (Post 3479938)
Drawing out ones intentions is the only and best way to get clarity.

I don't know what you are trying to say here. Please be more direct.

Quote:

Originally Posted by unSpawn (Post 3479938)
Even then please remain respectful towards your fellow LQ members.

I think he is asking questions about hacking, and I don't think I was disrespectful. I just told him to leave before getting reported. I could have skipped that step and just turned him in. If you really feel I was disrespectful, maybe you should report me.

Of course, you are a moderator, so maybe he reported me, and maybe that's why you are now involved?

unSpawn 03-19-2009 04:28 PM

Quote:

Originally Posted by David1357 (Post 3481075)
I just told him to leave before getting reported.

No need to look for hidden meanings, argue or whatever. I'm just asking you to be polite. That's all.

psea 03-20-2009 01:02 PM

Guys, sorry if my question sounds like "hacking". I'm just an electronic and automation engineer and OSS is my hobby. I asked such question on another forums and here I get answers, on others forums i get no answers. so thanks for help.
to David1357: i don't reported you. i even don't know what does it mean...

helptonewbie 03-20-2009 02:27 PM

I don't fully understand what your after either but possibly something like sudo could help. From the way i undertand it, your trying to run scripts/commands as root but when your a different user. For this 'sudo' is the normal thing to do.

SUID is not something to mess about with unless you fully understand it (same goes for setting sudo permissions). But to execute a script/command as root when not root.... yes you could set the SUID and this will work (if the owner is root), however the same functionality can be gained with sudo..

http://www.linuxhomenetworking.com/w...Users_and_Sudo
This is a useful webpage, to get directly to the portion i'm talking about look for in the page the heading 'The /etc/sudoers File'. But you may be better off reading the whole article. It explains quite a lot and this may help you beter understand things.


All times are GMT -5. The time now is 01:57 AM.