Click to See Complete Forum and Search --> : changing a password


cuban
09-08-2001, 04:37 PM
hello all, I am making a script to do a very custom thing.

In order for my script to run correctly, I need to be able to define the users password from the command line. Is there a way to do this?

here is my script:

#!/bin/sh
#Define Variables
username=`awk -F: '{print $1}' /tmp/new.webhost`
userweb=`awk -F: '{print $2}' /tmp/new.webhost`
userpass=`awk -F: '{print $3}' /tmp/new.webhost`

#Do this!
useradd -g 200 -s /bin/false -d /webs/$userweb $username
chmod -R 755 $userweb
chown -R $username $userweb
chgrp -R webhosting $userweb
passwd $username $userpass
echo "<VirtualHost 216.110.5.16>" >> /etc/httpd/conf/named-virtual.conf
echo "DocumentRoot /webs/$userweb" >> /etc/httpd/conf/named-virtual.conf
echo "ServerName $userweb" >> /etc/httpd/conf/named-virtual.conf
echo "</VirtualHost>" >> /etc/httpd/conf/named-virtual.conf
/etc/rc.d/init.d/httpd restart

cuban
09-08-2001, 04:43 PM
Wow, I just found a flaw in that script too... It only works if there is one line in /tmp/new.webhosting

How can I fix that?

cuban
09-09-2001, 02:12 AM
okay, got this figured out...

echo userpass | passwd username --stdin