Sponsored Content
Top Forums Shell Programming and Scripting enter password at prompt during a script? Post 302374896 by davidstvz on Wednesday 25th of November 2009 08:07:28 PM
Old 11-25-2009
Thanks, one of those will do it!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

sudo in OS X shell script without password prompt??

I've written a shell script to alter a particular preference file on OS X (10.3.9), which works fine (tested by running the script from the terminal sat in front of the box). Problem is, I now have to run this script remotely across a number of machines via remote desktop, so where I've used the... (1 Reply)
Discussion started by: Brad_GNET
1 Replies

2. Shell Programming and Scripting

sudo, use in script without prompt for password

I need to create an automated script where I have to use sudo to switch to multiple user so the script stops and prompts for password, Is there a way I can provide the password in same command only? Remember that, I cannot disable the password settings of sudo as I dont have rights. (4 Replies)
Discussion started by: gauravgrover50
4 Replies

3. Shell Programming and Scripting

How to enter a password in the script automatically when prompted?

Hi Friends, We need to create a script which will invoke a command with diffrent parameters. The command invoked needs the password. So how automatically we can enter password in the script to the command? example.: #!/bin/ksh for par in `cat parfile` do # Here is the main command... (1 Reply)
Discussion started by: sourabhsharma
1 Replies

4. Shell Programming and Scripting

Script to automatically enter a password

I need to retrieve thousands of lines of information from hundreds of nodes. Each node requires a passowrd in order to retrieve the information. Fortunately, the password is the same for each one of them. So I am trying to come up with a script that would allow me to include the password so I can... (0 Replies)
Discussion started by: Ernst
0 Replies

5. Shell Programming and Scripting

Script to prompt user to enter data

Hi All I have a script that moves files from one dir to another dir based on date, but I would like to change it in a way that whoever is going to run to enter the dates in which files will be removed. This is my script: #!/bin/sh touch -mt 201302250000 /tmp/ref3 touch -mt 201302282359... (14 Replies)
Discussion started by: fretagi
14 Replies

6. Homework & Coursework Questions

Shell Script Password Prompt

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I am trying to write a shell script that prompts the user for the password which is "lux" once the correct password... (4 Replies)
Discussion started by: Emin_Em
4 Replies

7. Shell Programming and Scripting

How to add password prompt between script ?

Hi Team, I need password prompt between this script .i want to need put password manually. Instead of adding password in script . Script pause till input password and resume again. #!/usr/bin/expect set ip spawn telnet $ip expect "login:" send "USR\r" expect "*assword*"... (3 Replies)
Discussion started by: Ganesh Mankar
3 Replies

8. Shell Programming and Scripting

How to automatically enter password in a script?

Hi I'm working with AIX 6.1 I would like to ssh to a server without entering password ( to monitor something) but there's no way to do that by authentication keys, so I need to write a script which can ssh to that server without entering password ( no need to hide passsword in the script, just an... (9 Replies)
Discussion started by: bobochacha29
9 Replies

9. Shell Programming and Scripting

Input password to bash script, save, and enter when needed

I am looking for a way to start a script and have it prompt for a password that will be used later on in the script to SSH to another host and to SFTP. I don't want the password to be hard coded. Below is my script with the actual IP's and usernames removed. #!/usr/bin/expect -f... (2 Replies)
Discussion started by: jbrass
2 Replies

10. Shell Programming and Scripting

Expect script not expecting the password prompt

I have a script that does an SSH into a remote node. It should expect the prompt and send the password. #!/usr/bin/expect set user ; set pass ; spawn ssh $user@E-Internal expect { -re "RSA key fingerprint" {send "yes\r"} timeout... (1 Reply)
Discussion started by: Junaid Subhani
1 Replies
GETPASS(3)						   BSD Library Functions Manual 						GETPASS(3)

NAME
getpass -- get a password LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <pwd.h> #include <unistd.h> char * getpass(const char *prompt); DESCRIPTION
The getpass() function displays a prompt to, and reads in a password from, /dev/tty. If this file is not accessible, getpass() displays the prompt on the standard error output and reads from the standard input. The password may be up to _PASSWORD_LEN (currently 128) characters in length. Any additional characters and the terminating newline charac- ter are discarded. The getpass() function turns off character echoing while reading the password. RETURN VALUES
The getpass() function returns a pointer to the null terminated password. FILES
/dev/tty SEE ALSO
crypt(3), readpassphrase(3) HISTORY
A getpass() function appeared in Version 7 AT&T UNIX. BUGS
The getpass() function leaves its result in an internal static object and returns a pointer to that object. Subsequent calls to getpass() will modify the same object. The calling process should zero the password as soon as possible to avoid leaving the cleartext password visible in the process's address space. Upon receipt of a SIGTSTP, the input buffer will be flushed, so any partially typed password must be retyped when the process continues. BSD
June 4, 1993 BSD
All times are GMT -4. The time now is 07:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy