Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Insufficient permissions in vscode

How do I resolve the vs code Insufficient permission issue when saving a file

I've given appropriate permissions to code directory: chown -R me:staff my-app/

But when I open vscode and try to save a file it says "Insufficient permissions, Retry as admin"

If I launch vscode with sudo from cmd line sudo code . then I dont get that error but then the autocompletion extensions dont seem to work

like image 797
Angad Dubey Avatar asked Aug 03 '18 14:08

Angad Dubey


4 Answers

Change the permission level of your project directory, for example:

sudo chmod -R 777 testproject
like image 55
J.S. Peterson Avatar answered Oct 16 '22 09:10

J.S. Peterson


Try this code:

sudo chown -R username directory_name

where,

  • username is the username of the user of the laptop you want to give access for
  • directory_name is the name of the directory whose permissions you want to change
like image 20
Mohit Sinha Avatar answered Oct 16 '22 08:10

Mohit Sinha


Try with the below command(For linux/mac)

sudo chown -R abhinav-kumar my-app

Let’s break this down.

  • sudo – admin rights must be used since we are dealing with a folder that belongs to another user

  • chown – the command for changing ownership

  • -R – the recursive switch to make sure all child objects get the same ownership changes

  • abhinav-kumar – the new owner of the folder

  • my-app – the directory to be modified
like image 19
abhinav kumar Avatar answered Oct 16 '22 08:10

abhinav kumar


Should I give you a fish? Nope.. that's is not right at all! I should teach you how to fish and it'll save you for a lifetime.

Dear anyone, the issue is all about access permission to that directory or even file sometimes. So you need to use chmod command to change access permission and we normally use access codes which work as a combination of three octal digits (0-7).

The three chmod codes set permissions for these three groups in this order:

 1. Owner (you)
 2. Group (a group of other users that you set up)
 3. World (anyone else browsing around on the file system)

Each digit of this code sets permissions for one of these groups as follows. Read is 4. Write is 2. Execute is 1.

The sums of these numbers give combinations of these permissions:

0 = no permissions whatsoever; this person cannot read, write, or execute the file
1 = execute only
2 = write only
3 = write and execute (1+2)
4 = read only
5 = read and execute (4+1)
6 = read and write (4+2)
7 = read and write and execute (4+2+1)

Read more from this article

Hence, in your case you could try running sudo chmod 777 folder-name which I'm sure it's gonna work! But... It's not safe for use!!! keep it away from the reach of yourself! IT'S A RISK!..

I would suggest to try 755 to make it work. Or something different since you now understand what you're doing! (I mean to fish!)

like image 10
dilungasr Avatar answered Oct 16 '22 09:10

dilungasr