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.

migrated from serverfault.com Jan 23 '12 at 23:13

This question came from our site for system and network administrators.

  • 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 '16 at 22:59

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy