I am unable make file or directory in Visual Studio Code in Win Subsystem for Linux - visual-studio-code

I use this guide. When I take the step "Add a source code file", I am shown this report:
Unable to write file 'vscode-remote://wsl+ubuntu-20.04/home/alex/TEST/helloworld/helloworld' (NoPermissions (FileSystemError): Error: EACCES: permission denied, open '/home/alex/TEST/helloworld/helloworld')
I don't know what to do, can some one help me?

The VScode needs permissions thus
Try this command on your WSL terminal
sudo chown -R username /path/to/working/directory
Replace :
'username' with your username and the path of your directory

So I had the same problem and changing ownership via sudo chown -R username <path> did not work for me.
Simple solution!
My issue: Downloaded files for coursera project in zip. Copied files to ubuntu home/taylor/projects folder. and then tried accessing in vscode with code . I received the read error.
Solution:
go to your linux terminal.
Access the folder containing the files you are trying to work on.
For Example: app.py forms.py models.py in the projects folder. got to projects folder.
~/projects ls
app.py forms.py moodels.py routes.py
#they should be white meaning know permissions granted.
grant permissions
a. sudo chmod 777 app.py forms.py models.py routes.py
or
b. sudo chmod +rwx app.py forms.py models.py routes.py #r=read w=write x=execute

Try the above one by #uday Pratap, If not Working try this one's :
sudo chmod -R 777 folder_name_where_your_file_exists
or
sudo chmod -R 755 folder_name_where_your_file_exists

Related

VS Code: NoPermissions (FileSystemError): Error: EACCES: permission denied

I'm trying to save a file called app.js on a folder called js.
Vs Code pop up this:
Failed to save 'app.js': Unable to write file 'vscode-remote://wsl+ubuntu-18.04/js/app.js'
(NoPermissions (FileSystemError): Error: EACCES: permission denied, mkdir '/js')
I tried:
sudo chown -R user /mnt/c/Users/myUser/Documents/myFolder/proyectFolder
but I still can't save this file.
Try this, fixed it for me
sudo chown -R username path
Example:
sudo chown -R emanuel /home/emanuel/test/
In the SSH terminal:
Recommended :
sudo chmod -R 777 folder_name_where_your_file_exists
or
sudo chmod -R 755 folder_name_where_your_file_exists
this works for me
sudo chown -R $USER:$USER /home/
TLDR;
If you're using a docker container, avoid making files from within the container because the owner and group permissions may cause problems with your editor (in my case VS Code)
I was running docker container for a Django project from Windows Terminal and using VS Code to edit my code.
It is a Linux file (since everything in Linux is a file) permission problem that arises because the files don't have proper user and/or group permissions. So VS Code tries to tell us that.
The problem I found only happened when I created files from within my docker container.
I would run docker exec ... bash
make new files using touch /path/to/file from the container bash
then try to edit those files on VS Code (say urls.py) only to get the scary permissions error preventing the file from saving.
I suspect that making files from within the container embellishes those files with different owner and group settings than your system would default to if you just ran the commands locally (not in the container).
Changing the file permissions with chown -hR and chgrp -hR would do the trick but to avoid the error altogether I stopped making files from within the container.
Try activating polling:
This worked for me during I tried using wsl.
The below is for individual file:
sudo chown yourUserNAme filename
For an entire directory it will be (when you write ls to terminal, you should see your directory to execute this command):
sudo chown yourUserNAme dirName
For recursive (i.e files and folders inside a folder):
sudo chown -R yourUserNAme dirName
Note: yourUserNAme is, if you do pwd under any Documents, you will see the path: /home/jhon/Documents. Here user is jhon.
Run VS Code as administrator and it will fix the problem.
https://answers.microsoft.com/en-us/windows/forum/all/error-in-vs-code-destination-directory-and-says/e70dc626-6b12-4791-a960-8b704e57098d
Install the extension Save as Root in Remote SSH in VS code.
While saving press Ctrl + Shift + P.
This open the command palette.
Search Save as Root
It is a Linux user permissions problem.
you should use the command:
sudo chown -R $USER:$USER.

I keep getting an error code "unable to write program user data" I can't even open the program visual studio code

It says please make sure the following directories are writable.
/Applications/untitled folder/Library/ApplicationSupport/Code
/Applications/untitled folder/.vscode/extensions
what does it want me to do I am clueless?
Go to C:\Users\Azox and delete .vscode.
Go to C:\Users\Azox\AppData\Roaming and delete Code.
I am leaving this answer here because I had a-lot of trouble with this problem.
Steps:
sudo chown -R username ~/.vscode/extensions
sudo chown -R username ~/Library/Application\ Support/Code
Then you should be able to open vscode from the application folder.
To find out what your username is just type whoami in the terminal.

unable to set up spark notebook getting the no such command error and permission denied errors

I am trying to run spark notebook on my machine and I followed the procedure mentioned in "spark notebook io". During this procedure, I am giving the command bin/spark-notebook, in the terminal, and I am getting
Error: permission denied
and when I am using sudo bin/spark-notebook I am getting
Error: no such command
How can I resolve this issue?
Changing permissions fixed the bin/spark-notebook command for me. Go to the folder containing the parent of the bin folder (I renamed mine sparknotebook). Then execute chmod 755 sparknotebook and you should be able to proceed with cd sparknotebook and bin/spark-notebook should work.
Similar to Ricky, I changed the access permissions, but with the following command worked for me:
chmod +x [name of root directory of the expanded distribution]
I just run
sudo chmod +x bin/spark-notebook
on my macbook air and it works

Nominatim setup.sh permission denied

I followed this tutorial to install Nominatim. The installation procedure was not too complicated until the import process. I keep getting this same error over and over
CREATE FUNCTION
ERROR: could not access file "~/Nominatim/module/nominatim.so": Permission denied
ERROR: pgsql returned with error code (3)
pgsql returned with error code (3)
I tried doing as the tutorial proposed
chmod +x Nominatim
chmod +x Nominatim/module
Still didn't want to work. Got pissed and did chmod -R 777 Nominatim && chown -R user:usergroup. Nothing.
Finally, tried restarting and still nothing.
I am on ubuntu 14.04 using postgresql 9.3 postgis 2.1.
I feel dumb.
The tutorial wasn't clear enough on when to STOP for giving permissions.
In fact, I had to give my whole home folder the permission chmod +x user. They say that all parent require the execute permission but I wasn't about to give +x to my /usr folder.
Anyways. There. chmod +x /usr/user

Using chmod for /usr directory

I used the following command to change the permissions of the usr directory from root
root> chmod -R 777 /usr
Now when I try to use the sudo command it gives the following error:
sudo: must be setuid root
On googling, I found that this error happens if /usr is chowned and I need to reinstall Ubuntu. But am I getting this error for chmod? Is there anyway to fix this problem without reinstalling?
To setuid /usr/bin/sudo: chmod +s /usr/bin/sudo.
But you changed ALL file/directory attributes in /usr recursivly (-R). You really should try some rescue mode. I don't think you'll have any chance to repair it.