0

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.

Ted
  • 248
  • 2
  • 5
  • 16

2 Answers2

0

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
psftp>

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

user9517
  • 115,471
  • 20
  • 215
  • 297
  • 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 Ubuntu...so 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 ? – user9517 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
0

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

Ted
  • 248
  • 2
  • 5
  • 16