You are not logged in.

#1 2019-11-08 19:15:52

Anonymous-User
Member
Registered: 2019-10-29
Posts: 10

How to save files with Visual Studio Code?

Hey. How to give permission for VSC to make it able to save files? When I try to save anything I've got this error:

Unable to write file (NoPermissions (FileSystemError:) Error: EACESS: permission denied, open '/home/user/Desktop/Programs/Untitled-1')

Offline

#2 2019-11-08 21:44:43

xerxes_
Member
Registered: 2018-04-29
Posts: 101

Re: How to save files with Visual Studio Code?

That's weird. What is output of commands:

ls -l /home/user/Desktop/Programs/
ls -ld /home/user/Desktop/Programs/
lsattr /home/user/Desktop/Programs/

I assume you trying this as 'user'.

Offline

#3 2019-11-09 10:12:01

Anonymous-User
Member
Registered: 2019-10-29
Posts: 10

Re: How to save files with Visual Studio Code?

xerxes_ wrote:

That's weird. What is output of commands:

ls -l /home/user/Desktop/Programs/
ls -ld /home/user/Desktop/Programs/
lsattr /home/user/Desktop/Programs/

I assume you trying this as 'user'.

When I try run it as root it's showing that it's not good idea to run it as super user. (

You are trying to start vscode as a super user which is not recommended. If you really want to, you must specify an alternate user data directory using the --user-data-dir argument

)

ls -l shows: total 0
ls -ld shows: drwxr-xr-x 2 root root 4096 Nov 8 19:55 /home/user/Desktop/Programs
lsattr shows: nothing

Last edited by Anonymous-User (2019-11-09 10:14:09)

Offline

#4 2019-11-09 10:53:17

xerxes_
Member
Registered: 2018-04-29
Posts: 101

Re: How to save files with Visual Studio Code?

So now it's everything clear. You have to run VSC as normal user (user), not as root (unless you run as root with parameter 'code --user-data-dir /root' from terminal every time when run as root).

But first, to run as ordinary 'user', you have to change of ownership to program directory by command (as root or with sudo):

chown user:user /home/user/Desktop/Programs/

By the way why do you run VSC as root? It is not good to run programs as admin (root) and work as admin user unless it is needed.

And it looks like you don't know much about permissions and groups. Write in terminal and read 'man chmod' and 'man chown'. Press h for help when reading manual (man).

It was simple, so you better start learning, reading documentation or you will have trouble.

Last edited by xerxes_ (2019-11-09 11:12:52)

Offline

#5 2019-11-09 11:19:13

Anonymous-User
Member
Registered: 2019-10-29
Posts: 10

Re: How to save files with Visual Studio Code?

xerxes_ wrote:

So now it's everything clear. You have to run VSC as normal user (user), not as root (unless you run as root with parameter 'code --user-data-dir /root' from terminal every time when run as root).

But first, to run as ordinary 'user', you have to change of ownership to program directory by command (as root or with sudo):

chown user:user /home/user/Desktop/Programs/

By the way why do you run VSC as root? It is not good to run programs as admin (root) and work as admin user unless it is needed.

And it looks like you don't know much about permissions and groups. Write in terminal and read 'man chmod' and 'man chown'. Press h for help when reading manual (man).

It was simple, so you better start learning, reading documentation or you will have trouble.

When I type:

chown user:user /home/user/Desktop/Programs/

It's showing

chown: invalid user: 'user:user'

My username is alu when I try to type

chown alu:user /home/user/Desktop/Programs/

it's showing same error. It's only working when I type

chown alu:root ...

but when I type

chown alu:user ...

it's showing this error

chown: invalid user: 'alu:user'

Last edited by Anonymous-User (2019-11-09 11:22:49)

Offline

#6 2019-11-09 11:35:06

progandy
Member
Registered: 2012-05-17
Posts: 3,585

Re: How to save files with Visual Studio Code?

You need to set the username and groupname to the one of your user.

id -un # username
id -gn # groupname

| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#7 2019-11-09 11:58:51

Anonymous-User
Member
Registered: 2019-10-29
Posts: 10

Re: How to save files with Visual Studio Code?

progandy wrote:

You need to set the username and groupname to the one of your user.

id -un # username
id -gn # groupname

Thank you. It worked.

Offline

#8 2019-11-09 14:06:09

2ManyDogs
Forum Moderator
Registered: 2012-01-15
Posts: 2,788

Re: How to save files with Visual Studio Code?

Please remember to mark your thread [SOLVED] (edit the title of your first post).

Offline

Board footer

Powered by FluxBB