Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Attempting to use PSFTP to "put" a file from my local Windows 7 machine up to a directory on a remote Ubuntu server with only root access permitted. How do I sudo elevate my PSFTP session to execute the put as root?

The following for i.e. is not supported:

sudo put test.xml

In my preliminary research, it seems the only alternative, which I'd like to shortcut, is to put to my home directory and then mv to the final location via SSH (where I can sudo mv). Or of course logging in as root in the first place which is not at all a viable alternative.

share|improve this question

You don't elevate your windows session to allow the put, you provide root's credentials when connecting to the remote machine

psftp root@remote.tld 
Using Username root
root@remote.tld's password:
Remote Working directory is /root

Now you can navigate around the remote filesystem and put your file wherever yo want. If it's just a single file to a particular remote directory then you could use pscp

pscp yourfile.ext root@remote.tld:/path/to/save

Have a look at the relevant man pages - psftp implements sftp and pscp implements scp

share|improve this answer
Iain, thanks for the response. However, "Or of course logging in as root in the first place which is not at all a viable alternative." – Ted Nov 27 '11 at 19:54
Aside from the fact that we're working with root@remote.tld account never enabled in the first place. All root actions done with sudo or su - for a root shell. Was hoping would have the same possibility with psftp. – Ted Nov 27 '11 at 19:57
Your question also says with only root access permitted so which is it ? – Iain Nov 27 '11 at 20:03
Directory in question permissions are root root. Therefore do not want to login with root account, but rather, elevate as necessary so that write privileges to directory/files belonging to root. That more clear? – Ted Nov 28 '11 at 20:42
In case it's not obvious, PSFTP'ing with account that is in sudoers list. – Ted Nov 28 '11 at 20:49
up vote 0 down vote accepted

Looks like it's not possible which is understandable, but unfortunate.

share|improve this answer

Your Answer


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.