Find the answer to your Linux question:
Results 1 to 2 of 2
Hey. it'sbeen a while since I've logged here. I'm still working on the automated useradd script, and I've run into a snag, but let me recap my project, and my ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2005
    Posts
    6

    using the crypt command in my script


    Hey. it'sbeen a while since I've logged here. I'm still working on the automated useradd script, and I've run into a snag, but let me recap my project, and my status before I go into that.

    The script I'm doing right now requires me to automatically add in users based on information provided from a text file including userid, user id number, groups(multiple) . This part is no problem. thanks to the fine help I've received here, that I can do without problem. However, another thing that needs to be done for this script is to add an encrypted password based on the password provided in the text file. This is my snag.

    Here is my script thus far:

    Code:
    #!/bin/bash
    
    cat inputfile.txt | while read usrname name uid pass groups
    do
    useradd $usrname -c $name -m -G $groups -u $uid
    done
    exit 0
    the problem here is the password. I know useradd has a -p option, but it doesn't have encryption. the project states the password needs to be encrypted. My instructor has hinted at using the crypt command to encrypt the password. The thing is, I've no idea how to use crypt, and where it would fit into my script for the password. $pass is the password variable and it has to be read from the cat statement, there can't be any user input. it all has to be automated.[/code]

  2. #2
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Code:
    man crypt
    ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •