Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a centos server lets say with ip: 1.2.3.4. I want to download a file from 1.2.3.4 at path /root/pc/filename.rar to my localhost host (current pc). What command I need to download that file? I am trying like this but its not working

scp root@1.2.3.4:/root/pcfilename.rar

I want to download that file into my system current directory.

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

Just add where you want it to be copied to (ie: ./):

scp root@1.2.3.4:/root/pcfilename.rar ./
share|improve this answer
add comment

First of all, make sure that the root user is really needed to access the file. If the file can be retrieved by a normal user, that would be preferred to limit the security risks.

If root is really required, make sure that root is actually allowed to login by ssh by checking your /etc/ssh/sshd_config file and see if the PermitRootLogin option is set to yes.

Finally, your command above should work when you add a . (pointing to your current dir) behind it, like so:

scp root@1.2.3.4:/root/pcfilename.rar .

Or you can always use a full path as well:

scp root@1.2.3.4:/root/pcfilename.rar /home/user/pcfilename.rar
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.