LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices

Reply
 
Search this Thread
Old 03-16-2009, 01:36 PM   #1
psea
LQ Newbie
 
Registered: Mar 2009
Posts: 4

Rep: Reputation: 0
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.
 
Old 03-16-2009, 04:43 PM   #2
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by psea View Post
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.
 
Old 03-17-2009, 10:17 AM   #3
psea
LQ Newbie
 
Registered: Mar 2009
Posts: 4

Original Poster
Rep: Reputation: 0
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?
 
Old 03-17-2009, 03:04 PM   #4
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by psea View Post
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.
 
Old 03-18-2009, 07:29 AM   #5
psea
LQ Newbie
 
Registered: Mar 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by David1357 View Post
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?
 
Old 03-18-2009, 09:34 AM   #6
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by psea View Post
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".
 
Old 03-18-2009, 05:45 PM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,112
Blog Entries: 54

Rep: Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784
Quote:
Originally Posted by David1357 View Post
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.
 
Old 03-19-2009, 01:50 PM   #8
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by unSpawn View Post
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 View Post
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?
 
Old 03-19-2009, 04:28 PM   #9
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,112
Blog Entries: 54

Rep: Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784Reputation: 2784
Quote:
Originally Posted by David1357 View Post
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.
 
Old 03-20-2009, 01:02 PM   #10
psea
LQ Newbie
 
Registered: Mar 2009
Posts: 4

Original Poster
Rep: Reputation: 0
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...
 
Old 03-20-2009, 02:27 PM   #11
helptonewbie
Member
 
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 517

Rep: Reputation: 39
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: 10 ways to Tweak your Linux Boot Process LXer Syndicated Linux News 0 12-23-2008 01:20 PM
How to start a process with specific uid/gid during bootup? senthilpr_in Linux - Software 5 05-23-2007 11:22 PM
Process UID Question halfpower Linux - General 1 10-03-2005 12:25 PM
how to change UID linuxidiot2 Linux - General 2 07-30-2004 04:17 PM
Change UID of process/Privileged ports syntac Linux - General 1 04-17-2003 07:07 AM


All times are GMT -5. The time now is 12:04 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration