Need SCP script equivalent to FTP script .


 
Thread Tools Search this Thread
Operating Systems Linux Need SCP script equivalent to FTP script .
# 1  
Old 11-17-2009
Need SCP script equivalent to FTP script .

Hi,

Currently i'm using the folllowing FTP acript and its working.

echo "open $server" > ftp_file
echo "user $user $password" >> ftp_file
echo "cd $remote_dir" >> ftp_file
echo "lcd $local_dir" >> ftp_file
echo "put $file">> ftp_file
echo "bye" >> ftp_file
ftp -nv < ftp_file

I've been asked to replace ftp script with scp or any other file transfer methods.
I've tried scp method , but its prompting for password. i'm not not able to hardcode password in script. Please help me in this regard.

Thanks.
# 2  
Old 11-20-2009
If you are allowed, you can do an ssh key exchange for a user. Then you will not be prompted for a password, but scp does not use the same command syntax as ftp. sftp uses a similar one to ftp but both would benefit from a key exchange.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

awk script Equivalent .

Hello. I wrote some code for an awk command but I want to learn to turn it into an awk script but am stuck. I have a file (data.csv) that has the following data: ADD,1,3,5,8,10,11,54 SUB,1,2,3,4 ADD,15,18,21,42,37 ADD,1,1,1,0,0,3,16 ADD,4,1,8,0,4,6,13,16,17,20,8,6,4 SUB,13,8If the line... (5 Replies)
Discussion started by: Eric7giants
5 Replies

2. Shell Programming and Scripting

Script using scp

Hello, I am an student trying to make his final project and I wanna make a script to transfer a file using scp. The problem is that I need that executes when the computer starts (before session login), Ive tried this, if I execute it when im logged in it works, but not when the computer starts: ... (9 Replies)
Discussion started by: ohmigod
9 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. Shell Programming and Scripting

Sftp equivalent to ftp -n

Hi all. I can put ftp command in shell script together with the password using ftp -n 10.1.2.34 << EOF user userid password cd /test_dir/ prompt bin get filename.txt EOF But the -n option is not available for sftp. What alternatives do I have then to bypass the password prompt? ... (6 Replies)
Discussion started by: aimy
6 Replies

5. Shell Programming and Scripting

Using SCP in a script

I need to use scp command in a script, and it should not prompt me for the password. for eg: scp $a <i.p address>: After executing this it is asking the password for that ip address. Is to possible to prevent it ?..ie initialising the password initially or somthing lik tha? (5 Replies)
Discussion started by: sandy88
5 Replies

6. Shell Programming and Scripting

scp script help

need help on this scenario: serverA:" Under /etc there are directories like 20090908 20090909 20090910 etc.. a. I like to go to 20090909 (for example) and look for filename.. Say abx.* files.. b. I will scp this to another server 9serverB and the directory should be like this... (4 Replies)
Discussion started by: lhareigh890
4 Replies

7. Shell Programming and Scripting

Bash Script equivalent KSH script?

I always find BASH easier than ksh. At my home, i have written this bash script. I am finding it hard to write its equivalent in ksh, any suggestions? ###################################### #return seconds since `00:00:00 1970-01-01 UTC' (a GNU extension)... (1 Reply)
Discussion started by: boy18nj
1 Replies

8. Shell Programming and Scripting

shell script equivalent for tcl function

Hello, I need experts help in converting the below tcl function to korn shell function equivalent. proc lsNetMaskToBits {mask} { set dw ; # Top N bits set set dw 0x ; # Make sure it's hexadecimal, else XOR fails. puts "lsNetMaskToBits dw $dw" set dw ; # Complement => low 32-N bits... (1 Reply)
Discussion started by: JackMelson
1 Replies

9. Shell Programming and Scripting

awk equivalent script

Hi All, I need a script that prints a blank line after finding that the next lines first field doesn't match the current lines first field. I really want to do this in awk to improve my own knowledge but the best I can come up with is a bash script. I'd finally like to understand how awk... (10 Replies)
Discussion started by: pondlife
10 Replies

10. Shell Programming and Scripting

Modify FTP script to have SCP

Hi, I have an existing FTP script and I am trying to modify this to do SCP rather than FTP. I checked the man help in SCP and still having a hard time doing this... Current FTP script.. ftp -n << EOF > $LOG_FILE verbose open ${SERVER} $LOGON cd ${REMOTE_FILE_PATH} get... (2 Replies)
Discussion started by: madhunk
2 Replies
Login or Register to Ask a Question