Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6706461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:31:23+00:00 2026-05-26T07:31:23+00:00

I was experimenting with Linux Capabilities, and I noticed that for the passwd program

  • 0

I was experimenting with Linux Capabilities, and I noticed that for the passwd program to work without being Set-UID root, it needs to have the CAP_CHOWN capability (in addition to some others). Logically, why would it need to have CAP_CHOWN at all?

Incidentally, passwd gives me a “token manipulation error” if I remove the capability.

Edit: I’m using Ubuntu 11.04 without SELinux. I’m trying to get passwd to work without being Set-UID root.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:31:24+00:00Added an answer on May 26, 2026 at 7:31 am

    The cap_chown is not required for the passwd itself. It is only needed to change the /etc/shadow file associated with the userID.
    The /etc/shadow file is set so that it cannot be read by just anyone.

    /etc/shadow is only accessible to root. So when /etc/passwd finishes it’s authentication module and is ready to write a new (encoded) password, it will create a token. Which is accessed by the Linux-PAM service, which will chown it to root and write it into /etc/shadow.

    Edit:

    passwd uses the files /etc/.pwd.lock, /etc/shadow , /etc/nshadow.
    Since passwd reads and writes from /etc directory, w permissions are requried by it. Note that, /etc/shadow is never written by passwd. passwd actually writes to /etc/nshadow and renames /etc/nshadow to /etc/shadow.

    open('/etc/nshadow',O_WRONLY|O_CREAT)=fd1
    open('/etc/shadow', O_RDONLY)=fd2
    fchown(fd1, uid=root, gid=shadow)
    chmod /etc/shadow to : rw by owner and r by group
    read(fd2)
    write(fd1)
    rename("/etc/nshadow", "/etc/shadow")
    

    Furthermore, I confirmed the existence of /etc/nshadow using this C program. FYI,

    #include<stdio.h>
    #include<unistd.h>
    int main()
    {
    while(1)
    if (access("/etc/nshadow",F_OK)!=-1){
        printf("Exists\n");
        break;
        }
    return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am experimenting with my first cross-platform application that needs to run on Linux
When experimenting with (embedded) Apache Derby DB, I noticed that a fresh database, with
I have been experimenting with async Linux network sockets (aio_read et al in aio.h/librt),
I have the unfortunate task of maintaining an orphaned Perl program that uses Perl/TK
I have been experimenting with GNU Radio and came across the tunnel.py program. This
I hi have just ordered a couple of beaglboards for experimenting. I know that
I am experimenting with Dart. I have created an on click event like so:
From experimenting with the r.js optimizer, it seems that there is no way for
I'm experimenting with Xlib to gain a deeper understanding of how Linux GUI programs
Experimenting with Cocos2D collection detection and have some questions. First, some background: This is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.