gravitational / teleport

The easiest, and most secure way to access and protect all of your infrastructure.
https://goteleport.com
GNU Affero General Public License v3.0
17.24k stars 1.73k forks source link

Add instructions for using `tsh` in Windows Subsystem for Linux #9849

Open tatosjb opened 2 years ago

tatosjb commented 2 years ago

Details

When I have tried to use tsh inside the wsl terminal, the browser does not open. To solve this I had to uninstall teleport from the debian(inside wsl) and I download the windows version. Extracted it to a folder (e.g. c:/teleport), copied the tsh.exe and renamed it to just tsh (without the extension ) and add the path to debian bash (e.g. export PATH="$PATH:/mnt/c/teleport"). The steps should be like:

Download teleport Extract the files to c:/program files Create a copy of the executable tsh.exe as tsh(without the extension) Add the path to your WSL bash export PATH="$PATH:/mnt/c/program files/teleport"

Category

awoodobvio commented 2 years ago

@tatosjb : I was able to use the native linux binary for tsh in wsl2.

Just need to use the allocated ip address (ip addr) with --bind-addr on tsh login.

See: https://github.com/gravitational/teleport/issues/2171

hexinal commented 1 year ago

Another useful instruction would be how to use your fido2/U2F device through WSL.

itsties commented 1 year ago

Maybe this helps someone, I logon using the Windows client then use the configs from .tsh-folder directly in WSL

  1. Install tsh on Windows (Teleport Connect) and WSL
  2. Find your tsh.exe in WSL with (if it is on C:)
    powershell.exe -c "(Get-Command tsh).Source"  | sed 's/\\/\//g' | sed 's/C:/\/mnt\/c/'
  3. Link your .tsh folder in WSL
    ln -s /mnt/c/Users/$profile_folder/.tsh/ ~/.tsh
  4. Add the following code to ~/.bashrc
    tsh() {
    if [[ $@ == login* ]]; then
    command /mnt/c/$wsl_path_to_tsh_exe "$@"
    else
    command tsh "$@"
    fi
    }

    This wil use the tsh.exe to login with your Webauthn device, it works with my fingerprint reader