Re: Bash script - scp password issues
- From: noi <noi@xxxxxxxx>
- Date: Mon, 15 Jan 2007 21:52:59 GMT
On Mon, 15 Jan 2007 11:26:53 -0800, markrobertstockwell@xxxxxxxxx wrote
this:
I just need the right syntax. I am trying to setup a bash script to copy
everything from one directory to another.
This works:
scp backup@abc-it1:/backup/. .
but the issue is it asks for a password.
This is what I've come up with (it's not working).
Any ideas on what I'm missing?
#!/bin/bash
export userpw=****
scp backup@abc-it1:/backup/. .<<-EOS
user $userpw
quit
EOS
You could try the -B option
but the best method is to create use ssh-keygen to create public keys
without passphrases on each machine. Copy the generated .pub key to the
backup@:~/.ssh folder of each machine as authorized_keys. Then ssh, scp
and rsync -e "ssh " (over ssh) won't ask for passwords or passphrases.
man scp, ssh, ssh-keygen
noi@siam :~> ls -l .ssh
total 20
-rw-r--r-- 1 noi users 402 2006-03-29 23:17 authorized_keys
-rw------- 1 noi users 1655 2005-07-02 18:41 config
-rw------- 1 noi users 1675 2006-08-20 12:44 id_rsa
-rw-r--r-- 1 noi users 408 2006-08-20 12:44 id_rsa.pub
-rw-r--r-- 1 noi users 401 2006-08-19 15:18 known_hosts
.
- References:
- Bash script - scp password issues
- From: markrobertstockwell@xxxxxxxxx
- Bash script - scp password issues
- Prev by Date: Re: Close to giving up on Linux...
- Next by Date: Re: Close to giving up on Linux...
- Previous by thread: Bash script - scp password issues
- Next by thread: Close to giving up on Linux...
- Index(es):
Relevant Pages
|
|