-
Notifications
You must be signed in to change notification settings - Fork 301
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
Save as admin option. #1688
Comments
The root issue is here: microsoft/vscode#48659 |
I suspect this is also applicable to containers and WSL. |
Waiting on this feature badly. Please move this up your priority queue. |
I'd like to request this for SSH as well |
I was referred to this issue since I cannot navigate as sudo after using ssh plugin to connect. Please expedite this issue. Thanks |
Can we get an update on this? It seems to have been silently dropped from #2973. |
Any updates, please? This is one of the most wanted features for system admins. |
Any updates? I really don't want to use |
Another vote up for this. This is super important. Unless using root user, not having this renders remote-ssh almost useless. |
I want to edit a file and save, but always alarm me The reason why i use VSCODE to connect remote machine is to use the code editor, but i can't even save a limited file and no option to save as root, and still need to |
Same issue here 😕 - please update this 👍 |
Here's the workaround microsoft/vscode#48659 (comment) |
Oh do I have the solution for you! Here's how I solved it. Clean, and just works, with no weird modifications or settings. Add an alias to your alias sudocode='SUDO_EDITOR="$(which code) --wait" sudoedit' It's just a wrapper around the built-in So just type By the way, this works locally and also works when you are using SSH, a Dev Container, or WSL. |
@khalidx Brilliant! Reading how |
Useless, can't even click and open a root privleged file when using normal user to SSH connect. |
@piwawa you are probably doing something wrong. What isn't working / is useless? When you are using SSH to connect as a normal user, yes, you can click and open any file. The problem is when you save you won't be able to since VSCode does not support elevating permissions when it comes time to save. This feature is being worked on. Most people are not mounting |
That was rude. Try to remember that it's not always about you and your specific conditions and needs. I say this as someone who occasionally forgets this. |
You say you are altering the behaviour of I think this implies I can't use this approach with my workstation running Windows, is that right? Or perhaps wsl could help? |
@khalidx solution is adding a command to your user profile on the remote server where you are trying to edit files that require elevated permissions as root to edit. So it has nothing to do with the client that is remoting to the linux server. When you ssh into a remote linux host with VS Code, it as if you are logged into the linux terminal. You can be running VS Code from Windows, from Windows WSL, or from another linux box, but you are communicating with and are working in the context of a virtual VS Code service running on the remote host. Hope that clarifies. The assumption is that if you can remote into the server, you have a bash profile you can edit. I suppose possibly in a cloud environment that might not be the case. |
I do have a bash profile I can edit. The reason I thought it implied a Linux workstation is that he's changing sudoedit, and in order to use sudoedit I'd have to do it from my bash prompt. As I understand remote workspaces, vscode runs natively on my workstation and a proxy runs on the remote host. The sudoedit command would be running on the remote host. I think there must be something about this solution that I don't understand. |
Perhaps it's not clear. When you remote into the server, you would open the terminal (e.g. CTL+`) and that is the actual bash prompt from your server that has loaded your '.bashrc' profile with @khalidx nifty 'sudocode' command shortcut that under the covers invokes sudoedit in your terminal session and tells it to use vscode (running on the linux host) as your editor. 'sudoedit' is running on the server, not from your workstation. |
Thanks for clarifying it. I can see why he was so impressed with his own answer. I would be, it's damn clever. Now all I need is a way to allow vscode to browse the file system in folders that need elevation instead of using sudo at a bash prompt. |
A workaround for me was to add the ssh user to the file-owner's group, e.g. |
@Sieboldianus, while this does work, it opens a security vulnerability for any file owned by Instead, it would be preferable (and much more secure) to have the ability to run something like Though, I am still hoping this capability will become native at some point. |
Please allow saving of files as admin, currently it is not possible to edit or create service files unless logged in as root and there is no way to open a file with sudo.
The text was updated successfully, but these errors were encountered: