LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-10-2003, 12:12 AM   #1
uribo
LQ Newbie
 
Registered: Apr 2003
Posts: 11

Rep: Reputation: 0
bourne shell /etc/passwd /etc/shadow


#!/bin/sh

TEMPFILE1=/tmp/ehong.1.$$

IFS=":" ; export IFS
cat /cygdrive/h/etc/passwd | while read username passwd_placeholder userid groupid gecos home_dir shell; do
if [ $userid -gt 500 ] ; then
shadow_line=`grep "^$username:" /cygdrive/h/etc/shadow`
`echo $shadow_line | awk -F: '{ print $1":"$3":"$4":"$5":"$6 }' /cygdrive/h/etc/shadow` > $TEMPFILE1
fi
done

i have been figuring out abt this for a week. i have problem extracting info from /etc/shadow with username input from /etc/passwd & output to a temp file for comparing data later on. help is appreciated! thanks!
 
Old 05-09-2003, 11:23 AM   #2
vladkrack
Member
 
Registered: Oct 2002
Location: Curitiba - Brazil
Distribution: Conectiva
Posts: 334

Rep: Reputation: 30
In the line:

`echo $shadow_line | awk -F: '{ print $1":"$3":"$4":"$5":"$6 }' /cygdrive/h/etc/shadow` > $TEMPFILE1

use

echo $shadow_line | awk -F: '{ print $1":"$3":"$4":"$5":"$6 }' /cygdrive/h/etc/shadow > $TEMPFILE1

Hope that helps ...
 
Old 05-09-2003, 11:09 PM   #3
uribo
LQ Newbie
 
Registered: Apr 2003
Posts: 11

Original Poster
Rep: Reputation: 0
thanks, i have long discarded that, did it another way.
 
  


Reply


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
'sh' shell - Actually calls legacy Bourne shell, or uses system default? Dtsazza Linux - Software 1 10-28-2005 09:20 AM
Moving /etc/passwd and /etc/shadow john8675309 Linux - Software 1 01-24-2005 08:44 PM
It is ok if i unshadow the /etc/passwd and /etc/shadow Paxmaster Linux - Software 1 01-12-2005 10:07 PM
mismatch with /etc/passwd and /etc/shadow AngryKeebler Linux - General 1 07-23-2004 03:42 PM
/etc/passwd or /etc/shadow? tiger7007 Linux - Security 2 03-21-2004 04:41 AM

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

All times are GMT -5. The time now is 05:54 AM.

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