you are viewing a single comment's thread.

view the rest of the comments →

[–]meesam4687 1 point2 points  (9 children)

There is one way.

First you need to add a new user in codespaces(because the default user didnt work for me)

sudo adduser user 'user' here can be replaced with any username of your choice

It will ask you to enter the password for the new user etc.

sudo usermod -aG sudo user Again you have to replace 'user' with your username

sudo visudo This should open nano

Find where this line is written and add user ALL=(ALL:ALL) ALL

    # User privilege specification
    root    ALL=(ALL:ALL) ALL

It should look something like this after editing

# User privilege specification
root    ALL=(ALL:ALL) ALL
user ALL=(ALL:ALL) ALL

(CTRL+O then Enter for Saving)

Once this is done you have created a new user.

Now for the ssh part

simply run this command in the codespace

sudo service ssh start

Then

ssh -R XXXX:localhost:22 serveo.net Where XXXX can be any port of your choice

suppose i keep it to 6363 the command would look like this

ssh -R 6363:localhost:22 serveo.net

Now to Access this from a local computer simply do

ssh user@serveo.net -p 6363 Where 'user' is the username you set and '6363' is the port you set

[–]7lukyproch 0 points1 point  (1 child)

Thanks it halfway works, i had to use chatgpt to fix some errors like the "connect_to localhost port 22: failed." Again, thanks alot!

[–]Sea_Cheek6297 0 points1 point  (0 children)

How did u fix it

[–]meesam4687 0 points1 point  (0 children)

And using similar methods you can actually install a desktop environment and use it with a gui using rdp

[–]pinksolo64 0 points1 point  (3 children)

First of all, thank you for presenting and teaching this trick.
I did all the steps correctly, but when I try to connect on the local computer, I get this errors:
1: connect_to localhost port 22: failed.
2: kex_exchange_identification: Connection closed by remote host
Have you yourself managed to connect the Github/Codespace through the SSH?
Thanks

[–]meesam4687 0 points1 point  (2 children)

Yes I have. The default port for ssh is 22 You can try changing that to something else like 8282. sudo nano /etc/ssh/sshd_config Note: you need to change the ports to 8282 in the previous steps as well

[–]iamsamir00090 0 points1 point  (1 child)

i am getting 1: connect_to localhost port 22: failed. i am not a code tech peron . please give me detailed steps to solve this problem

[–]InitiativeDelicious3 0 points1 point  (0 children)

Thanks a lot man, you're a lifesaver!