LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 06-17-2009, 01:06 AM   #1
hifun
LQ Newbie
 
Registered: Dec 2008
Distribution: Fedora 8
Posts: 28

Rep: Reputation: 15
root login through system call(s)


hi,
I want to give my process, superuser privileges on getting root password.
ie
If root execute this program and want to change it's privileges to normal user, getuid() and geteuid() will do the trick.
But if a normal user runs it then how the uid and euid can be changed to root via system calls?
eg.
It's just like , when shell changes it's uid , gid, euid etc. when normal user in his shell type su and <root password>.
HELP.
Thanks
 
Old 06-17-2009, 04:35 AM   #2
noctilucent
Member
 
Registered: Jun 2009
Distribution: slackware
Posts: 123

Rep: Reputation: 34
1. Why not let su/sudo/whatever take care of it in the first place?
2. Check out the permissions on /bin/su - notice anything 'special' about that?
3. Two words for you: open source. Have you looked through the source of `su` and similar tools to see what they do with the password they receive from the user?
 
Old 06-17-2009, 07:39 AM   #3
sreeharsha.t
Member
 
Registered: Jan 2009
Location: Mumbai, India
Distribution: Fedora 9, 10,11, RHEL 5
Posts: 67

Rep: Reputation: 18
Cool

Quote:
Originally Posted by noctilucent View Post
1. Why not let su/sudo/whatever take care of it in the first place?
2. Check out the permissions on /bin/su - notice anything 'special' about that?
3. Two words for you: open source. Have you looked through the source of `su` and similar tools to see what they do with the password they receive from the user?
I am just debriefing what noctilucent has said.

If I am correct, only programs run from root can gain root privileges, no other program can gain root privilege in any other way.

the programs su, sudo run with 'setuid' bit making them run with root privileges no matter which user starts. May be you too should 'setuid' your program to run as root. For the authorization you can do a md5 on the password entered and check with the /etc/shadow file. To deny access, just exit the program when the password digest doesn't match.
 
Old 06-19-2009, 07:49 PM   #4
hifun
LQ Newbie
 
Registered: Dec 2008
Distribution: Fedora 8
Posts: 28

Original Poster
Rep: Reputation: 15
Thanks,
But if i simply do su it prompt for password and accept it.
on strace su , it asks for password but giving "password incorrect every time" so i am not able to check the syscalls.
Probably it might be calling setuid, setgid etc. Am i right?
 
  


Reply



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
How to call system call from usb driver's code Mr.J Linux - Kernel 4 09-29-2008 03:47 AM
Cannot login to CentOS system even as root...disk failure? sneakyimp Linux - Newbie 10 04-11-2008 11:34 PM
How can i make centos 4.5's system call using vDSO(call *%gs:0x10) instead of int80 tclwp Red Hat 3 08-06-2007 12:07 AM
safe guarding your system by not allowing anyone to login as root abhis_mail2002 Fedora 6 05-14-2006 02:58 AM
Unable to login as root - system freezes rcs1000 Linux - Security 4 07-26-2005 05:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:26 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration