Home | Forum | MAN Pages | Tutorials | Directory | HOWTOs | About Me | Contact
 
FAQS
» Advanced Routing & Traffic Control
» General FAQ
» Squid Proxy Server
» Sendmail
» Fetchmail
» Postfix
» Connecting Mobile Phone
» Paging from Linux
» Standard Commands
» Some common terms
Linux HOWTOs
- Single List of HOWTOs
- Autodir-HOWTO
- Beowulf-HOWTO
- Debian and Windows Shared Printing
- Emacs Beginner HOWTO
- IPX HOWTO
- Hellenic HOWTO
- Infrared-HOWTO
- KDE-Kiosk-Mode
- Linux+Solaris
- NCURSES-Programming-HOWTO
- Outlook-to-Unix-Mailbox
- Public-Web-Browser
- RedHat-CD-HOWTO
- Sound-Playing-HOWTO
- Sybase-PHP-Apache
- User-Authentication-HOWTO
- Vim-HOWTO
- Web-Browsing-Behind-ISA-Server-HOWTO
- XFree86-XInside
- ADSL Bandwidth Management
- Compile Apache
- Make a Bootdisk
- Linux-Windows9x-Grub
- Linux-Windows
- Linux Crash Recovery
- Optimise Squid
- Block websites in Squid
- Broadcast webcam in linux
- Compile RedHat Linux kernel
- Implement Firewall Security
- Increase Harddrive Performance
- Mount NTFS filesystem
- Patch / rebuild SRPM
- Secure Linux
- Set up a DHCP Server
- Set up an FTP server
- Set up Linux as a Router
- Use Cron
- Samba
Miscellaneous
» All Ports
» Spammers fetch email addresses
» Mounting NTFS in linux
» Linux Gazette
» Linux Man Pages
» Linux Directory
Linux Man Pages
- Section 1
- Section 2
- Section 3
- Section 4
- Section 5
- Section 6
- Section 7
- Section 8
Linux Directory
- General Information
- Linux Hardware
- Software / Applications
- Web Technology
- Software Development
- Linux Distributions
- Linux Publications
- Linux Beginners

linux,man,pages,linux man pages,squid,ntfs,mount
 

Name

setuid — set user identity

Synopsis

#include <sys/types.h>
#include <unistd.h>
int setuid( uid_t   uid);

DESCRIPTION

setuid() sets the effective user ID of the current process. If the effective UID of the caller is root, the real UID and saved set-user-ID are also set.

Under Linux, setuid() is implemented like the POSIX version with the _POSIX_SAVED_IDS feature. This allows a set-user-ID (other than root) program to drop all of its user privileges, do some un-privileged work, and then re-engage the original effective user ID in a secure manner.

If the user is root or the program is set-user-ID-root, special care must be taken. The setuid() function checks the effective user ID of the caller and if it is the superuser, all process-related user ID's are set to uid. After this has occurred, it is impossible for the program to regain root privileges.

Thus, a set-user-ID-root program wishing to temporarily drop root privileges, assume the identity of a non-root user, and then regain root privileges afterwards cannot use setuid(). You can accomplish this with the (non-POSIX, BSD) call seteuid(2).

RETURN VALUE

On success, zero is returned. On error, −1 is returned, and errno is set appropriately.

ERRORS

EAGAIN

The uid does not match the current uid and uid brings process over its NPROC rlimit.

EPERM

The user is not privileged (Linux: does not have the CAP_SETUID capability) and uid does not match the real UID or saved set-user-ID of the calling process.

CONFORMING TO

SVr4, POSIX.1-2001. Not quite compatible with the 4.4BSD call, which sets all of the real, saved, and effective user IDs.

NOTES

Linux Notes

Linux has the concept of filesystem user ID, normally equal to the effective user ID. The setuid() call also sets the filesystem user ID of the current process. See setfsuid(2).

If uid is different from the old effective uid, the process will be forbidden from leaving core dumps.

SEE ALSO

getuid(2), seteuid(2), setfsuid(2), setreuid(2), capabilities(7), credentials(7)


  Copyright (C), 1994, Graeme W. Wilford (Wilf).

Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.

Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.

Since the Linux kernel and libraries are constantly changing, this
manual page may be incorrect or out-of-date.  The author(s) assume no
responsibility for errors or omissions, or for damages resulting from
the use of the information contained herein.  The author(s) may not
have taken the same level of care in the production of this manual,
which is licensed free of charge, as they might when working
professionally.

Formatted or processed versions of this manual, if unaccompanied by
the source, must acknowledge the copyright and authors of this work.

Fri Jul 29th 12:56:44 BST 1994  Wilf. <G.Wilford@ee.surrey.ac.uk>
Changes inspired by patch from Richard Kettlewell
  <richard@greenend.org.uk>, aeb 970616.
Modified, 27 May 2004, Michael Kerrisk <mtk-manpages@gmx.net>
    Added notes on capability requirements

 
Random Linux Commands
Telnet
This is a program which enables you to work on a remote machine over a network and display the results on your local system. Use with caution, telnet is a bad security risk, ssh is a secure replacement for telnet.

Common Linux terms
Linux-FAQs Forum Categories
» About Forum
» Hardware Troubleshooting in Linux
» Linux Entertainment
» Resources
» Software toubleshooting and configuration
All Linux-FAQs Forums
» Crash Recovery
» FAQs
» Forum Talk
» Games
» General
» Linux Audio Support
» Linux Hardware / Driver
» Linux Installation Support
» Linux misc.
» Linux Networking
» Linux Newbies
» Linux Printing Support
» Linux Security
» Linux Video Support
» Mail Server
» Multimedia
» Tutorials
» Web Proxy Server
» Web Server

linux,man,man pages,faqs,howtos,forum
 
Powered by HTML
Linux-faqs.com Copyright, All rights reserved www.linux-faqs.com. Peeyush Maurya.