Solved

Setting passwd from a ksh script

Posted on 1998-10-21
7
452 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
  • 3
  • 3
7 Comments
 
LVL 1

Accepted Solution

by:
Strange earned 100 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

911 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now