Transferring files from one linux server into another

Thread Tools Search this Thread
# 1  
Transferring files from one linux server into another

Hello , I want to transfer files from one linux server into another , I got it working using SCP command , but I have to type in password for each and every file . All the remote severs have the same password , so is there a way that I can transfer all these files by typing my password only once ?
# 2  
It must be a strange way you run the scp command. Please post it here.
You should need to type in password only once per scp command.
# 3  
#!/bin/sh (completePath to file1.txt) (completePath to file2.txt)

files=( ${file1} ${file2} )

scp ${files[@]} /home/path to save files
echo done copying

I am running this script from I could copy files succesfully but typing the password two times using putty . if there are 10 files , i have to type password 10 times using this script.
# 4  
Don't specify the hosts at every file. Try to glob them together:
scp*.txt  /home/path

or better yet, ssh into the machine and then copy from the other side
scp /path/to/files/*.txt user1@host:/home/path

# 5  
hello mirni , I can not use this script because file1.txt and file2.txt are in different folders. What I am trying to do exactly is , there are logs generated for different applications , so I am trying to copy all the logs into one location .
actually my script is #!/bin/sh (completePath to file1.txt) (completePath to file2.txt)

files=( ${file1} ${file2} )

scp ${files[@]} /home/path3 to save files
echo done copying

---------- Post updated at 04:32 PM ---------- Previous update was at 04:21 PM ----------

currently i am saving the files in my local and then copying into the remote location using batch script. like

C:\pscp.exe C:\path\Work\domain1

C:\pscp.exe C:\path\Work\domain2

C:\pscp.exe C:\path\Work\domain3

C:\pscp.exe C:\path\Work\domain1\file1.txt
C:\pscp.exe C:\path\Work\domain2\file2.txt
C:\pscp.exe C:\path\Work\domain3\file3.txt

I need not type any password here it is preauthenticating using my company' s laptop . Was just wondering , if i can skip the step of saving these files to local and do the transfers directly without having to type password many times.
# 6  
You can:
1.) On the source machine create a list of files and stash it into a variable and issue one scp command:
while read i ; do 
  l="$l $i "
done < mylistOfLogs.lst

scp $l user1@remote.server

The above method won't work if you have too many files.

2.) A cleaner and more universal solution would be to just compress them all into a tarball, then scp one file -- the tarball itself and decompress on the other side. This can easily be done on the fly too.

3.) Another way would be to create one temporary directory on the source machine, and create symlinks to the respective files. Then you can use scp -r, which by default will follow symbolic links. However, using 1) and 3) you will end up with all the copies in one place.

It seems like it would be much easier to generate ssh key and you don't have to worry about how many scp commands you issue.
This User Gave Thanks to mirni For This Post:

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Science: Mathematics
Difficulty: Easy
An equilateral triangle always has every angle measuring 60°.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Transferring files to directories

I have a large number of files with file names of the format iv.epoz.hhe.d.2018.028.000000.sac iv.epoz.hhn.d.2018.028.000000.sac iv.epoz.hhz.d.2018.028.000000.sac iv.epoz.hhe.d.2018.029.000000.sac iv.epoz.hhn.d.2018.029.000000.sac iv.epoz.hhz.d.2018.029.000000.sac... (4 Replies)
Discussion started by: kristinu
4 Replies

2. Shell Programming and Scripting

Copy files from Linux server to Windows server

Hi All, I am generating report in a Linux server and once the report is generated the report(.txt file) needs to be automatically saved in a Windows servers. So i am looking for a script to transfer the file automatically from Linux server to Windows server? Please advise. Thanks... (3 Replies)
Discussion started by: arunmanas
3 Replies

3. Shell Programming and Scripting

Is it possible to create 10GB file in Linux and transferring the file to other remote server

Hi folks, Is it possible to create 10GB file in linux and transferring the file to other remote server? Regards, J (3 Replies)
Discussion started by: scriptscript
3 Replies

4. Shell Programming and Scripting

Script for transferring files

Hi Guys, I have to transfer a few files in my system . The commands to be used are as follows . Will it be possible to send the output of the following in the form of a mail . cd /export/home/teja ls -lrt* mv cp /tmp/ . ls -lrt... (2 Replies)
Discussion started by: Ravi_Teja
2 Replies

5. UNIX for Dummies Questions & Answers

Transferring a file from one UNIX server to another

Hi, Is there a way to transfer a file from one unix server from another without entering the login credentials. I know scp and other commands but it prompts the username/password. However in my script i have a file, who i need to send to another unix server where the content of that file will... (4 Replies)
Discussion started by: gopajitmalakar
4 Replies

6. Shell Programming and Scripting

Copy folder and files from unix server to linux server

We would be migrating unix solaries to Linux redhat. Basically source is unix and target is linux. i would like to copy entire file system unix/source/* to target linux/souce/* but target linux has only folder setup so what ever files copied need to be placed in the linux server with same... (8 Replies)
Discussion started by: balajikalai
8 Replies

7. Shell Programming and Scripting

Transferring files from Unix to Windows server

Hi All, I have to establish as connectivity from Unix server(Solaris) to Windows machine and transfer files. We use public key Private key pair to authenticate from Unix to Unix connectivity to transfer the file. How to establish the sFTP connection from Unix to Windows and transfer the... (1 Reply)
Discussion started by: koti_rama
1 Replies

8. Shell Programming and Scripting

Problem while Transferring files to UNIX server

Hi When I m transferring my file to UNIX server using filezilla , after every line in a file ^M is shown. Because of this ^M I cannot execute my file/scripts Why so ??? Any suggestions... (7 Replies)
Discussion started by: dashing201
7 Replies

9. Shell Programming and Scripting

Transferring file from Windows server...

Hi, I want to transfer html files from windows server to unix server. Those files also have to be assigned proper permissions. Can u people suggest any ideas for this scenario? Regards, (1 Reply)
Discussion started by: Santhosh_Ind
1 Replies

10. AIX

Transferring files from one AIX server to another AIX server in binary mode

Hi, I am a newbie to AIX. We have 2 AIX5.3 servers in our environment, I need to transfer some files in Binary mode from one server to another and some files in ASCII mode from one server to another server. Could you please help me as to how I need to do that? Thanks, Rakesh (4 Replies)
Discussion started by: rakeshc.apps
4 Replies

Featured Tech Videos