Unix/Linux Go Back    


SCO Santa Cruz Operation (SCO) was a software company based in Santa Cruz, California which was best known for selling three UNIX variants for Intel x86.

Passwd without prompt

SCO


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 06-07-2017   -   Original Discussion by jochen
jochen jochen is offline
Registered User
 
Join Date: Jun 2017
Last Activity: 8 June 2017, 4:47 AM EDT
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
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
Sponsored Links
    #2  
Old Unix and Linux 06-07-2017   -   Original Discussion by jochen
jgt's Unix or Linux Image
jgt jgt is offline Forum Advisor  
Registered User
 
Join Date: Apr 2007
Last Activity: 24 November 2017, 7:09 AM EST
Location: 44.21.48N 80.50.15W
Posts: 2,003
Thanks: 2
Thanked 272 Times in 255 Posts
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
Sponsored Links
    #3  
Old Unix and Linux 06-07-2017   -   Original Discussion by jochen
jochen jochen is offline
Registered User
 
Join Date: Jun 2017
Last Activity: 8 June 2017, 4:47 AM EDT
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
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  
Old Unix and Linux 06-07-2017   -   Original Discussion by jochen
jgt's Unix or Linux Image
jgt jgt is offline Forum Advisor  
Registered User
 
Join Date: Apr 2007
Last Activity: 24 November 2017, 7:09 AM EST
Location: 44.21.48N 80.50.15W
Posts: 2,003
Thanks: 2
Thanked 272 Times in 255 Posts
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..
Sponsored Links
    #5  
Old Unix and Linux 06-08-2017   -   Original Discussion by jochen
jochen jochen is offline
Registered User
 
Join Date: Jun 2017
Last Activity: 8 June 2017, 4:47 AM EDT
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
thk you to reply quicky jgt.
I ll try.
No other way to fix the password prompt ?
Sponsored Links
    #6  
Old Unix and Linux 06-09-2017   -   Original Discussion by jochen
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
 
Join Date: May 2005
Last Activity: 24 November 2017, 3:49 AM EST
Location: In the leftmost byte of /dev/kmem
Posts: 5,637
Thanks: 107
Thanked 1,604 Times in 1,181 Posts
Quote:
Originally Posted by jochen View Post
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
Sponsored Links
    #7  
Old Unix and Linux 06-09-2017   -   Original Discussion by jochen
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 23 November 2017, 4:41 PM EST
Location: Saskatchewan
Posts: 22,523
Thanks: 1,154
Thanked 4,275 Times in 3,948 Posts
Quote:
Originally Posted by bakunin View Post
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.
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Unable to move from rsc prompt to ok prompt manoj.solaris Solaris 9 05-26-2014 12:43 PM
How to Change the % prompt to - prompt in UNIX? manjiri sawant UNIX for Dummies Questions & Answers 2 07-18-2013 12:51 PM
When did AIX start using /etc/security/passwd instead of /etc/passwd to store encrypted passwords? Anne Neville AIX 1 03-09-2012 09:05 PM
passwd cmd reenables passwd aging in shadow entry BG_JrAdmin Solaris 3 01-04-2011 04:28 PM
passwd vtran4270 UNIX for Advanced & Expert Users 3 09-04-2002 03:47 PM



All times are GMT -4. The time now is 09:03 AM.