Pipe Actual Password to passwd


 
Thread Tools Search this Thread
Operating Systems Solaris Pipe Actual Password to passwd
# 1  
Old 06-01-2016
Pipe Actual Password to passwd

Hello,

I have a problem. As ldap admin, i have a account with a stored password in passwd (means local). This password must be changed every 30 days.
Now i want execute "passwd" without prompt for the actual password.
I will only typie in the new password.
On Ubuntu i solve this with the following command:
Code:
echo "<oldPWD>" | passwd -r files <USERNAME>--stdin

but the "--stdin" doesn't worked on solaris bash.

how can i solve this?

1. It's not a problem that old PW ist after executing stored in history. Because after execution the password is old and not usable

2. i have no root access.

3. i can't install a additionally Package (but i can use a local script)

4. yes, I'm lazy but this are 35 Servers and it's annoying to type this password 35 times.

thanks in advanced
# 2  
Old 06-01-2016
That would not be possible.

You will need to use expect

Best regards
Peasant.
This User Gave Thanks to Peasant For This Post:
# 3  
Old 06-01-2016
ah cool,

with this script is worked correct

Code:
#!/<path>/expect
set oldpass [lindex $argv 0]
set newpass [lindex $argv 1]
spawn passwd
expect "Enter existing login password:" {send "$oldpass\r"}
expect "New Password:" {send "$newpass\r"}
expect "Re-enter new Password:" {send "$newpass\r"}
expect {
  "password successfully changed for flohfeld" {puts stdout "\nsuccessful changed"}
  default {puts stdout "\nERROR!"}
}

This User Gave Thanks to fraenker For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using value from pipe as password

how can this be modified to work: echo 1 2 45 4 5 | openssl aes-128-cbc -a -salt -k $(awk '{print $3}') any ideas? if the above were to work as I envision it, the password that would decrypt the encrypted text would be: echo "the encrypted text" | openssl aes-128-cbc -a -salt -k 45 (0 Replies)
Discussion started by: SkySmart
0 Replies

2. SuSE

SUSE "passwd username" ask for password 4 times

Below is the error I'm getting. # passwd username Changing password for username. New Password: Reenter New Password: Password changed. New UNIX password: Retype new UNIX password: Password has been already used. Choose another. passwd: Authentication token manipulation error# cat... (0 Replies)
Discussion started by: toor13
0 Replies

3. HP-UX

Sudo entry required to set permission similar to ROOT without using password (PASSWD) change optio

Hi All I had installed sudo in HP UX 11.3 and it is working fine but not able to make entry required to set permission similar to ROOT without using password (PASSWD) change option for define user in /etc/sudoers file Please help if some know the syntex? :confused::wall: (2 Replies)
Discussion started by: deviltech
2 Replies

4. Shell Programming and Scripting

How to ignore Pipe in Pipe delimited file?

Hi guys, I need to know how i can ignore Pipe '|' if Pipe is coming as a column in Pipe delimited file for eg: file 1: xx|yy|"xyz|zzz"|zzz|12... using below awk command awk 'BEGIN {FS=OFS="|" } print $3 i would get xyz But i want as : xyz|zzz to consider as whole column... (13 Replies)
Discussion started by: rohit_shinez
13 Replies

5. AIX

When did AIX start using /etc/security/passwd instead of /etc/passwd to store encrypted passwords?

Does anyone know when AIX started using /etc/security/passwd instead of /etc/passwd to store encrypted passwords? (1 Reply)
Discussion started by: Anne Neville
1 Replies

6. HP-UX

Port/migrate Password passwd HP-UX to HP-UX

Hi, I know this has been covered many times on this forum from one os to a new os. Has Port/migrate Password passwd HP-UX to HP-UX been covered? B.11.11 U 9000/800 --to-- B.11.11 U 9000/785? TIA. I'm kinda new to HP side of UNIX. I need to sink up my test and live passwords for a big... (1 Reply)
Discussion started by: KmJohnson
1 Replies

7. Solaris

passwd cmd reenables passwd aging in shadow entry

Hi Folks, I have Solaris 10, latest release. We have passwd aging set in /etc/defalut/passwd. I have an account that passwd should never expire. Acheived by emptying associated users shadow file entries for passwd aging. When I reset the users passwd using passwd command, it re enables... (3 Replies)
Discussion started by: BG_JrAdmin
3 Replies

8. UNIX for Dummies Questions & Answers

How to : Identify the the password is encrypted or not in /etc/shadow or /etc/passwd?

Thanks AVKlinux (11 Replies)
Discussion started by: avklinux
11 Replies

9. AIX

new password not available on nis client for up to 10 minutes after yppush passwd

Hi, We are currently in the process to move the user authentication for our AIX clients to a Windows 2003 server to authenticate them against the active directory entries. What we have so far: - NIS master server on Windows 2003 Server with the unix-subsystem installed -> This is managing... (1 Reply)
Discussion started by: candyflip2000
1 Replies

10. UNIX for Dummies Questions & Answers

pipe password to passwd

Is there a way that I can pipe text to passwd... This is what I am trying to accomplish e.g. passwd < cat password.txt (4 Replies)
Discussion started by: SmartJuniorUnix
4 Replies
Login or Register to Ask a Question