Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 03-04-2004, 06:56 PM   #1
Registered: Oct 2003
Location: TX
Distribution: RH 8.0
Posts: 97

Rep: Reputation: 15
bash scripting question

This is my second day of attempting to write scripts, so I need some help.

I want to make a script to add a user to a server, set the password and then put them on some other services.

I want them to enter the command with the two necessary options being their username and their password ( I know that it's not that safe, but that is not of my concern now.)

addmyuser [name] [password]

It will do a "useradd" then try a "passwd"-- but how am I supposed to write a script that must enter something when prompted after the initial command?

Old 03-04-2004, 09:34 PM   #2
LQ Guru
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
The 'useradd' command can be used with the '-p' option to provide a password; such as:

useradd -p mypassword myusername

That way it won't prompt for it.
Old 03-07-2004, 02:37 PM   #3
Registered: Oct 2003
Location: TX
Distribution: RH 8.0
Posts: 97

Original Poster
Rep: Reputation: 15
Very cool--thanks a lot.

I'm having the same problem with smbpasswd--except it doesn't have anything that's equivalent to the "-p."

On a side note--using the combination "useradd and passwd" just stopped working for me and "useradd -p" isn't working either--just the graphical way. Any thoughts?

Also, is there a limit as to how many user accounts can be on a RH9.0 machine?



Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Bash Scripting Question fiod Linux - Newbie 4 11-19-2005 06:09 AM
Bash scripting question ajaye1971 Linux - Newbie 1 11-16-2005 08:29 PM
Bash scripting question. pete1234 Programming 23 09-22-2005 07:52 PM
Bash scripting question. welby Linux - Software 1 01-14-2004 11:05 AM
Bash Scripting Question RefriedBean Programming 6 09-11-2002 10:06 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:06 AM.

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