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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automating scp?

Status
Not open for further replies.
Sep 18, 2002
31
US
Hello,

Does anyone know if it's possible to automate the use of scp in a script? I'd like to be able to write a quick script that the user could call like:
Code:
 "cpfile $1"
where the user specifies the filename that they'd like to copy over. (I know that I can do the same thing with ftp, but I'd prefer to use scp.) I've tried using
Code:
 scp -B -f"$1" dest:/path/to/file
but it returns
Code:
scp: illegal option -- 0
usage: scp [-pqrvBC46] [-F config] [-S program] [-P port]
           [-c cipher] [-i identity] [-o option]
           [[user@]host1:]file1 [...] [[user@]host2:]file2

Also, is it possible to tell it which user I'd like it to log in as? I didn't see any option for that in the man page...

Thanks in advance,

T.
 

scp: illegal option -- 0
usage: scp [-pqrvBC46] [-F config] [-S program] [-P port]
[-c cipher] [-i identity] [-o option]
[[user@]host1:]file1 [...] [[user@]host2:]file2

Don't know where you got the '-f' option from but do like this:

scp -B "$1" dest:/path/to/file

The login name can be done as the usage suggests like:

scp -B "$1" myuser@dest:/path/to/file

Cheers

Henrik Morsing
Certified AIX 4.3 Systems Administration
& p690 Technical Support
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top