Linux vs code permission denied

ssh in vscode error: Permission denied (publickey,password)

So I’m using the «Remote — SSH» plugin in VSCode to connect to my VPS and edit my code. I lost the connection, then had to hard-reset it after 30+ min. Now I can’t access it with VSCode anymore [putty works] and get Could not establish connection to «[vps-ip]». Permission denied (publickey,password). when starting VSCode in ssh up or when reloading the connection. I also get this log every time. What would I have to do, to get this to work normally again? Here is the log I replaced some stuff with [. ]

[18:42:52.792] Log Level: 2 [18:42:52.795] remote-ssh@0.50.0 [18:42:52.795] win32 x64 [18:42:52.797] SSH Resolver called for "ssh-remote+[vps-ip]", attempt 1 [18:42:52.797] SSH Resolver called for host: [vps-ip] [18:42:52.798] Setting up SSH remote "[vpsip]" [18:42:52.801] Acquiring local install lock: C:\Users\[myname]\AppData\Local\Temp\vscode-remote-ssh-[vps-ip]-install.lock [18:42:52.816] Looking for existing server data file at c:\Users\[myname]\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-ssh\vscode-ssh-host-[vps-ip]-[id]\data.json [18:42:52.817] Using commit id "[id]" and quality "stable" for server [18:42:52.817] Install and start server if needed [18:42:52.820] Checking ssh with "ssh -V" [18:42:52.875] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5 [18:42:52.876] Checking ssh with "C:\WINDOWS\System32\OpenSSH\ssh.exe -V" [18:42:52.917] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5 [18:42:52.917] Checking ssh with "C:\Program Files\Git\usr\bin\ssh.exe -V" [18:42:52.993] > OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019 [18:42:52.994] askpass server listening on \\.\pipe\vscode-ssh-askpass-[askpass]-sock [18:42:52.995] Spawning local server with [18:42:52.995] Local server env: [18:42:53.021] Spawned 30572 [18:42:53.125] > local-server> Spawned ssh: 12024 [18:42:53.165] stderr> OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019 [18:42:53.359] stderr> debug1: Server host key: [the key] [18:42:53.558] stderr> 'C:\Users\[only my sirname]' is not recognized as an internal or external command, [18:42:53.558] stderr> operable program or batch file. [18:42:53.607] stderr> Permission denied, please try again. [18:42:53.638] stderr> 'C:\Users\[only my sirname]' is not recognized as an internal or external command, [18:42:53.638] stderr> operable program or batch file. [18:42:53.686] stderr> Permission denied, please try again. [18:42:53.716] stderr> 'C:\Users\[only my sirname]' is not recognized as an internal or external command, [18:42:53.716] stderr> operable program or batch file. [18:42:53.767] stderr> root@[vps-ip]: Permission denied (publickey,password). [18:42:53.771] > local-server> ssh child died, shutting down [18:42:53.779] Local server exit: 0 [18:42:53.780] Received install output: OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019 debug1: Server host key: Linux vs code permission denied 'C:\Users\[only my sirname]' is not recognized as an internal or external command, operable program or batch file. Permission denied, please try again. 'C:\Users\[only my sirname]' is not recognized as an internal or external command, operable program or batch file. Permission denied, please try again. 'C:\Users\[only my sirname]' is not recognized as an internal or external command, operable program or batch file. root@[vps-ip]: Permission denied (publickey,password). [18:42:53.781] Resolver error: Permission denied (publickey,password). [18:42:53.783] ------ 

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Читайте также:  Last password change on linux

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 #97648

Permission Denied #97648

Comments

Why do I keep getting a message «Permission Denied» in the terminal when I try to run my code? I was just trying to follow a tutorial and do the Hello World message in Python but I keep getting that permission denied message .

The text was updated successfully, but these errors were encountered:

@LittleJeff1 Your terminal looks like bash, but it looks like you are editing files on Windows. Did you configure this integrated terminal on purpose? Could you double check the settings you have?

image

Hello!
I have been having almost the same issue here, i was looking for similar open issues and I found this one here.
I just changed from spyder to VS and i am trying to use the virtual environment features of VS, however when I tried to create a virtual environment the Permission denied error appears:

I have already checked if the python was added to path and it is, moreover I can access python throught the cmd normally.
image
image

image

This are my json configurations

This is the Visual Studio that i am using
Version: 1.45.1 (user setup)
Commit: 5763d90
Date: 2020-05-14T08:27:35.169Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18363

Any clue is usefull 🙂
Thanks

Moreover,i do not recall having changed the integrated terminal to the git bash. Is there any other default setting?
However i did tried to completelly unistall VS in order to clean up any installations mistakes i might have made, however i was not well succeeded. So also if you can advise of how to completelly uninstall it would be welcomed

Git bash can have permissions issues and other strange behavior, here it could be because you’re trying to launch the Microsoft store version of python?

Moreover,i do not recall having changed the integrated terminal to the git bash. Is there any other default setting?

No it was never a default, you can change it via the select default shell command though (via command palette or terminal dropdown).

Источник

VS Code on linux, various permissions errors

Is there any way to get vs code to work properly in linux? I can’t run sudo code . because that gives me an error saying it’s not secure to do so, I can’t do anything within the editor to force doing things, like staging a file in git, or reloading a newly installed extension. I’ve googled around, and it seems nobody else has posted about this, and it seems highly unlikely that I’m the first to raise issue about this. (Take it easy on me, I’m a relatively new linux user). I’m trying to figure this out on Ubuntu 18.04 if that’s relevant at all. My version of vs code is 1.30.2

Читайте также:  Linux double to string

I guess my main question is what’s the right way to get applications like vs code to be able to perform tasks that required doing things without fighting the OS about sudo and privileges?

Solution – 1

Launch via sudo from terminal

To launch VSCode as root —which is highly discouraged— you must specify an alternate user data directory as follows:

$ sudo code --user-data-dir /path/to/alternate/folder 

VSCode will automatically generate the required folders in the selected directory and launch with root privileges.

Change permissions to fix «permission denied» error

The solution in this case is to manually change the permissions of the two directories /home/$USER/.config/Code/ and /home/$USER/.vscode/ . Perform these steps:

$ sudo chmod 755 /home/$USER/.config/Code 
$ sudo chmod 755 /home/$USER/.vscode 

To answer your other question:

If you really need to run several commands as root and you are annoyed by having to enter your password several times (when sudo has expired), just do sudo -i and you’ll become root.

If you want to run commands using pipes, use sudo sh -c «comand1 | command2» .

You may also want to take a look at this Ask Ubuntu answer about running applications as root.

Solution – 2

I solve this problem using:

sudo chown -R YOUR_USER YOUR_PROJECT/ 

Solution – 3

You basically need to tell the OS that you are the owner of the files you create. Use sudo chown
However, if you already created some files before applying chown, don’t forget to change their permission also sudo chown / .

Источник

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

I tried: sudo chown -R user /mnt/c/Users/myUser/Documents/myFolder/proyectFolder but I still can’t save this file.

It was as simple as giving permissions to the folder for me as described in the answer here: stackoverflow.com/a/64281748/532489

9 Answers 9

Try this, fixed it for me

sudo chown -R username path 
sudo chown -R emanuel /home/emanuel/test/ 

be careful when connected over ssh. I had to restart my AWS EC2 instance because root login was not permitted

sudo chmod -R 777 folder_name_where_your_file_exists 
sudo chmod -R 755 folder_name_where_your_file_exists 
sudo chown -R $USER:$USER /home/ 

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).

Читайте также:  Linux mint initramfs failed

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.

Источник

How to run Visual Studio Code as root

I recently installed Visual Studio Code editor. I downloaded the 32bit .deb package. Installed and run normally, but when i tried to save a file in my project folder, it returns permission denied. So, i re-run code with

It is recommended to start vscode as a normal user. To run as root, you must specify an alternate user data directory with the --user-data-dir argument. 

I looked for how to specify an alternate user data directory with the —user-data-dir argument but I didn’t find much. So, how do I run Visual Studio Code as root in Ubuntu 16.04? edit: I would prefer a solution that avoids changing directory permissions. edit2: project directory: /var/www/project (I’m using Apache with vhost)

I don’t understand why you want to run code as root; this is potentially dangerous. You should figure out the real reasons why you can’t save the file.

@edwinksl the issue is probably coming from cmake install targets that, when built within vscode, want to write files to various folders. sudo-ing is def. a bad idea, but you can’t expect people to start reading build scripts to find out what they have to chown.. building inside a container is one solution, but it’s not ideal.

3 Answers 3

It is very dangerous to run VScode as root (as it is any other application) however, should you absolutely need to:

You must specify the user data directory to use when running vs code:

sudo code --user-data-dir="~/.vscode-root" 

Then from the window you can open your project folder

Again: This is not recommended. Have fun.

Update May 2018

For everyone asking why this isn’t recommended, you clearly don’t understand why sudo even exists. From this AskUbuntu Question:

It defeats the security model that’s been in place for years. Applications are meant to be run with non-administrative security (or as mere mortals) so you have to elevate their privileges to modify the underlying system. For example, you wouldn’t want that recent crash of Rhythmbox to wipe out your entire /usr directory due to a bug. Or that vulnerability that was just posted in ProFTPD to allow an attacker to gain a ROOT shell.

It’s just good practice on any operating system to run your applications on a user level and leave administrative tasks to the root user, and only on a per-need basis.

I’m not saying that you should never use VSCode as root(though its pretty easy to avoid doing) I’m saying you should be careful when you want to do so and know the risks.

The absolute best thing to do to is make a copy of a restricted file, edit it, and copy it back when you’re absolutely sure it’s finished.

Also for editing files to which your user does not have permissions, I would now recommend Talha Junaid’s answer which asks for permissions every single time you want to save a file. The prompt for root access did not exist when I wrote this answer.

Источник

Оцените статью
Adblock
detector