Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Setting passwd from a ksh script

Posted on 1998-10-21
7
Medium Priority
?
469 Views
Last Modified: 2010-08-05
Is it possible to set a password from within a shell script. I can't seem to find any way to pass the new password to the passwd command. It still will always ask for New Password:.
0
Comment
Question by:johnnyw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 1

Accepted Solution

by:
Strange earned 300 total points
ID: 2007516
If your script can be executed by the root or be setuided, you can simply correct master.passwd file without using passwd command. There is an 'adduser' script under FreeBSD that doing many such a things.
0
 

Author Comment

by:johnnyw
ID: 2007517
The script will be run as root. It's running under Sequent Dynix/Ptx 4.4.2. If you can tell me where I can get hold of the script you mention I'll evaluate it. My other alternative is to pass in the encrypted password as a string using the passmgmt command.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2007518
UNIX does not allow to pass the password as argument or read it from a file (input redirect) 'cause of security reason.
To do such things you need expect.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:johnnyw
ID: 2007519
Cheers. Looking at the expect documentation that will seem to do the trick.

Thanks very much.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2007520
So you accepted my comment but a "Strange" answer was graded,
bad luck (for me :-)
0
 

Author Comment

by:johnnyw
ID: 2007521
Sorry I wasn't reading them correctly. I'm new to this site so wasn't paying enough attention.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2007522
I'll survive :-)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question