apache / openserverless

Apache OpenServerless (incubating)
https://openserverless.apache.org
Apache License 2.0
382 stars 14 forks source link

[Issue] Configure SSH for VSCode #37

Closed saadmanrafat closed 3 months ago

saadmanrafat commented 3 months ago

multipass transfer $HOME/.ssh/id_rsa.pub openserverless: multipass exec openserverless -- bash -c "cat id_rsa.pub | tee -a .ssh/authorized_keys"

throws

[2024-08-08T15:20:12.154] [error] [sftp] cannot open local file /home/$USER/.ssh/id_rsa.pub: Permission denied

Kind of stuck here! Is there any way around this problem?

sciabarracom commented 3 months ago

How does throw this $USER if you do not use it in the command line!

saadmanrafat commented 3 months ago

How does throw this $USER if you do not use it in the command line! no sorry it throws /home/saadman/.ssh/id_rsa.pub: Permission Denied.

A proper place to raise this issue would be on multipass github but I followed every single step on the how-to openserverless page. I thought it would provide more context and a little bit of help.

saadmanrafat commented 3 months ago

I'm putting this here just in case people face the same problem. This original command doesn't work use this on the local environment. I'm closing this issue -- you guys have bigger issues to attend.

cat /home/$(whoami)/.ssh/id_rsa.pub | multipass exec openserverless -- bash -c "tee -a .ssh/authorized_keys"

Thank You!

sciabarracom commented 3 months ago

Hi @saadmanrafat we released an updated version of the cloud-init, I just tried it and works.

dcremonini commented 3 months ago

Hi, @saadmanrafat thank you for reporting this issue.

@saadmanrafat you said that multipass transfer $HOME/.ssh/id_rsa.pub openserverless: doesn't work. You are right: I previously reproduced this as well, and it is related to this issue https://github.com/canonical/multipass/issues/1433

The command @saadmanrafat suggested multipass exec openserverless -- bash -c "cat id_rsa.pub | tee -a .ssh/authorized_keys" works as long as the working directory is the parent of the .ssh one.

A possibly better version is: multipass exec openserverless -- bash -c "cat $HOME/.ssh/id_rsa.pub | tee -a .ssh/authorized_keys" so I will put this in the documentation (that we are revamping).

We will fix the documentation accordingly.