Remote copy through shellscript


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Remote copy through shellscript
# 1  
Old 09-30-2014
Remote copy through shellscript

I am using RedHat 4.4 Version Operating System.
I want to copy one file from source to destination.I don't want to give a password when I am executing the below shell script.
Code:
code:

#!/bin/bash
scp -r file.zip 192.168.1.5:/root/
Here it asking a password to enter,Is there any way give a password in a shell script.

# 2  
Old 09-30-2014
Quote:
Originally Posted by kannansoft1985
I am using RedHat 4.4 Version Operating System.
I want to copy one file from source to destination.I don't want to give a password when I am executing the below shell script.
Code:
code:
 
#!/bin/bash
scp -r file.zip 192.168.1.5:/root/
Here it asking a password to enter,Is there any way give a password in a shell script.

Hello kannansoft1985,

You can use expect script for same, in that either you can use the password(Which is not one of the best ways) or you can create a file which has password with proper permissions say400 and call it in expect script. Following URL may help you.
Passing arguments to an Expect script as variables

Other way is to use ssh-keygen. You can refer following link for same.
https://blogs.oracle.com/jkini/entry/how_to_scp_scp_and


Thanks,
R. Singh
# 3  
Old 09-30-2014
If you don't want to provide the password (i.e. don't want to do secure copy) then use below command

Code:
cp /net/sourcePath<space>/destPath

Thanks,
Ibadh.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copy from local to remote

Hi I need a advice for writing simple bash script, I have a file pod.txt which contains source location and remote location: /mnt/infile/20141103/701_0001.png/remote/tmp/pk21730/p0330223723074.png /mnt/infile/20141103/203_0001.png/remote/tmp/pk21731/p0330223723081.png and I must copy ... (6 Replies)
Discussion started by: primo102
6 Replies

2. Shell Programming and Scripting

Shellscript to copy music from handy to pc over Android Development Bridge (ADB)

Hi Friends, I want to copy my .mp4 files from a file of my mobile to my pc using the programm adb (Android Development Bridge). My Script: ./copyfiletopc /sdcard/Playtube ~/musik/PlayTube \.mp4 #!/bin/bash # $1 = from dir # $2 = to dir # $3 = search # adb is the... (2 Replies)
Discussion started by: Bergiu
2 Replies

3. UNIX for Advanced & Expert Users

Using remote rsync, but copy locally?

I'm looking to use rsync to compare remote files and to copy the diff to a local directory, rather than transfer over the net. The net connection is not fast enough to transfer these files (~1.8TB) and I'd like to sneakernet them instead. Possible? (4 Replies)
Discussion started by: dfbills
4 Replies

4. Shell Programming and Scripting

Remote Copy Script

Hi All, My first post on the Forums! I've just whipped up a quick script to slightly automate a log file retrieval process for work and to be completely honest my BASH scirpting knownledge is extremely limited as is my understanding of a lot of linux commands. Basically the scripts purpose... (3 Replies)
Discussion started by: effektd
3 Replies

5. Shell Programming and Scripting

Confirming Remote Copy

Hey guys. I'm knocking up a script, a part of which will be copying some pretty large files to some remote servers. With the size of the files I need to make sure that they don't lose any data / corrupt on the way (it's unlikely, but these are business critical). Obviously I could use the... (2 Replies)
Discussion started by: dlam
2 Replies

6. Shell Programming and Scripting

Copy a file on remote servers

Hey Unix Gurus, I'm having trouble in copying a file on 5 different servers, first how can you do it locally (i.e without the need to ssh to the server you want to copy the file) and if you need to ssh how do u run a command within that server. Please see my code below(it doesn't work somehow).... (10 Replies)
Discussion started by: sexyTrojan
10 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. Solaris

scp - copy between two remote machines?

1. scp person1@10.10.10.1:file1 person2@10.10.10.2:file1 2. scp file1 person1@10.10.10.1:file1 For #1, I keep getting this error: Password: Host key verification failed. lost connection I have entered the correct password too! #2 works fine. I suppose I cannot copy a file between two... (6 Replies)
Discussion started by: kungpow
6 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