Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

OT: How to copy a remote file to local system through SCP ?

by nayaksan (Initiate)
on Oct 13, 2015 at 18:22 UTC ( #1144733=perlquestion: print w/replies, xml ) Need Help??

nayaksan has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monk,

I want to copy a remote file to my local system through SCP. My remote file is in a path "/apps/wls/csam/output/response/a.xml"

For that i have login into the remote server with boatid and password.

It only allowed me to access any files in "/apps" folder.

But to access the "a.xml". I have to change the user with command "sudo -i -u wls"

then supply the password of wls user. Then only it allowed me to go into "/wls/csam/output/response/a.xml".

So please suggest me a suitable code to copy the a.xml to my local system for the above scenarios.

Regards,

Sanjay

  • Comment on OT: How to copy a remote file to local system through SCP ?

Replies are listed 'Best First'.
Re: OT: How to copy a remote file to local system through SCP ?
by salva (Canon) on Oct 14, 2015 at 06:27 UTC
Re: OT: How to copy a remote file to local system through SCP ?
by u65 (Chaplain) on Oct 13, 2015 at 22:42 UTC

    Welcome, nayaksan!

    The solution to your problem, as I understand it, does not require Perl and you can do several things to solve it. However, if you are a limited sudoer on the remote host, you may not be able to solve the problem at all if you can't copy the file owned by wsl to someplace you as user id can access it.

    Here is what seems the easiest way to me: log on to the remote host, then do whatever it takes to copy the desired file to your home directory there. If and only if that is possible: back on the local host, execute:

    $ scp id@remotehost:filename.suf . # <= note the dot (period)

    and the system should ask for your password and the copy should work.

    Hope that helps.

    -Tom

    Update: I think salva has pointed you in the right direction.

      Hi Tom,

      Thanks for suggestion. In that way, i can copy the remote files to my system. But is there any way so that i can directly copy the files owned by "wls" user to my local system, as i am doing some automation scripts for testing.

      Regards,

      Sanjay

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1144733]
Approved by sundialsvc4
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2021-06-21 03:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (98 votes). Check out past polls.

    Notices?