Copy a file on remote servers


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Copy a file on remote servers
# 8  
Old 11-28-2009
Or you can just use a list:
Code:
for i in serverA serverB serverC serverD serverE; do
  ssh -1 $i "echo `pwd`"
done

# 9  
Old 11-28-2009
I was going to suggest what Scrutinizer suggested, but he beat me too it. Smilie

Quote:
Originally Posted by sexyTrojan
I have generate public and private keys and copy pub key to remote servers yet i'm still prompted for password.
Are you using keychain? It's available in the repositories of most Linux distros.

With it, I am prompted for my passphrase the first time I login after a reboot of my local machine. It keeps a process running, even if I logout, that maintains the passphrase in memory. Then when I use ssh or scp (even via cron when logged out) the keychain process supplies the passphrase. It's as safe as your local login.
# 10  
Old 11-29-2009
Either loops work, the problem is ssh-ing to the servers itself. I can ssh serverB on the command line without being prompted for a password. However when i use the script to do it, i'm being prompted for a password and i don't know the password to access these servers. Do you think i should add the known host on remote server ? I'm not using keychain -- I don't even know the passpharase of the existing keys. What should i do?
# 11  
Old 11-29-2009
Quote:
Originally Posted by sexyTrojan
... i don't know the password to access these servers. ... I don't even know the passpharase of the existing keys. What should i do?
If you don't know either the password or the SSH passphrase for any username on the servers, one wonders if you should be attempting this. If you are doing something that you are supposed to be doing, then you should reasonably demand the access you need to do it.

The way to get SSH to work without a password is to append your public key from the local machine to the ~/.ssh/authorized_keys file on the remote machine. When the known_hosts file give me trouble, I delete it and it starts over.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Diff on remote servers file systems

Iam trying to compare two file systems on two hosts basically to check them to be in sync I dont have rsync so trying to use diff Let me know how to do it.... Thanks (3 Replies)
Discussion started by: baanprog
3 Replies

2. Shell Programming and Scripting

Script to overwrite & before that keep copy a file on many servers

I have ssh password less auth enable & script does the job well as well #/bin/bash for i in `cat ip` do scp /etc/resolv.conf root@$ip done But I need to take backup of the file i will overwrite .. is there any simple way ? Kindly respond (5 Replies)
Discussion started by: heman96
5 Replies

3. Shell Programming and Scripting

shell script to take input from a text file and perform check on each servers and copy files

HI all, I want to script where all the server names will be in a text file like server1 server2 server3 . and the script should take servernames from a text file and perform copy of files if the files are not present on those servers.after which it should take next servername till the end of... (0 Replies)
Discussion started by: joseph.dmello
0 Replies

4. Shell Programming and Scripting

Append Text To Remote Servers File Via SSH

Gentleman & Ladies, Please make me feel like and novice and explain why this is not working? I am attempting to ssh to a remote server via ssh and keys. I want to inject a file on the remote server with text. I am not achieving this. I would like to echo/inject the text on the remote... (1 Reply)
Discussion started by: abacus
1 Replies

5. Shell Programming and Scripting

update a common file in different/remote servers

Dear All, I need to update a common file (ie. same path and same filename) but located in different servers. (ie. remotely located ~ able to ssh from my server). Can someone help me how to go ahead with this? (Since I'm manually editing that file in 20 servers :() (1 Reply)
Discussion started by: techychap
1 Replies

6. Shell Programming and Scripting

unix shell script which inserts some records into a file located in remote servers...

All, I need to write an unix shell script which inserts some records into a file located in remote servers. * Get the input from the user and insert according the first row. It should be in ascending order. 123451,XA,ABA 123452,XB,ABB 123453,XC,ABC 123455,XE,ABE 123456,XF,ABF 123458,XG,ABG... (2 Replies)
Discussion started by: techychap
2 Replies

7. Shell Programming and Scripting

Copy a file on remote server

I have ssh keys setup and running properly between two servers. I have a Korn shell script that is logging into the remote server and needs to backup the authorized_keys and/or authorized_keys2 files. The following syntax works perfectly ------------------------------------- ssh... (1 Reply)
Discussion started by: sunsysadm2003
1 Replies

8. Shell Programming and Scripting

restore mysql dump file in many remote servers?

Hi all, I want to restore DB file in many mysql servers, i already using script for sending the dumpfile in all servers, but it's just annoying if i have to restore the dumpfile in all servers, i want just execute 1 script, and will restore in all remote mysql servers. I make script but not... (2 Replies)
Discussion started by: blesets
2 Replies

9. HP-UX

help me to copy remote file

I want to copy dump generated from oracle database to my local DAT drive. Currently I am copying remote file to local drive thru rcp command and later copy it to local DAT. Pls. help me in this. Thanks Man Mohan email address removed (8 Replies)
Discussion started by: manmohan73
8 Replies

10. UNIX for Dummies Questions & Answers

Remote file copy

I facing a problem with Unix command "rcp". I unable to perform a rcp between host machines. I have religiously followed the man pages, but still unable to solve the problem. Do i check for anything to perform this command? Pls help....thanks =) (3 Replies)
Discussion started by: lchunl
3 Replies
Login or Register to Ask a Question