save files on aws ec2 with vscode

34 Views Asked by At

I can not save files in EC2 while editing on Vs-Code.

I am connecting to my EC2 using Vs-code. The host username is ubuntu in my Vs-Code configuration file. For example, if I am editing a file and then save it with Ctrl+S, I will get an error that says:

"Failed to save 'test.txt': Unable to write file 'vscode-remote://ssh-remote+my-server/home/ubuntu/test.txt' (NoPermissions (FileSystemError): Error: EACCES: permission denied, open '/home/ubuntu/test.txt')".

If I type "chown -R ubuntu /home/ubuntu" as root, it will save whatever I want, but it is really annoying to type this command on every connection.

I have no problem downloading files or copying them somewhere. The only problem is during editing in the Vs-Code window.

0

There are 0 best solutions below