LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 03-04-2004, 05:56 PM   #1
mehesque
Member
 
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?

Thanks
 
Old 03-04-2004, 08:34 PM   #2
wapcaplet
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, 01:37 PM   #3
mehesque
Member
 
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?


Thanks
 
  


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

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

All times are GMT -5. The time now is 09:07 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