1

So I'm running the following command

scp \desktop\myfolder\deployments\myfile.txt user@host:/path/to/whereyouwant/thefile

In an attempt to transfer a file from my local windows 7 machine to a remote server (using putty). This works with the exception that I don't have write permissions to that folder.

So if I do the following... 1) log into server using putty 2) sudo su - myadminuser 3) run scp, how would I use the myadminuser? If I try something like...

scp \desktop\myfolder\deployments\myfile.txt **myadminuser**@host:/path/to/whereyouwant/thefile

The problem is I don't have the myadminuser login.

1
  • I have answered on another posting how you can customize scp do the sudo for you directly. This is similar to what WinSCP does.
    – YoYo
    Sep 2, 2016 at 22:59

1 Answer 1

4

Simple answer:
you can't do that directly.

Extended answer:
Use SCP to transfer the file to a directory where you have write access with that user, then use ssh to move the file with sudo
e.g.: ssh host sudo mv myfile.txt /path/to/the/destination

2

You must log in to answer this question.