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
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