LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-21-2004, 05:02 PM   #1
BrianFFM
LQ Newbie
 
Registered: Sep 2003
Location: Frankfurt Main / Germany
Posts: 5

Rep: Reputation: 0
Script to set userpassword


Hello all,

I have create a script to add a useraccount on my webserver. the script creates all directorys (html, cgi-bin, temp), set the permissions and send me a mail with all informations.

everything run ok but only the password.

export PASSWD=$(pwgen -1 -c -n)

now $PASSWD is the created password.

I try to use passwd or useradd -p

nothing is running .. can some on tell me how is the syntax ??

e.g

passwd -e $USERNAME $PASSWD (not running)
useradd -g ftpuser -d /var/www/$USERNAME -s /bin/ftp -m $USERNAME -p $PASSWD (not running)

Help please

Thanx, Brian
 
Old 02-23-2004, 10:33 PM   #2
Berng
Member
 
Registered: Dec 2003
Location: Siberia,Russia
Distribution: Basically RedHat
Posts: 34

Rep: Reputation: 15
You should do run this script under root privilegies.
If you want do this through web, you must install smth. like 'sudo' program (http://www.sudo.ws/sudo/) and run this script through sudo, or to change the user, under which this script executes to 'root' (see chmod manual).
sudo is preferable way, i think.
Best Regards,
Oleg.
 
Old 02-24-2004, 04:52 AM   #3
BrianFFM
LQ Newbie
 
Registered: Sep 2003
Location: Frankfurt Main / Germany
Posts: 5

Original Poster
Rep: Reputation: 0
Thanx, I know this :-)

my problem is the syntax to set the password. in a commandline "passwd" ask for "new password" and "retype password" haw can I do this with a script ??

cheers, Brian
 
Old 02-24-2004, 05:19 AM   #4
Berng
Member
 
Registered: Dec 2003
Location: Siberia,Russia
Distribution: Basically RedHat
Posts: 34

Rep: Reputation: 15
?
man expect
?
Best Regards,
Oleg.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to set up permissions amwink Linux - General 2 10-22-2005 09:32 AM
Script to set userpassword BrianFFM Linux - General 2 08-30-2005 08:02 AM
LDAP Authentication(UserPassword validation) joeyBig Linux - General 4 09-21-2004 05:50 PM
How to set iptables script for lan matthewchin Linux - Networking 4 07-21-2003 04:23 AM
how to set cgi script willl_hunting Linux - Newbie 3 03-20-2001 09:40 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration