Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Access is denied when configuring the ssh. #132

Closed
KevinEdry opened this issue Sep 29, 2020 · 5 comments
Closed

Access is denied when configuring the ssh. #132

KevinEdry opened this issue Sep 29, 2020 · 5 comments

Comments

@KevinEdry
Copy link
Contributor

Hey,
when I am trying to configure the SSH via the command:
coder config-ssh
I am getting this error:
Error: fetch and write ssh key: open C:\Users\User Name\.ssh\coder_enterprise: Access is denied.

I tried to run it with Administrator privileges but with no luck, I am getting the same error.
Note that it throws me this error but still writes into the ssh config file. my guess is that my username in windows have spaces.

@cmoog
Copy link
Contributor

cmoog commented Oct 16, 2020

Thanks for filing this report. To comply with OpenSSH, when coder-cli initially creates the coder_enterprise private key file, it removes its own write permissions. This makes subsequent executions of the command fail unless the user manually executes something like sudo rm ~/.ssh/coder_enterprise first, then runs coder config-ssh.

I think the best path forward is to improve the error message providing these instructions.

@nathanpotter
Copy link

We could potentially make the command idempotent. If the key exists, we complete successfully, if it doesn't, we create it and complete successfully. Then we can have the error handling be for unexpected / extraneous cases.

@cmoog
Copy link
Contributor

cmoog commented Oct 16, 2020

@nathanpotter The trouble with making this idempotent is that the user can regenerate their key from the dashboard. So sometimes we do need them to manually delete it so we can rewrite to the file.

Kinda wonder how the gcloud CLI handles this because they seem to have figured it out.

@KevinEdry
Copy link
Contributor Author

Another issue for us is when we add a new environment and want to configure it locally via "coder config-ssh", it doesn't add quotes for the path to the key.
The behavior now: IdentityFile=C:\Users\User Name.ssh\coder_enterprise
The wanted behavior: IdentityFile="C:\Users\User Name.ssh\coder_enterprise"

Anyway I linked and created two pull requests that will solve this problem #139 #138.
it will be resolved when those two are merged.

@KevinEdry
Copy link
Contributor Author

@cmoog both of them go merged, I believe this will be fixed in the next build of the cli.
This issue is resolved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants