Process Control (11)---Change the user ID and group ID of the process

Source: Internet
Author: User

Linux provides the setuid function and the Seteuid function to change the user ID associated with the process, and the process-related user ID has an "actual user ID, a valid user ID, and a saved settings user ID"======================================================function Prototypes:function Parameters:
    • UID: The user ID to set
return Value:
    • return 0 upon successful invocation
    • Return 1 if the call fails
====================================================
    • When the valid user ID of the process is root, the call to the SETUID function sets the actual user ID, valid user ID, and saved settings user ID of the process to UID
    • When the valid user ID of a process is an ordinary user, and the parameter uid of the setuid function is equal to the actual user ID of the process or the saved set user ID, this function sets the valid user ID of the process to UID, while the actual user ID and saved settings user ID are not changed
    • The call to this function fails when neither of these cases is satisfied.
the Seteuid function and the setuid function are similar, except that only the process valid user ID is modified under the root user, and the three user IDs are not modified like the setuid function. ====================================================Here's how the saved settings User ID works:
    • The saved settings user ID is used to hold a copy of the valid user ID when the process is created, and if the setuid function is used during the execution of the program to change the valid user ID, this ID can be used to restore the original valid user ID.
    • The user program is not getting the saved settings user ID, and when using the setuid function to restore a valid user ID, you must give a specific euid value.

 

Process Control (11)---Change the user ID and group ID of the process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.