Adding sudo command [message #24003] |
Fri, 13 June 2008 12:22  |
Eclipse User |
|
|
|
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 12:49  |
Eclipse User |
|
|
|
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 12:49  |
Eclipse User |
|
|
|
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
>
|
|
|
Powered by
FUDForum. Page generated in 0.03255 seconds