The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
I need it to prompt me for a root password, so I don't have to log as root lunchtime UNIX for Dummies Questions & Answers 2 06-25-2007 12:21 PM
how to access root priveliges if root password is lost wojtyla Linux 1 02-18-2005 03:24 AM
Lost root password / Can't login as root Perderabo Answers to Frequently Asked Questions 0 06-22-2004 04:40 PM
No root password cyno UNIX for Dummies Questions & Answers 6 08-14-2002 09:57 PM
root password silver40 Shell Programming and Scripting 9 03-21-2002 01:38 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 01-22-2008
Tytalus's Avatar
Registered User
 

Join Date: Jun 2003
Location: Scotland
Posts: 290
steps to check (root) passwd in a script:

1/ grab/store the (root) passwd crypt string in a var e.g. CRYPT.

2/ get user to enter password:
Code:
stty -echo
trap "stty echo ; echo 'Interrupted' ; exit 1" 1 2 3 15
/usr/bin/echo "Enter password: "
read password
stty echo
3/ encrypt the entered password and check for match
Code:
/usr/bin/perl -e "print 'match' if crypt('${password}', '$CRYPT') eq '$CRYPT';"
HTH
Reply With Quote
Forum Sponsor
  #9  
Old 01-22-2008
Registered User
 

Join Date: Dec 2007
Posts: 45
Thanks for the reply, but i cant make any sense of it, and how to put it in the script,
sorry for being a pain, but idont know alot about bash, this is way over my head.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:56 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0