rizzler Posted December 7, 2009 Share Posted December 7, 2009 Hello. I am trying to make this shell script bellow work on my server wich should take the names in newacc.cvs and add them to the system. For each user the script should ask me to enter a password for the user im adding and then add them to the system, however my current solution do not work atm as when i run the script it dont stop to let me enter a password at all at the passwd echo, it just runs past it :/ do someone know how to make this work? using READ read -p "Enter your password" PASS echo $PASS" and the same thing happens Example from newacc.cvs maria;jones andreas;öring Script #!/bin/sh if [ "$#" == "0" ] then cat newacc.cvs | while IFS=';' read firstname surname; do useradd $firstname -m echo added $firstname to the system passwd $firstname cd /home/$firstname/ maildirmake.courier Maildir echo Maildir Created for $firstname done exit 0 Quote Link to comment Share on other sites More sharing options...
trq Posted December 7, 2009 Share Posted December 7, 2009 Are you executing this script as root? Quote Link to comment Share on other sites More sharing options...
rizzler Posted December 7, 2009 Author Share Posted December 7, 2009 Are you executing this script as root? yes i am. Quote Link to comment Share on other sites More sharing options...
steviewdr Posted December 10, 2009 Share Posted December 10, 2009 That script wont work. Your going to have to prompt the user for a password in bash, and then send the password into useradd. useradd username -p password -steve Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.