How to pass passwords to bash scripts?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to pass passwords to bash scripts?
# 1  
Old 08-04-2006
How to pass passwords to bash scripts?

I'm finding the following command very tedious to type in all the time, so I created a one line bash script called mount.bash with the following contents:

mount -t cifs //mark/C\$ -o unc=//mark\\C$,ip=10.1.1.33,user=Administrator,password=$1 /mnt/mark

I don't like the fact that I have to put my password on the command line. What can I do to to prompt for $1 if it is not provided on the command line and echo "*"'s instead of the actual characters being typed?

Thanks,
Siegfried
# 2  
Old 08-04-2006
stty -echo
read PASSWD
stty echo
echo $PASSWD
# 3  
Old 08-04-2006
stty does not work

Unforunately, it appears that the linux distribution (openwrt) on my linksys router does not have the stty command.

It is still good to know, however.
Thanks,
Siegfrieed
# 4  
Old 08-04-2006
Quote:
Originally Posted by siegfried
Unforunately, it appears that the linux distribution (openwrt) on my linksys router does not have the stty command.

It is still good to know, however.
Thanks,
Siegfrieed
interesting...... you have 'linux' running on the linksys router?
# 5  
Old 08-04-2006
Linksys routers and linux

http://forum.openwrt.org/

I also have linux running on my linksys NAS controller.
# 6  
Old 08-04-2006
Quote:
Originally Posted by siegfried
http://forum.openwrt.org/

I also have linux running on my linksys NAS controller.
thanks for the link - I must have been comatosed for the last couple of years.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - How to update header of scripts in one pass - multiline search/replace

Hello. A find command return a list of file. For each fileReplace the content starting with the first "§" (of two) ending with last "ɸ" (of two), regardless of the content ( five lines ) by the following content (exactly) : §2019_08_23§ # # ... (8 Replies)
Discussion started by: jcdole
8 Replies

2. Shell Programming and Scripting

How to store the passwords securely and use in scripts?

I want to store the passwords in a global file, so that all the users will not use them to login but a process should use it. One way is to keep the passwords in a .ini file and execute the file in the start of the script and use that variable. But with this, one can echo the variable in the... (15 Replies)
Discussion started by: karumudi7
15 Replies

3. Shell Programming and Scripting

How to pass variables between scripts?

Hello, I have two bash scripts like the following: script 1: #!/bin/bash var=WORLD bash path/to/second/script/script2.bash script 2: #!/bin/bash echo "HELLO $var" I expected the output to be "HELLO WORLD" but instead, I get "HELLO". I understand that when I envoke another bash... (2 Replies)
Discussion started by: jl487
2 Replies

4. Shell Programming and Scripting

Bash for multiple accounts with auto-gen passwords

Hello, I am studying few things on unux and scripting. I need a script to create bulk users in unux. I need some assistance from you for creating 100 or more User IDs using a bash script: Here's my requirements: 1. I need to create 100 or even more user ids of different naming... (1 Reply)
Discussion started by: Shelldorado
1 Replies

5. Shell Programming and Scripting

SSH - Passing Unix login passwords through shell scripts

Hi All , I need to call a script runscript_B.sh on server A, the runscript_B.sh script locating in server B. The runscript_B.sh in calls another script runscript_A on server A itself. it seend, i need to be connect from Server A to Server B using ssh. I have tryed like this in... (3 Replies)
Discussion started by: koti_rama
3 Replies

6. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

7. Shell Programming and Scripting

How to pass values between awk and shell scripts

I know that we can call system command to execute shell script in awk. but it does not return the result of the command executed , but only returns the value of the command executoin status ( 1/0 --> failure / success). Could anyone let me know how to solve this problem. (9 Replies)
Discussion started by: rajnikanth.1912
9 Replies

8. Shell Programming and Scripting

Oracle Passwords in Unix scripts

Hi Most of the shell scripts I am dealing with have to connect to oracle database . The username password is stored in a environment file which sets the variables for username and password . Set user id do not work on AIX so users who will execute these scripts need to have read or execute... (5 Replies)
Discussion started by: clifford
5 Replies

9. Shell Programming and Scripting

Checking passwords - scripts

Hi Unix experts.... I am in the process checking user and root password of more than 1000 servers manulay. I am very pissed of checking these many servers manualy. Could some one of you help me how can i check the passwords just by runing some scripts..! Need Help Guys..! :confused: (5 Replies)
Discussion started by: bullz26
5 Replies

10. UNIX for Dummies Questions & Answers

How to pass values from one file to different scripts

Hi Gurus, Iam new to Unix. I had a requirement where i should use a file for example Host.sh or Host.txt Host = 555.254.45.14 username = aaaa pwd = SSSSSS123 And this file need to be used in different scripts. For example i have script1.sh where i want to use the values of... (6 Replies)
Discussion started by: pssandeep
6 Replies
Login or Register to Ask a Question