LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   sudo copy issue (https://www.linuxquestions.org/questions/linux-newbie-8/sudo-copy-issue-4175450750/)

saikrishnaprasadh 02-19-2013 01:14 AM

sudo copy issue
 
Hi,

I have sudo access in a remote server, i need to get the files files from the remote server using the scp or rsync .. please tell me how to do it.

ps: i cannot copy from the remote server like sudo cp as it has been blocked. i can copy the files only using get method like below

scp username@remoteserver:/var/log/xxx.file /tmplocalserver

can any one point me the correct method ??

RaviTezu 02-19-2013 01:25 AM

Quote:

Originally Posted by saikrishnaprasadh (Post 4894884)

That wont work. i guess!

Login to the remote machine and copy it to the destination:

Let's say you have to copy the file from host A to host B:
The command you should be using this on the host which is having the file(i.e A here)..
Quote:

scp /path_of_file_on_A username@B:/path_on_host_B
You should be having the permissions to copy the file to this path(i.e /path_on_host_B)

sharadchhetri 02-19-2013 01:33 AM

Hello Sai,
I think I read your question and get confused with cp and scp.

Make me correct if I am wrong somewhere
* you can not run cp command in server because of sudo restriction
* you can only do scp to remote machine from your system

So I am pointing the below method on scp command only.

For eg.

Remote File name = remotetest.txt
Local File name - localtest.txt


Remote Machine Name = ServerA

Your machine name = laptop

Now you are here only using your laptop .And will do scp only from your laptop , not from inside of the server


Method (1) ;Login in your laptop (I hope it is linux machine)

to scp a file from your laptop to remote server

scp localtest.txt username@serverA:/path/in/server

eg.

scp localtest.txt user1@ServerA:/opt/


Method (2) Second method you already typed. That was getting file from remote server to your laptop

scp user1@ServerA:/path/remotetest.txt ~/Desktop


All times are GMT -5. The time now is 01:05 AM.