LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-22-2008, 03:48 PM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
Script Error


I have a very basic script that was working fine on a RHEL server however when I try and use it on my Debian machine, I get errors. The script is bash and appears to be some what basic - I use it to create a user on my email server. The script basically gives the user an account, generates a home directory. When I run the script, I get the following error:

Code:
mail:/usr/bin# create-user.sh 
----------------------------
User account created.
passwd: unrecognized option `--stdin'
Usage: passwd [options] [LOGIN]

Options:
  -a, --all			report password status on all accounts
  -d, --delete			delete the password for the named account
  -e, --expire			force expire the password for the named account
  -h, --help			display this help message and exit
  -k, --keep-tokens		change password only if expired
  -i, --inactive INACTIVE	set password inactive after expiration
				to INACTIVE
  -l, --lock			lock the named account
  -n, --mindays MIN_DAYS	set minimum number of days before password
				change to MIN_DAYS
  -q, --quiet			quiet mode
  -r, --repository REPOSITORY	change password in REPOSITORY repository
  -S, --status			report password status on the named account
  -u, --unlock			unlock the named account
  -w, --warndays WARN_DAYS	set expiration warning days to WARN_DAYS
  -x, --maxdays MAX_DAYS	set maximim number of days before password
				change to MAX_DAYS

USERNAME:	testuser
FULL NAME:	Test User
PASSWORD:	user1234
So there appears to be some parameter in the script that it does not like:

Here is the script:

IDE_USERLIST_FILE=/usr/local/share/ide-userlist.txt
IDE_USERLIST=$(sort --field-separator=: ${IDE_USERLIST_FILE} | awk -F":" '{print $1}')
PREVIOUSDIR=$(pwd)

echo "----------------------------"

for u in $IDE_USERLIST; do
IDE_USERNAME=$u
IDE_FIRSTNAME=$(grep "^$IDE_USERNAME:" $IDE_USERLIST_FILE | awk -F":" '{print $2}')
IDE_LASTNAME=$(grep "^$IDE_USERNAME:" $IDE_USERLIST_FILE | awk -F":" '{print $3}')
IDE_LASTNAME_LC=$(echo $IDE_LASTNAME | tr '[:upper:]' '[:lower:]')
IDE_FULLNAME="$IDE_FIRSTNAME $IDE_LASTNAME"
IDE_SSN_DIGITS=$(grep "^$IDE_USERNAME:" $IDE_USERLIST_FILE | awk -F":" '{print $4}')
IDE_USER_EXISTS=$(grep -c "^$IDE_USERNAME:" /etc/passwd)
IDE_PASSWORD=$(echo $IDE_LASTNAME_LC$IDE_SSN_DIGITS)
#echo -e "USERNAME:\t$IDE_USERNAME"
#echo -e "FULL NAME:\t$IDE_FULLNAME"
#echo -e "PASSWORD:\t$IDE_PASSWORD"
if [ $IDE_USER_EXISTS -eq 0 ]; then
useradd -g users -d /home/$IDE_USERNAME -s /bin/false -c "$IDE_FULLNAME" $IDE_USERNAME && echo "User account created."
echo "$IDE_PASSWORD" | passwd $IDE_USERNAME --stdin
echo -e "USERNAME:\t$IDE_USERNAME"
echo -e "FULL NAME:\t$IDE_FULLNAME"
echo -e "PASSWORD:\t$IDE_PASSWORD"
else
echo "*** INFO: Doh! The user $IDE_USERNAME already exists! I WILL NOT create."
fi
echo "----------------------------"
done

history -c
 
Old 09-22-2008, 04:04 PM   #2
rednuht
Member
 
Registered: Aug 2005
Posts: 239
Blog Entries: 1

Rep: Reputation: 31
Code:
man passwd
shows --stdin is not a known parameter.
try removing it.
 
Old 09-22-2008, 04:26 PM   #3
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Yep. The error is clear.

Maybe RHEL uses a patched version of passwd. If you rely on that, you can always try to locate the patches, or the patched package, and use it under debian.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
why am getting error ksh: syntax error: `fi' unexpected while running script deb4you Linux - Newbie 4 09-06-2008 08:37 AM
bash script read error and awk ouptut error whited Programming 4 10-16-2007 07:05 PM
i get an error message running php script inside a cgi script. repolona Linux - Software 0 02-22-2007 09:10 PM
error when tying to run python script(bash error?) shanenin Programming 5 01-10-2006 10:01 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 04:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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