add at the end of ~/.bashrc
ssh-add -l &>/dev/null
if [ "$?" == 2 ]; then
test -r ~/.gnome-keyring && \
source ~/.gnome-keyring && \
export DBUS_SESSION_BUS_ADDRESS GNOME_KEYRING_CONTROL SSH_AUTH_SOCK GPG_AGENT_INFO GNOME_KEYRING_PID
ssh-add -l &>/dev/null
if [ "$?" == 2 ]; then
(umask 066; echo `dbus-launch --sh-syntax` > ~/.gnome-keyring; gnome-keyring-daemon >> ~/.gnome-keyring)
source ~/.gnome-keyring && \
export DBUS_SESSION_BUS_ADDRESS GNOME_KEYRING_CONTROL SSH_AUTH_SOCK GPG_AGENT_INFO GNOME_KEYRING_PID
fi
fi
Credentials are automatically added to ssh-agent provided that both the public and private keys are inside ~/.ssh.
Keychain storing applications such as mysql-workbench(requires Xming) also work.
You can ignore this warning on bash startup
gnome-keyring-daemon: insufficient process capabilities, unsecure memory might get used
source:
https://www.reddit.com/r/bashonubuntuonwindows/comments/4yhch4/using_gnomekeyringdaemon_for_ssh_keys/
Updated 2020/02/18 to reflect changes introduced in WSL2
Hi! Microsoft PM working on WSL & Command Line here.
WSL allows you to run native, unmodified Linux ELF-64 binaries directly on Windows, and enables you to run your favorite Linux tools atop your Windows "host" OS.
WSL1 took an approach of adding a Linux syscall compatible layer at the top of the NT kernel, allowing Linux binaries to run atop NT, sharing the same underlying filesystem, networking, process list, etc. as the host OS.
The soon to be released WSL2, on the other hand, runs distros' binaries within Linux containers, atop a real Linux kernel, inside a lightweight VM that allocates only the RAM needed by the apps it runs, and then releases freed RAM back to the host OS. This provides 100% Linux compatibility, and allows your Linux tools to run with near native performance, and consumes minimum resources necessary from the host, ensuring your machine runs fast and smoothly.
Prior to WSL2, one could run the Docker client in WSL1, using it to drive Docker for Windows running atop Hyper-V on the local host, or to manage a remote Docker server. But one cannot run Docker Engine on WSL1 for many technical reasons.
However, you can do the same in Docker on WSL2, but you can also run the Docker Engine itself atop WSL if you prefer. This is, Docker's preferred and future path for running Docker on Windows desktop.
To learn more about WSL, review the videos & docs here: https://aka.ms/learnwsl
Best Answer
I personally do the latter: use VcXsrv as my X server in multiple windows mode, then launch the xfce4-terminal (because gnome-terminal had visual issues that I didn't care to try to learn how to fix), and suddenly I have a competent terminal with font and color support.
I found I needed to add these to my bashrc...
Do the fix from this reddit for dbus:
I also installed compiz and I use the cbwin project to run windows programs from my xfce4-terminal shell.
I am very happy with this setup and use NeoVim + lots of native linux plugins even though my "for-work" machine must be Windows. :)
It is also possible to start an SSH server in Bash-on-Linux-on-Windows and then connect to it, say from MinTTY like from Cygwin.
PS: to make launching xfce4-terminal painless and without the extra bash cmd window, I wrote a program that does nothing but start the bash process with arguments to start xfce4-terminal without a console window. I did this in C# - basically use arguments "UseShellExecute" false and "CreateNoWindow" true. I then pinned that to my taskbar and it's almost seemless.
EDIT: The answer with VBScript is brilliant. Here's that same script, but a JScript version...