I can do it with scp if I code it the hard way, using ChannelExec instead of 
ChannelSftp, by inserting sudo before any calls.I was hoping to use ChannelSftp 
since the code is much cleaner. Anyone know how to insert sudo into the sftp 
calls?

> Date: Sun, 3 Apr 2011 03:22:25 +0200
> From: paul-eberm...@gmx.de
> To: jsch-users@lists.sourceforge.net
> CC: dwr...@hotmail.com
> Subject: Re: [JSch-users] sudo su -
> 
> bob manc skribis:
> 
> > I am trying to use jsch to scp or sftp files to and from my ubuntu
> > server. I have to login as ubuntu but want to do a 'sudo su -'
> > command so I can overwrite files owned by root.Is there a way to do
> > this on a session that will allow me to be root on subsequent calls?
> 
> The command
> 
>   sudo su -
> 
> is not a command which is executed once and then leaves the current
> session in a "root" state, but it simply spawns a new shell in root mode
> - when you exit this shell, you are back in your original non-root shell.
> 
> So we would have to execute the server part of scp or sftp inside this
> shell, and speak to it in the same channel as the shell.
> 
> Maybe using a tunneled sftp (with the -S and/or -s options) could help
> here. Or simply '-s sudo sftp-server' or similar? (Doesn't work this
> simple, it seems.)
> 
> I don't even have an idea how to do this with normal ssh, even less with
> JSch, sorry. But maybe this helps that you (or someone else) finds some
> ideas.
> 
> 
> Paul
> 
                                          
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to