Questions tagged [passwd]

unix/mac questions about password changes or storage, the related `.passwd` file or `passwd` command

140 questions
0
votes
0 answers

Can't non-interactively change password on remote machine using sshpass and chpasswd?

I'm trying to write a script that logs in a user over SSH and than changes that user's password. The line of code I currently use for that looks like the following: sshpass -p $password ssh $user@$ipadress "echo $user:$password_new | chpasswd" It…
0
votes
1 answer

busybox passwd script run failed

busybox passwd can't use --stdin option, when i excute passwd,it need to input password twice, i want to write a shell script to change auto because some reason. i do passwd manual,it works fine。 your textbut when i write a script like…
Linn
  • 1
  • 1
0
votes
2 answers

nrpe[xxxxx]: Warning: Could not set effective GID

I could not get reason of Warning messages I am getting in /var/log/messages: Apr 10 03:41:23 lsv-vm203 nrpe[85287]: Warning: Could not set effective GID=994 Apr 10 03:41:23 lsv-vm203 nrpe[85287]: Warning: Unable to change supplementary groups using…
0
votes
2 answers

Force password expiration multiple-users one-time

How can I query all users on a box and force password expiration? Currently, I am querying all users: getent shadow | awk -F: '$2 ~ /^\$/ || $2 ~ /^!\$/ {print $1} {print $3}' And this gets me the user name as well as the last password change, but…
0
votes
1 answer

Change rights of `/etc/passwd` in Dockerfile

I am building a Podman image for Openshift, and have an issue with permissions. Following this guide, and because Openshift assigns a random UID and a GID "0" when running containers, I try to chmod the /etc/passwd to be writable by its group and…
MeanStreet
  • 1,217
  • 1
  • 15
  • 33
0
votes
1 answer

retrieving usernames in a system in bash

I'm new to scripting in bash and would like to retrieve all user names of a Linux system along with their home directories. Each username got to be in a single line. Is this is the best way to do this? or is there any better way? #! /bin/bash # list…
0
votes
1 answer

Solaris 11 express and indirection

I am trying to use bash indirection in Solaris 11 express to change the password for a user. The code I am using is $ passwd testuser << MARKER > testpassword > testpassword > MARKER When I run this, I still get prompted for a password on the…
jobless
  • 145
  • 1
  • 1
  • 4
0
votes
0 answers

configuration to disable "Retype new password" in RHEL/CentOS

Is there a configuration setting in RHEL/CentOS thru which "Retype new password" can be disabled while changing user password. Thanks.
HarbS
  • 1
  • 1
0
votes
2 answers

How to make a user that runs an interactive script on login and then logout?

I have a small elif script that has 4 options. I will need to make a user that has permissions to run just that script on login and when it finishes with the script to log him out. I am trying to do it trough /etc/passwd like…
0
votes
2 answers

Is there a way to only edit the GID on /etc/passwd file using chef?

Can we use a Chef resource to change the GID from 101 to 100(or any other number) in /etc/passwd file?libuuid:x:100:101::/var/lib/libuuid: For all the GID's with 101 in /etc/passwd if one needs to change the GID, what is the way to do it using Chef…
blueowl
  • 35
  • 6
0
votes
1 answer

faillock marks correct password as wrong on RHEL6

I've been having a mysterious problem of being unable to login to my root account via SSH or Console. This is a real physical machine, not a VM. Luckily I still have a sudo user to experiment with. RHEL6 $ su root from another user works fine, so…
KrNeki
  • 135
  • 8
0
votes
1 answer

How to skip new lines for comparison in python?

I have a python code which compare 2 text file and show if they have differences. first of all i sort files then remove their spaces that are at the end of text after sort then do the comparison. #!/usr/bin/env python import difflib from pathlib…
BlackCrystal
  • 127
  • 1
  • 11
0
votes
4 answers

How to programmatically change password for a user without interactive prompt in Python?

I'm trying to change the password for user foo with user bar by calling a shell command. But I have some problems. I can do this to send a password to sudo $ echo sudopw | sudo -S ls And this to change password: $ echo foo:newpw | sudo…
klutt
  • 30,332
  • 17
  • 55
  • 95
0
votes
2 answers

Script to change root password authenticating with password enabled sudo account

I want to change root password of multiple server's. I used shell with for loop and chpasswd utility to do this. Since the sudo account is password enabled, it is prompting sudo password all the time I exit script. Below is bash Script is written in…
0
votes
2 answers

Regex for lines from /etc/passwd and /etc/group

I've been working on a small Java problem set and have come across some trouble. I'm not very experienced writing regular expressions and could really use two for verifying line entries in /etc/group and /etc/passwd in Java. I found Regex…