Visit Our UNIX and Linux User Community

Script should wait for password while doing scp

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script should wait for password while doing scp
# 1  
Old 06-01-2012
Script should wait for password while doing scp

Hi team,

need help on this :- trying to scp a file from A ( it could any server among hundreds not one) server to B server ( fixed ) . The script runs in a third server CFGEngine server.

a. we dont use static password ( its pin + rsa token) so , "here documents" kind of thing is not possible

b. the source server can vary from hundreds of them, so ssh key option is also ruled out.

code :-

ssh  A  'scp  /var/dump/sessions/dump.tgz gsharma@B:/tmp/ '

I want the bash script to wait for password .
# 2  
Old 06-01-2012
You can use expect to interact with scp
# 3  
Old 06-02-2012
not sure how will I incorporate expect script in bash script.

p.s. I dont have static password, every time the pin + password combination would be different. so problem is to accept password from keyboard.

# 4  
Old 06-02-2012
I think you just need to add "-t" or "-tt" option to your ssh command.

Previous Thread | Next Thread
Test Your Knowledge in Computers #999
Difficulty: Easy
The trusted computing base (TCB) of a computer system is the set of all hardware, firmware, and/or software components that are critical to its security.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to scp every minute with plain password

Hello, I have a Solaris x86 server. I am installing patch cluster on that. Out of so many patches, any one patch is breaking its LDAP authentication and I am not able to figure out, which one is that. I have restored server and planning to apply that patch cluster again. To figure that patch, I... (0 Replies)
Discussion started by: ron323232
0 Replies

2. UNIX for Beginners Questions & Answers

scp without password

Hello experts, OS : CentOS Could you please help me with the following scenario : I wish to use scp command in order to copy a file (say : f1.txt) from server 2 to server 1. Both servers have a common user (say : user1) configured. Also, the file is owned by the same user on both... (2 Replies)
Discussion started by: H squared
2 Replies

3. Shell Programming and Scripting

SFTP or scp with password in a batch script without using SSH keys and expect script

Dear All, I have a requirement where I have to SFTP or SCP a file in a batch script. Unfortunately, the destination server setup is such that it doesn't allow for shell command line login. So, I am not able to set up SSH keys. My source server is having issues with Expect. So, unable to use... (5 Replies)
Discussion started by: ss112233
5 Replies

4. Linux

Regarding scp with out password

Dear all, I have two servers A and B. I want to do scp with out password between these two servers. I created ssh-keygen and copied the file to each of them in authorized_keys. But I could login only from B to A with out password. From A to B it is asking for a password. ... (5 Replies)
Discussion started by: jegaraman
5 Replies

5. Shell Programming and Scripting

calling a shell script in background and wait using "wait" in while loop

Hi, I am facing a strange issue, when i call a script from my while loop in background it doesnt go in background, despite the wait i put below the whil loop it goes forward even before the process put in background is completed. cat abc.txt | while read -u4 line do #if line contains #... (2 Replies)
Discussion started by: mihirvora16
2 Replies

6. UNIX for Advanced & Expert Users

scp without prompting for password

I am trying to copy a file from remote machine using scp. I followed the steps to configure public/private key usage. But still prompting for password when I do ssh. I did the following steps to configure scp without asking password Step 1 : local host > ssh-keygen -t rsa and when prompted... (9 Replies)
Discussion started by: satish@123
9 Replies

7. UNIX for Advanced & Expert Users

Automated SCP script passing password to preserve source file timestamp

Hi My requirement is i want to copy files from remote server to the local server and also i need to preserve the timestamp of the remote file. By using scp -p , it is working fine in the interactive call but it is not preserving he file timestamp when i use it in the non interactive scp call... (1 Reply)
Discussion started by: skumar75
1 Replies

8. Red Hat

sftp/scp without password

Hi, I want to use sftp/scp without password.How can I do that ?? I plan to use script with scp/sftp and execute by cronjob ,any sample or example?? How can I test the scp/sftp working or not in the same user account , in the same red linux server?? any suggestion ??? (5 Replies)
Discussion started by: chuikingman
5 Replies

9. HP-UX

sftp/scp/ssh script with password as authentication

Hello, Do you guys know set of commands that can incorporate to sftp/scp/ssh to add password in a script to automate file transfer. Our client is not using ssh keys authentication so we are force to create a script to pass the password into the script to transfer files via sftp/scp/ssh. We... (4 Replies)
Discussion started by: james_falco
4 Replies

10. UNIX for Advanced & Expert Users

scp without password

Hi, when I use scp test.jsp user@remote:/tmp/ I'm prompted user@remote's password: How can I avoid it ? Thank you. (8 Replies)
Discussion started by: big123456
8 Replies

Featured Tech Videos