• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 484
  • Last Modified:

Setting passwd from a ksh script

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
johnnyw
Asked:
johnnyw
  • 3
  • 3
1 Solution
 
StrangeCommented:
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
 
johnnywAuthor Commented:
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
 
ahoffmannCommented:
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
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

 
johnnywAuthor Commented:
Cheers. Looking at the expect documentation that will seem to do the trick.

Thanks very much.
0
 
ahoffmannCommented:
So you accepted my comment but a "Strange" answer was graded,
bad luck (for me :-)
0
 
johnnywAuthor Commented:
Sorry I wasn't reading them correctly. I'm new to this site so wasn't paying enough attention.
0
 
ahoffmannCommented:
I'll survive :-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now