We use kerberos authentication for connecting to our on-prem computing environment. I'd like to use visual studio code remote to do development directly on that server. Based on this section in the vscode remote documentation, it seems like it's possible to use password-based authentication, which works for me, but it would be nice if I could use existing kerberos authentication, instead of having to type my password every time I start up a vscode session.
I've tried searching through the documentation above, but I can't figure out if kerberos is supported. I would like to know if I should respectfully raise an issue on the issue tracker.
In VS Code, select Remote-SSH: Connect to Host... from the Command Palette (F1, Ctrl+Shift+P) and use the same user@hostname as in step 1. If VS Code cannot automatically detect the type of server you are connecting to, you will be asked to select the type manually.
You can view the list of active Kerberos tickets to see if there is one for the service of interest, e.g. by running klist.exe. There's also a way to log Kerberos events if you hack the registry. Show activity on this post. You should really be auditing logon events, whether the computer is a server or workstation.
I've used plain PuTTY (plink.exe) to connect from VsCode with kerberos using those simple steps.
remote
.echo OpenSSH
SET mypath=%~dp0
powershell %mypath%ssh.ps1 %*
ssh.ps1
in the same folder with these contents:$ArgArray = [System.Collections.ArrayList]$Args
$ind = $ArgArray.IndexOf("-F")
if ($ind -ge 0) {
$ArgArray.RemoveAt($ind)
$ArgArray.RemoveAt($ind)
}
Write-Host $ArgArray
& 'C:\Program Files\PuTTY\plink.exe' $ArgArray
Theoretically you can write it in batch language but I did not want to suffer.
ssh.bat
path. Host remote
HostName remote
User <you ssh user>
My tweak on @Roman's batch script
@echo off
for %%x in (%*) do (
REM Handle -V
IF "%%x" == "-V" GOTO :version
REM Handle vscode remote as special for plink only
IF "%%x" == "remote" GOTO :plink
)
REM use the built in ssh by default
GOTO :default_ssh
:version
echo OpenSSH
GOTO :eof
:plink
powershell -NoProfile -ExecutionPolicy Bypass %~dp0ssh.ps1 %*
GOTO :eof
:default_ssh
ssh.exe %*
GOTO :eof
It allows you to only use plink for the vscode "remote" server name (I have my reasons), so everything behaves as normal unless you choose hostname remote
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With