Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

backgrounding scp command

Status
Not open for further replies.

SirCharles

Programmer
Jun 10, 2002
212
US
I'd like to start a secure copy and then log out, let the command complete, and come back after dinner to check the status of the command. scp requires that you respond with a password. There is a -B option but the man pages don't say how to use it.
I'd like to be able to do something like this but
doesn't seem to work quite right. I still get prompted
for password. I tried putting this in a script and
backgrounding the script, but still didn't work.

scp -pr * user@ipaddress:/path/to/dir/. <<EOF
password
EOF
 
Your question was not clear.
Do you want to use scp bypass password ?
 
Hi,

You need to create a public/private keypair first, then copy your public key over to the server. If sshd is configured correctly it will use these to verify you.

so on the client machine:

ssh-keygen -t dsa

you then have a file called ~/.ssh/id_dsa.pub

copy this file to the account on the server:

scp ~/.ssh/id_dsa.pub user@ipaddress:/home/user/.ssh/my_id_dsa.pub

then login:

ssh -l user ipaddress

then add your public key to the authorized_keys2 (or authorized_keys depending on version):

i.e.

cd ~/.ssh
cp authorized_keys2 authorized_keys2.old
cat authorized_keys2 my_id_dsa.pub authorized_keys2

then logout and try the scp again. (if authorized_keys2 does not work, try appending to authorized_keys)

Scotty





 
Didn't work. Maybe I'm missing something here. What would be command to put scp in background?
 
try at -f filename now

that should run your script in the background

Norm
 
The problem is not putting the command in the background, but that you are prompted for a password - SSH and SCP allow you to run them without passwords, but you need to have your public key on the target server. Can you give me some more info on why it did not work? Basically if you can SSH to the machine without a password, you should be able to SCP without a password - then it's trivial to background the process.

Did you copy your my_id_dsa.pub to the same user account you are trying the scp with? Also, can you check that the sshd.conf on the target server has the following option:

PubkeyAuthentication no

or for SSH v1:

RSAAuthentication no

If so change it to yes.

Also check if the 'AuthorizedKeysFile' option is set to something else other than the default.

If you are still having trouble, I can give you some short instructions on running a sshd on a different port in debug mode so you can see why it's not authenticating you via the public key.

HTH,
Scott
 
Here is the solution. Thanks for the suggestions, but none of them seemed to work very well. Scotty, you were pretty close and maybe I was just missing the final command, as the information on how to create the key pair was right on.
BTY: Is rsa or dsa preferred when generating keys?

cat .ssh/id_dsa.pub |scp test.send username@host:/home/username/.
 
scp file user@destination:. &

The '&' puts the command into the background.
Use the key swap above to do it without a password.


Surfinbox.com Business Internet Services - National Dialup, DSL, T-1 and more.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top