|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#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 ?
|
| Sponsored Links | ||
|
|
#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. |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
#!/bin/sh
file1=user1@domain2.com:/path/file1.txt (completePath to file1.txt) file2=user1@domain2.com:/path/file2.txt (completePath to file2.txt) files=( ${file1} ${file2} ) scp ${files[@]} /home/path to save files echo done copying I am running this script from user1@domain1.com. 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: Code:
scp user1@domain2.com:/path/file*.txt /home/path or better yet, ssh into the machine domain2.com and then copy from the other side Code:
scp /path/to/files/*.txt user1@host:/home/path |
| Sponsored Links | |
|
|
#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 file1=user1@domain2.com:/path1/file1.txt (completePath to file1.txt) file2=user1@domain2.com:/path2/file2.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 user1@domain1.com:/path1/file1.txt C:\path\Work\domain1 C:\pscp.exe user1@domain2.com:/path2/file2.txt C:\path\Work\domain2 C:\pscp.exe user1@domain3.com:/path3/file3.txt C:\path\Work\domain3 C:\pscp.exe C:\path\Work\domain1\file1.txt user1@domain4.com:/path1 C:\pscp.exe C:\path\Work\domain2\file2.txt user1@domain4.com:/path2 C:\pscp.exe C:\path\Work\domain3\file3.txt user1@domain4.com:/path3 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. |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
You can: 1.) On the source machine create a list of files and stash it into a variable and issue one scp command: Code:
l="" 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. |
| The Following User Says Thank You to mirni For This Useful Post: | ||
RaviTej (06-26-2012) | ||
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Transferring files from Unix to Windows server | koti_rama | Shell Programming and Scripting | 1 | 05-28-2012 02:43 PM |
| Problem while Transferring files to UNIX server | dashing201 | Shell Programming and Scripting | 7 | 12-31-2009 05:15 AM |
| Transferring file from Windows server... | Santhosh_Ind | Shell Programming and Scripting | 1 | 10-14-2009 02:37 AM |
| Transferring files from one AIX server to another AIX server in binary mode | rakeshc.apps | AIX | 4 | 10-01-2009 12:28 PM |
| Transferring files between Windows and AIX | Pennant Man | AIX | 7 | 01-05-2009 09:31 AM |
|
|