windows:wsl
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
windows:wsl [2019-08-10 18:54] – rewrote intro, changed title gabriel | windows:wsl [2019-08-18 22:18] – [Using ssh-agent with multiple shell sessions] updated to include check for open shells gabriel | ||
---|---|---|---|
Line 20: | Line 20: | ||
set bell-style none | set bell-style none | ||
set bell-style visible | set bell-style visible | ||
+ | </ | ||
+ | |||
+ | ===== Using ssh-agent with multiple shell sessions ===== | ||
+ | |||
+ | WSL doesn' | ||
+ | interface required to run native Linux applications in the Windows kernel. | ||
+ | implementation is the fact that there is no good way start an ssh-agent session that is automatically shared | ||
+ | all shell sessions in the same manner as a native Linux desktop. | ||
+ | |||
+ | These hacks allow successive shells to attach to the ssh-agent socket started by your first session. | ||
+ | |||
+ | These commands should be inserted in '' | ||
+ | |||
+ | < | ||
+ | # start ssh-agent for WSL | ||
+ | SSHAGENTINFO=/ | ||
+ | if [ -f $SSHAGENTINFO ]; then | ||
+ | printf " | ||
+ | source $SSHAGENTINFO | ||
+ | else | ||
+ | (umask 0077 ; mkdir -p `dirname $SSHAGENTINFO`; | ||
+ | source $SSHAGENTINFO | ||
+ | fi | ||
+ | </ | ||
+ | |||
+ | To make sure that the session gets cleaned up, insert this in '' | ||
+ | |||
+ | < | ||
+ | # shut down our ssh-agent when we close the final shell | ||
+ | SHELLPIDS=$( pgrep bash ) | ||
+ | SHELLCOUNT=$( echo $SHELLPIDS | wc -w ) | ||
+ | if [[ $SHELLCOUNT -eq 1 ]]; then | ||
+ | ssh-agent -k && rm -f / | ||
+ | fi | ||
</ | </ |
windows/wsl.txt · Last modified: 2019-08-18 22:20 by gabriel