-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
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
Bad Owner or Permissions on %USERPROFILE%\.ssh\config file on Windows 10 #119
Comments
@murilogiatti .This is still not working for me |
@murilogiatti, My key file permissions are also same but not working. Can I contact you in private? |
@bunnyvishal6 Yeah, the permissions in the document are exactly how things are set up on my machine. I suspect something else may be going on here. |
@Chuxel Vscode remote dev doc says we need to give full control to user, Administrator and system. But doing so I cannot connect ssh from cmd or powershell, it gives Bad owner or permissions error. And also cannot connect via vscode same error. But by removing all Principals from /.ssh/config file permissions list, I can connect via cmd or pwershell with a normal ssh command. As Win32-openssh config file should not have anyother people to access otherthan owner. |
@bunnyvishal6 Windows unfortunately has lots of variations of the SSH clients that may be in your path. If you're using the official Windows 10 OpenSSH install, there is a utility you can use to set permissions. https://github.com/PowerShell/openssh-portable/blob/latestw_all/contrib/win32/openssh/FixUserFilePermissions.ps1 Here's a snippet you can cut-and-paste in an administrator's powershell window to run it. Install-Module -Force OpenSSHUtils -Scope AllUsers
Repair-UserSshConfigPermission ~/.ssh/config
Get-ChildItem ~\.ssh\* -Include "id_rsa","id_dsa" -ErrorAction SilentlyContinue | % {
Repair-UserKeyPermission -FilePath $_.FullName @psBoundParameters
} If you still get an error, it's possible you're using a older or different version of the tools than Win 10 ships with or there's more than one on your system and one is getting picked up in some scenario. |
@Chuxel, Did you get your setup working with this? I recently re installed win10. And the openSsh is the default one that comes with installation. And after installing above module, it says opensshutils.psm1 scripts are disabled. Is there a way to update openSsh client? Is this the latest openssh client in windows10 I think my openssh client is version 0.0.1.0 and utils version is 0.0.2.0. I will uninstall current version and will install from github repo of win32-openssh |
@bunnyvishal6 Don't install from the GitHub repo since that could be causing your problems - those are going to be development builds. Use the version that ships with Windows 10. It is known to work. You do not need to download the script. Just cut and paste the following from an administrator power shell window. Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Process
Install-Module -Force OpenSSHUtils -Scope AllUsers
Repair-UserSshConfigPermission ~/.ssh/config
Get-ChildItem ~\.ssh\* -Include "id_rsa","id_dsa" -ErrorAction SilentlyContinue | % {
Repair-UserKeyPermission -FilePath $_.FullName @psBoundParameters
} If you get an error, please post it - no way to know what is going wrong otherwise. |
@Chuxel, I'm getting this error when i try to run above commands in elevated powershell |
@bunnyvishal6 Run:
...or if you want this to only apply to the current window...
|
@Chuxel Thanks a lot. It worked. Not relevant, But I expected a demo of this today at MS Build 2019 But they just mentioned it. Anyway this is an awesome feature and I'm loving it. |
@bunnyvishal6 Great! Updated the docs to recommend this script. Re: //build - Yeah we announced at PyCon last week but it's going to show up in a number of spots over the week! |
Steps to Reproduce:
When I try to connect this is the error
Can't connect to VM-IP: unreachable or not Linux x86_64 (Bad owner or permissions on C:\Users\Bunny/.ssh/config). But vm is ubuntu 18.04 and x86_64.
Here are my file permissions
Does this issue occur when you try this locally?: Yes
Does this issue occur when you try this locally and all extensions are disabled?: No
The text was updated successfully, but these errors were encountered: