changing user's uid
Hi everyone !
I need to make a program that changes the user's id. I know you can do it using the seteuid() sys calls but the problem is that it doesnt uses any passwd auth.. (i need something like "su") so that you suply the user id and user passwd... Does it exists any syscall for this or do i need to do it in a nasty way using su in completion with exec() or system() ?
You try looking at the source for su? Do a web search for coreutils to find a gnu version..
Yeah in the mean time i searched for su.c and found the soulution..Thanx!
No i haven't find it ;(
su is a suid program so changing uid's is kinda easy with seuid()..The problem is that my program should be running with users privileges
I don't think that is possible. I am pretty sure in order to change your uid, you have to have root privs, that is why su is suid.
you can change to any user though with su, not just root. simply supply the other user name, and it will change to that one.