Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


Passwd without prompt


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Passwd without prompt

Hi,
I 'd like add a user on multiple servers and automatize password's prompt.
Code:
echo "$PASSWORD" | passwd --stdin "$user"

I have tried this command to pass the password through the pipe but that isn't word with passwd.

Someone know who automatize this step ?
Thank you.
(Openserver 6.0)

Last edited by rbatte1; 06-08-2017 at 04:03 AM.. Reason: Added CODE tags
# 2  
Use the 'ap' command.
Complete the addition of the user on the first machine then:
Code:
ap -d user >/tmp/user.data

copy the file tmp/user.data to the rest of the machines, and on each of them:
Code:
ap -r -f /tmp/user.data

The user will have the same user profile ( not .profile) and user id on every machine along with the correct privileges and authority and groups.
You still have to copy any .profile to the various machines.

Last edited by jgt; 06-07-2017 at 12:12 PM.. Reason: word profile was ambiguous
# 3  
Thanks for quick reply.

Same issue I've to use rcp to paste my user.data on each server which prompt a passwd :'(
May I find an other bin compilate like chpasswd or .... ????

Last edited by rbatte1; 06-08-2017 at 04:03 AM..
# 4  
Create a .netrc file and use ftp to copy the files, or create a /etc/hosts.equiv and use rcp

Last edited by rbatte1; 06-08-2017 at 04:04 AM..
# 5  
thk you to reply quicky jgt.
I ll try.
No other way to fix the password prompt ?
# 6  
Quote:
Originally Posted by jochen
thk you to reply quicky jgt.
I ll try.
No other way to fix the password prompt ?
I am no expert for SCO, but in most UNIXes (and i presume in SCO too) the passwd utility clears the buffer before using stdin, which is the reason why a pipeline won't work (in fact this is the desired effect - passwd is not supposed to work that way).

You can use a program to emulate an interactive session like expect to do what you want. See the expect manual for details, but it quite straightforward: you look for a certain prompt and then feed it a string, the program will think the string was entered by keyboard.

I hope this helps.

bakunin
# 7  
Quote:
Originally Posted by bakunin
I am no expert for SCO, but in most UNIXes (and i presume in SCO too) the passwd utility clears the buffer before using stdin, which is the reason why a pipeline won't work (in fact this is the desired effect - passwd is not supposed to work that way).
UNIX even has the isatty() call for secure applications, to check whether stdin is a terminal or not, but I've mostly found these sort of apps ignore stdin and grab /dev/tty directly. This is handy since it allows things to successfully prompt for a password even when they're buried deep in a pipe chain.
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Unable to move from rsc prompt to ok prompt
manoj.solaris
Hi, on sunfire v890 unable to move from rsc prompt to ok prompt, i have executed the command break.... Solaris
9
Solaris
How to Change the % prompt to - prompt in UNIX?
manjiri sawant
how to Change the % prompt to - prompt in unix :wall: ---------- Post updated at 07:40 AM ---------- Previous update was at 07:38 AM ---------- How To display the last modification time of any file in unix ---------- Post updated at 07:40 AM ---------- Previous update was at 07:40 AM...... UNIX for Dummies Questions & Answers
2
UNIX for Dummies Questions & Answers
When did AIX start using /etc/security/passwd instead of /etc/passwd to store encrypted passwords?
Anne Neville
Does anyone know when AIX started using /etc/security/passwd instead of /etc/passwd to store encrypted passwords?... AIX
1
AIX
passwd cmd reenables passwd aging in shadow entry
BG_JrAdmin
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...... Solaris
3
Solaris
passwd
vtran4270
Hi, Besides of the command "passwd" on Solaris and HP-UX and IRIX that allow users to change their passwords on the system. Is there anyother way a user can change his/her own password. Do any of these systems have a GUI interface to allow the user doing so? Thanks... UNIX for Advanced & Expert Users
3
UNIX for Advanced & Expert Users

Featured Tech Videos