By default, MobaXterm uses its own home directory:

C:\Users\UserName\Documents\MobaXterm\home

Therefore, its SSH folder:

~/.ssh

is different from the Windows SSH folder:

C:\Users\UserName.ssh

This can lead to different SSH keys and configuration files being used by MobaXterm, Windows OpenSSH, Git, and VS Code.

Solution

First, if need copy the existing MobaXterm SSH files to the Windows SSH folder:

mkdir -p /drives/c/Users/UserName/.ssh
cp -a ~/.ssh/. /drives/c/Users/UserName/.ssh/

Verify the result:

diff -qr ~/.ssh /drives/c/Users/UserName/.ssh

Files reported as existing only in the Windows folder are usually pre-existing Windows keys or configuration files and are not necessarily a problem.

Then open:

MobaXterm → Settings → Configuration → General

Change Terminal home directory to:

C:\Users\UserName

Leave Terminal root (/) directory unchanged.

Restart MobaXterm and verify:

echo “$HOME”
ls -la ~/.ssh

MobaXterm and Windows will now use the same SSH folder:

C:\Users\UserName.ssh

Use the Same SSH Keys in MobaXterm and Windows

Leave a Reply

Your email address will not be published. Required fields are marked *