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

Permission Denied While Editing Files on a Romote Device #8269

Closed
mfatih7 opened this issue Mar 25, 2023 · 7 comments
Closed

Permission Denied While Editing Files on a Romote Device #8269

mfatih7 opened this issue Mar 25, 2023 · 7 comments
Assignees
Labels
info-needed Issue requires more information from poster ssh Issue in vscode-remote SSH

Comments

@mfatih7
Copy link

mfatih7 commented Mar 25, 2023

Hello

I am trying to use VS Code and Remote Explorer extension to connect to Virtual Machine on the Google Cloud Platform.
After I connect to the Virtual Machine I try to edit files on the Virtual Machine with VSCode File Explorer.
While saving the file I get the error below.

image

How can I do all of my operations on the remote device as sudo user?

@github-actions github-actions bot added the ssh Issue in vscode-remote SSH label Mar 25, 2023
@mfatih7 mfatih7 changed the title Permission Denied While Editing A Romote Device Permission Denied While Editing Files on a Romote Device Mar 26, 2023
@eleanorjboyd
Copy link
Member

If you connect via the terminal to this remote on the same user and then try and edit this file does that work successfully?

@eleanorjboyd eleanorjboyd self-assigned this Mar 29, 2023
@mfatih7
Copy link
Author

mfatih7 commented Mar 29, 2023

@eleanorjboyd
Thank you for the answer.

If I connect to Virtual Machine via terminal and use Vim to edit files as sudo user I can edit files without any problem.

@eleanorjboyd
Copy link
Member

Do you think it is the same as this issue here? #8060

@bpasero any thoughts on the permissions here? Same for issue 8060 we were struggling for a next direction regarding the file permissions not working.

@bpasero
Copy link
Member

bpasero commented Apr 1, 2023

Does the node.js server process run under the same user as the terminal? Because in the end the file will be written to on behalf of the server node.js process. We use fs.writeFile and variants for writing in node.js.

@roblourens
Copy link
Member

@mfatih7 do you use a workflow where you change users when connecting manually to this remote (connect as user1, edit files as user2)? That scenario may not work properly here.

You can check this by opening a terminal in the Remote-SSH window and checking whether you are the same user as when connecting manually. Please also check whether you can edit the file with vim in the Remote-SSH vscode terminal as well.

@roblourens roblourens added the info-needed Issue requires more information from poster label Apr 4, 2023
@mfatih7
Copy link
Author

mfatih7 commented Apr 4, 2023

@roblourens

Thank you for the answer

I do not change users.
I open vscode on my local machine.
I click Remote Explorer Extension icon on the left.
I select a virtual machine and open it in current window or in new window.
After I connect to virtual machine I open a terminal in vscode
If I use vim to edit files without sudo user I get the readonly file error.
If I use vim to edit files with sudo user I can edit without any error.
But if I open the file in the editor of vscode and make some changes to the file I get the error that I mention at the beginning of this issue.

Somehow vscode editor does not have sudo privileges while editing files.
If you want to see the situation visually I can show it if we set up a shared session.

@roblourens
Copy link
Member

Thanks for the clear explanation. We don't support this scenario currently. This is tracked in either microsoft/vscode#48659 or #690

@github-actions github-actions bot locked and limited conversation to collaborators May 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

4 participants