Skip to content

Elevate rights on SSH remote #390

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

Closed
peterkappelt opened this issue May 20, 2019 · 5 comments
Closed

Elevate rights on SSH remote #390

peterkappelt opened this issue May 20, 2019 · 5 comments
Assignees
Labels
feature-request Request for new features or functionality ssh Issue in vscode-remote SSH

Comments

@peterkappelt
Copy link

Hi,
this is more of a quick thought I have, but not a good idea for implementation yet.

Following scenario, I think it is quite typical:

  • Remote server with SSH enabled. Root login is disabled for security reasons
  • I can login with a generic account (let it call operator) that has the right to do sudo/ su
  • I want to edit configuration files (/etc/*), of course this is only allowed by root

I'm thinking of some possibility to elevate the permissions of the file explorer/ text editor of Code, so that I log in using operator over SSH, but Code runs elevated as root through sudo.

However, I currently have no idea what the proper implementation could be for that.

It would be quite useful for administration purposes.

@egamma egamma added feature-request Request for new features or functionality ssh Issue in vscode-remote SSH labels May 21, 2019
@roblourens
Copy link
Member

In a local window, if you try to save a file that the user doesn't have permissions to edit, vscode will prompt to retry with sudo. I assume the same works in a remote window. Have you tried?

@roblourens roblourens added the info-needed Issue requires more information from poster label May 21, 2019
@peterkappelt
Copy link
Author

Hi,

no - unfortunately not. At least not in VS Code for Windows (1.35.0-insider) being connected to an SSH remote.

I tried saving a generic file to a directory without the necessary permissions:
Unable to write file (NoPermissions (FileSystemError): Error: EACCES: permission denied, open '/etc/test-config/vscode-test.file')

I'm going to retry it on a Linux machine later. To be honest, I didn't event known about the existence of this feature for local environments 🤔

@roblourens roblourens removed the info-needed Issue requires more information from poster label May 22, 2019
@TrevorSayre
Copy link

TrevorSayre commented May 27, 2019

I am mainly wanting this so I can edit files in /etc/nginx

When I edit a config file in, for example, /etc/nginx/sites-available and attempt to save, I get the error:

Failed to save 'example': Unable to write file (NoPermissions (FileSystemError): Error: EACCES: permission denied, open '/etc/nginx/sites-available/example')

I am given the options to Retry, Save As..., or Discard with no obvious way to elevate permissions.

I am able to code-insiders /etc/nginx, but I am NOT able to sudo code-insiders /etc/nginx in an attempt to open an elevated permissions editor session as it says sudo: code-insiders: command not found which makes sense.

@egamma
Copy link
Member

egamma commented May 28, 2019

@bpasero should elevation work in a remote context?

@bpasero
Copy link
Member

bpasero commented May 28, 2019

No.

Duplicate of microsoft/vscode#48659

@bpasero bpasero closed this as completed May 28, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Jul 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

5 participants