Thread: changing user's uid

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    3

    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() ?

  2. #2
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    You try looking at the source for su? Do a web search for coreutils to find a gnu version..

    ~/

  3. #3
    Registered User
    Join Date
    Aug 2004
    Posts
    3
    Yeah in the mean time i searched for su.c and found the soulution..Thanx!

  4. #4
    Registered User
    Join Date
    Aug 2004
    Posts
    3
    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

  5. #5
    Registered User
    Join Date
    Sep 2004
    Posts
    197
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. getpwnam_r returns wrong uid.
    By stevfletchcom in forum C Programming
    Replies: 5
    Last Post: 10-22-2008, 04:59 PM
  2. Function validation.
    By Fhl in forum C Programming
    Replies: 10
    Last Post: 02-22-2006, 08:18 AM
  3. Changing locale for new users
    By axr0284 in forum Tech Board
    Replies: 0
    Last Post: 12-15-2004, 10:22 AM
  4. Windows ntfs perms
    By wp_x in forum Tech Board
    Replies: 3
    Last Post: 03-04-2003, 06:38 AM