Hi all, How difficult is it to get this pseudo code to work under SHELL? This is the task I do every day. I m not sure how to start it. can anyone help? useradd username usermod -g username username passwd username vi /etc/passwd define home dir cd ~username remove all data then go to /home/usrbak cp username.tar.gz to /tmp cd tmp gzip -d username.tar.gz tar -xf username.tar mv * ~username vi /usr/local/apache/conf/include-conf/vhosts add the domain within the vhost cd ~username chown -R username:username . chmod -R 755 . service httpd restart Any assistance would be helpful. Thanks in adv.
Most of what you are doing can be done with useradd itself. Read the man page. The (moderately) tricky part is encrypting the password. I use a compiled C program as a front end to crypt(3): /******************************** NAME: crypt.c AUTHOR: Chris F.A. Johnson DATE: 2003-01-23 ********************************/ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> int main(int argc, char *argv[]) { char *passwd; char buf[1024]; char *salt; if (argc > 1) { salt = argv[1]; puts(salt); } else { /* salt = "$1$!@#$%^&*"; */ salt = NULL; } fgets(buf,sizeof(buf),stdin); if ( buf[strlen(buf)-1] == '\n' ) { buf[strlen(buf) - 1] = '\0'; } printf( "%s\n", encrypt(buf, salt)); return 0; } /********************************/ Do not use vi in a script. Describe what you want to do, and script it directly.