Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: new option "executeCommand" #5

Closed
Eichhorst opened this issue Oct 31, 2019 · 7 comments
Closed

Feature request: new option "executeCommand" #5

Eichhorst opened this issue Oct 31, 2019 · 7 comments

Comments

@Eichhorst
Copy link

If executeCommand is specified, it is executed on the remote host on login.

@thingalon
Copy link
Owner

Hi @Eichhorst.

What kind of commands are you thinking of executing? Something that sets up stuff and exits quickly (eg: a .profile-like command), or something that runs continuously while Pony SSH is connected to the host?

I want to understand the use-case before designing new features.

@Eichhorst
Copy link
Author

Eichhorst commented Nov 10, 2019 via email

@thingalon
Copy link
Owner

thingalon commented Nov 18, 2019

Hi Tom. Apologies for the slow response.

I've been thinking about how best to implement this. Pony-ssh uses ssh exec multiple times when setting up a session, so calling sudo -i once on connection won't do the trick.

I've prepared a new update which allows you to specify a custom shell command; which will allow you to call sudo automatically with a config like this:

 "ponyssh.hosts": {
    "example-sudo": {
       "host": "example.com",
       "username": "my-login",
       "agent": true,
       "shell": "sudo sh -c"
    }
  }

With the above setup, pony-ssh would allow you to edit any files that you can via sudo - though it does require that your user can sudo without using a password on the remote host.

Before I roll this out and turn it into a new version, I wanted to check in with you if this sounds like it could solve your problem.

#6

@Eichhorst
Copy link
Author

Eichhorst commented Nov 18, 2019 via email

@thingalon
Copy link
Owner

I've just released an update to Pony-SSH which will hopefully meet your needs. try adding the following to your configuration:
"shell": "sudo bash -c"

Don't use the -i parameter; it will kick off an interactive shell, which won't work with pony-ssh. :)

Hope this helps you out. Let me know if you run into trouble.

@Eichhorst
Copy link
Author

Eichhorst commented Nov 25, 2019 via email

@thingalon
Copy link
Owner

👍 Glad I could help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants