Created
December 10, 2015 13:21
-
-
Save francoishill/f2de3021821a4a8f769f to your computer and use it in GitHub Desktop.
Revisions
-
francoishill created this gist
Dec 10, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ # On your machine (windows / linux) that you want to get access to from Setup a (temporary) http server on your machine that always responds with your machine's SSH public key. Replace the 'YOUR-SSH-KEY-GOES-HERE' if using the golang file of this gist. # On the CoreOS box you want to access Call these commands below on the CoreOS box by replacing `IP-OF-YOUR-MACHINE` of your machine having the http server. ``` curl http://[IP-OF-YOUR-MACHINE]:8888 > ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys ``` Note that I chose port 8888 in the golang file but it could be changed there and then also adapted in the `curl` command from CoreOS. # SSH into CoreOS Now you should be able to connect if you know the ip. Hint: `ip addr show` to show IPs. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ // Golang example of http server package main import ( "fmt" "net/http" ) const YOUR_SSH_KEY = `YOUR-SSH-KEY-GOES-HERE` func main() { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { // Now write the ssh key fmt.Fprintf(w, "%s", string(YOUR_SSH_KEY)) }) portStr := "8888" fmt.Println("Attempting to listen on port " + portStr) err := http.ListenAndServe(":"+portStr, nil) if err != nil { fmt.Println("ERROR: Unable to start http server") } }