unix/mac questions about password changes or storage, the related `.passwd` file or `passwd` command
Questions tagged [passwd]
140 questions
5
votes
3 answers
How to do conditional .htaccess password protect
I'm trying to password protect a specific url using a .htaccess. Different urls point to the same files but have different workings. I now need to password protect only one url. I'm trying to do this using setenvif but it doesn't seem to work. I…

Clooner
- 139
- 3
- 10
5
votes
1 answer
Why is `pw_gecos` named as such?
In the passwd struct:
struct passwd {
char *pw_name; /* username */
char *pw_passwd; /* user password */
uid_t pw_uid; /* user ID */
gid_t pw_gid; /* group ID */
char *pw_gecos; /* user…

WilliamMartin
- 553
- 5
- 15
5
votes
2 answers
Can not add new user in docker container with mounted /etc/passwd and /etc/shadow
Example of the problem:
docker run -ti -v my_passwd:/etc/passwd -v my_shadow:/etc/shadow --rm centos
[root@681a5489f3b0 /]# useradd test # does not work !?
useradd: failure while writing changes to /etc/passwd
[root@681a5489f3b0 /]# ll /etc/passwd…

Nemanja Trifunovic
- 3,017
- 1
- 17
- 20
5
votes
1 answer
Passwd command in Single User Mode on OSX not working
I am currently trying to create a root account from Single User Mode on OSX Yosemite
/sbin/mount -uw /
launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist
passwd
The first 2 lines appear to work fine, but after I type…

mucle6
- 645
- 1
- 10
- 24
5
votes
3 answers
Unix programming. Not sure how to use the passwd struct
I've done some research and I'm still struggling with the passwd structure.
http://www.opengroup.org/onlinepubs/000095399/basedefs/pwd.h.html
I need to obtain the user ID, however, I don't think I'm understanding the function for this at all:
int…

Bryan Harrington
- 51
- 1
- 5
4
votes
2 answers
passwd: unrecognized option '--stdin' error on Debian when I run my created Bash Script
I am using Debian. I am learning Bash scripting. I am creating a script that creates new user and sets password the problem is I get passwd: unrecognized option '--stdin' error
That is my script:
#!/bin/bash
read -p "Please Enter Your Real Name: "…

hosam.shafik
- 119
- 2
- 6
4
votes
2 answers
Check username/password in Linux without root
If I have a username and password pair how can I verify that they are actually correct in a Linux system? I know I can use passwd to do so but I want to do it programatically using C.
I should not require root privileges (so reading the shadow file…

user1618465
- 1,813
- 2
- 32
- 58
4
votes
1 answer
Protecting /etc/passwd and /etc/shadow from concurrent access
How do I protect /etc/passwd and /etc/shadow from concurrent access? I don't see any locking mechanism in pwd.h. I see the manual for pwd_mkdb mentions obtaining a lock, but is it just locking the file for exclusive access?
Is there a convention…

indiv
- 17,306
- 6
- 61
- 82
4
votes
2 answers
How do I find out the complexity needed for a Unix password
My Unix password has timed out, and I need to enter a new one, so I get this bit as soon as I login:
Current Password:####
New Password:
but anything I type is too simple (apparently), even 1y4y5re987wnf
Is there something I can type to find…

f1wade
- 2,877
- 6
- 27
- 43
4
votes
1 answer
Linux : How to set up "global" user / passwords / groups file in svn
I'm trying to set up global user / group access to all my svn repositories on Linux. Since I am very new to svn / linux stuff can someone take a look at what I have set up. I still get a "Invalid authz configuration". Here is how I proceed :
Svn…

Simmoniz
- 1,080
- 15
- 27
3
votes
7 answers
What API do I call to set a user's password on linux?
I know about passwd(1) and crypt(3). What I'm looking for is a C API to call which will set the user's password in the passwd/shadow files, without having to programatically walk the files and overwrite the entry for the user in question. …

Stéphane
- 19,459
- 24
- 95
- 136
3
votes
2 answers
/usr/bin/passwd and the CAP_CHOWN capability
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?…

Apoorva Iyer
- 590
- 1
- 7
- 15
3
votes
2 answers
Migration of NIS yppasswd hashes from crypt to md5
Imagine a NIS user database /var/yp/input-files/passwd consisting of old crypt DES hashes. The aim is to migrate this database to md5 or sha hashes. When changing a password using yppasswd, it is generated using the same algorithm as for the…

Speckinius Flecksis
- 614
- 6
- 9
3
votes
1 answer
Compare two passwd structures
I have a problem which I have narrowed down as much as I can imagine. I want to count the lines in /etc/passwd two times. One time as a reference and one time to detect any change.
I initialize one passwd structure and count the number of entries in…

macbug
- 121
- 1
- 7
3
votes
3 answers
Change linux password with Ansible playbook script when connecting as a non-root user without sudo privileges
I am trying to change password for a non-root Linux user from Ansible playbook.
To do so I tried to follow this link
Following the instruction I can successfully change the password of a non-root user by typing the code below in the terminal.
$ echo…

kuttumiah
- 525
- 1
- 11
- 19