Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DSDP - Target Management » Adding sudo command
Adding sudo command [message #24003] Fri, 13 June 2008 16:22 Go to next message
Eclipse UserFriend
Originally posted by: gsmccue.gmail.com

A quick question regarding TM RSE:

I have sudo only access to several servers that I work with. After
developing the code within Eclipse I need to upload files appending 'sudo'
to the front of whatever ssh statement is being executed by the plugin. Is
there any way to accomplish this?

Thanks,
Greg
Re: Adding sudo command [message #24302 is a reply to message #24003] Tue, 01 July 2008 16:49 Go to previous message
Martin Oberhuber is currently offline Martin OberhuberFriend
Messages: 1007
Registered: July 2009
Senior Member
Hi Greg,

I'm not sure if I understand, but you could probably create
a subclass of SshShellSubSystemConfiguration (and register
it by means of the rse.subSystemConfigurations extension
point), in which you do something like this:

public IShellService createShellService(IHost host) {
IShellService origService = super.createShellService(host);
return new MyShellServiceDecorator (origService);
};

class MyShellServiceDecorator extends AbstractShellService {
private IShellService origService;
public MyShellServiceDecorator(IShellService origService) {
this.origService = origService;
}
public IHostShell launchShell(...) {
IHostShell origShell = origService.launchShell(...);
return new MySshHostShell(origShell);
}
...
};

class MyHostShellDecorator implements IHostShell {
private IHostShell origShell;
public MyHostShellDecorator(IHostShell origShell) {
this.origShell = origShell;
}
public boolean isActive() { return origShell.isActive(); }
public void writeToShell(String command) {
origShell.writeToShell("sudo auser "+command);
}
...
};



Note that this basic pattern of decorating original RSE Services
works with any kind of service implementation, not only SSH, so
your HostShellDecorator could also be applied to dstore, telnet, ...
(any contributed) kind of connection.


Let me know if it helps,

Cheers,
--
Martin Oberhuber, Senior Member of Technical Staff, Wind River
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm




Greg McCue wrote:
> A quick question regarding TM RSE:
>
> I have sudo only access to several servers that I work with. After
> developing the code within Eclipse I need to upload files appending
> 'sudo' to the front of whatever ssh statement is being executed by the
> plugin. Is there any way to accomplish this?
> Thanks,
> Greg
>
Re: Adding sudo command [message #575585 is a reply to message #24003] Tue, 01 July 2008 16:49 Go to previous message
Martin Oberhuber is currently offline Martin OberhuberFriend
Messages: 1007
Registered: July 2009
Senior Member
Hi Greg,

I'm not sure if I understand, but you could probably create
a subclass of SshShellSubSystemConfiguration (and register
it by means of the rse.subSystemConfigurations extension
point), in which you do something like this:

public IShellService createShellService(IHost host) {
IShellService origService = super.createShellService(host);
return new MyShellServiceDecorator (origService);
};

class MyShellServiceDecorator extends AbstractShellService {
private IShellService origService;
public MyShellServiceDecorator(IShellService origService) {
this.origService = origService;
}
public IHostShell launchShell(...) {
IHostShell origShell = origService.launchShell(...);
return new MySshHostShell(origShell);
}
...
};

class MyHostShellDecorator implements IHostShell {
private IHostShell origShell;
public MyHostShellDecorator(IHostShell origShell) {
this.origShell = origShell;
}
public boolean isActive() { return origShell.isActive(); }
public void writeToShell(String command) {
origShell.writeToShell("sudo auser "+command);
}
...
};



Note that this basic pattern of decorating original RSE Services
works with any kind of service implementation, not only SSH, so
your HostShellDecorator could also be applied to dstore, telnet, ...
(any contributed) kind of connection.


Let me know if it helps,

Cheers,
--
Martin Oberhuber, Senior Member of Technical Staff, Wind River
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm




Greg McCue wrote:
> A quick question regarding TM RSE:
>
> I have sudo only access to several servers that I work with. After
> developing the code within Eclipse I need to upload files appending
> 'sudo' to the front of whatever ssh statement is being executed by the
> plugin. Is there any way to accomplish this?
> Thanks,
> Greg
>
Previous Topic:Automatic TerminalView Connection
Next Topic:Possible to use SystemRemoteFileDialog/SystemRemoteFolderDialog without RSE open
Goto Forum:
  


Current Time: Wed Apr 24 17:33:50 GMT 2024

Powered by FUDForum. Page generated in 0.02783 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top