Reading passwd and need to use it multple times when script asks


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Reading passwd and need to use it multple times when script asks
# 1  
Old 08-13-2010
Reading passwd and need to use it multple times when script asks

Hi Gurus,

I have one requirment..
I have written a script and it asks a registry passwd while performing some clearcase command. Now we are giving it manually. It's for one time run. We want to perform this for multiple times on multiple files throguh for loop.. means we need to pass the same passwd for each file in that loop.

For ex:

Code:
 
for i in `cat list`; do
command1
#Here it asks for passwd like below, we have to pass it manually only.
Registry passwd:
command2
command3
.
.
done


We dont have expert binaries in my boxs. so can anyonce suggest any other way on this please?

Thanks in advance..

Regards,
VRN
# 2  
Old 08-14-2010
expect?
# 3  
Old 08-14-2010
sorry for typo, yes,it's expect only and we don't have expect binaries in our Unix boxes and we can not get it also as it's restricted to use.

so is there any other way to pass the passwd?

I got an idea..
read the passwd in script before enter into the loop itself like below, and use that variable to pass passwd multiple times....

echo "Registry passwd:"
read passwd
#Here, i use this $passwd in loop to pass the passwd

but the issue is... when we enter the passwd while executing the script.. it's showing the passwd on the screen... but i dont want it to appear on the screen..

is there anyway to hide the passwd while passing it...?

Thanks in advance....
# 4  
Old 08-16-2010
stty -echo

there are some example scripts that usually come with expect that might help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Handling multple profiles with single user account

Team , I would like to handle multiple profiles(.profile/.kshrc, .profile1/.kshrc1..etc) with single user account as 'useradm' in same server. for example : firstly login into server with useradm account it has to load .profile/.kshrc or profile1/.kshrc1, set the environment... (7 Replies)
Discussion started by: hemanth12345
7 Replies

2. SuSE

SUSE "passwd username" ask for password 4 times

Below is the error I'm getting. # passwd username Changing password for username. New Password: Reenter New Password: Password changed. New UNIX password: Retype new UNIX password: Password has been already used. Choose another. passwd: Authentication token manipulation error# cat... (0 Replies)
Discussion started by: toor13
0 Replies

3. UNIX for Dummies Questions & Answers

Reading etc/passwd file

I am new to UNIX and I am trying to read an etc/passwd file. I have 2 questions. 1) Looking at several of the User IDs, there are appears to be alphanumeric characters under the password column, for Root and Oracle. Does this mean that the password is not encrypted? 2) Should I be... (9 Replies)
Discussion started by: McMeatface
9 Replies

4. Shell Programming and Scripting

Script asks to input data

Hi, I have three different files about a warehouse's stock status. Each file shows storage locations, stored product names, quantity of the part and at last column, its price. When there is a change in price, I open those files one by one, search related product name at each row and change... (4 Replies)
Discussion started by: baris35
4 Replies

5. Solaris

Particular user account shouldn't be locked after entering wrong passwd specfic no. times

Hi all In my system we have implemented user lockout feature after 3 failure attempt if he tries to login directly or if he run the any command through sudo and enter wrong password thrice. Now I have requirement in which particular user account shouldn't be locked when he run the command... (1 Reply)
Discussion started by: sb200
1 Replies

6. AIX

When did AIX start using /etc/security/passwd instead of /etc/passwd to store encrypted passwords?

Does anyone know when AIX started using /etc/security/passwd instead of /etc/passwd to store encrypted passwords? (1 Reply)
Discussion started by: Anne Neville
1 Replies

7. Programming

Problem with implementing the times() function in C (struct tms times return zero/negative values)

Hello, i'm trying to implement the times() function and i'm programming in C. I'm using the "struct tms" structure which consists of the fields: The tms_utime structure member is the CPU time charged for the execution of user instructions of the calling process. The tms_stime structure... (1 Reply)
Discussion started by: g_p
1 Replies

8. Shell Programming and Scripting

call a passwd file to a script multiple times

Hello everybody, I have a requirement in my script.. When i'am executing a script, it'll ask a passwd of some service account.. I need to pass it to the script through a zipped file when it asks for it. The script can be executed by more people many number times. So for securty purpose, it... (1 Reply)
Discussion started by: raghu.iv85
1 Replies

9. Shell Programming and Scripting

Reading a file several times with awk

Hi everyone, I was wondering if it's possible to read a file ("file2" in my example) more than once. In this example I want to print file2 entirely for each lines of file1: awk -F$'\t' '{ print $0 while ((getline < "file2") > 0) { print "\t"$0 } }' file1 It... (4 Replies)
Discussion started by: anthony.cros
4 Replies

10. SCO

Multple crons at boot

I am running SCO on a Netfinity system and two crons are started on bootup, but only after the system is brought down hard. i.e. running haltsys, reboot, or by a power outage. Has anyone seen this before and know a resolution to stop it? (0 Replies)
Discussion started by: ertzman
0 Replies
Login or Register to Ask a Question