Greetings, Chris Rodgers! > I find the ssh-pageant package helpful to enable cygwin ssh to interact > seamlessly with PuTTY's Pageant SSH agent. One small issue is that after > installing, one has to add the lines:
>> |# ssh-pageant eval $(/usr/bin/ssh-pageant -r -a >> "/tmp/.ssh-pageant-$USERNAME")| > (see https://github.com/cuviper/ssh-pageant) > <https://github.com/cuviper/ssh-pageant>to .bashrc for each user. > Would it be acceptable to update the ssh-pageant package to add a file > /etc/profile.d/ssh-pageant.sh that does this automatically? It's not that simple. You can't blindly restart agent every time you wish without notifying other programs, `--reuse` is a very bad idea and there's no easy way to set/change an environment variable globally for an entire user session. > Or is there another preferred way to do this, e.g. a postinstall script? > I'd be happy to draft a script file for review. Just create a script for yourself and amend your own .bashrc accordingly. I do it this way: 1. Add ----- 8< ----- 8< ----- 8< ----- 8< ----- # Import ssh-pageant settings test -f "$HOME/.ssh/agent" && . "$HOME/.ssh/agent" ----- >8 ----- >8 ----- >8 ----- >8 ----- near the end of .bashrc 2. Create a script `$HOME/profile.d/ssh-pageant.sh` ----- 8< ----- 8< ----- 8< ----- 8< ----- #!/bin/sh [ -x /usr/bin/ssh-pageant ] || return _agent="$HOME/.ssh/agent" eval set -- $( getopt --shell=sh -o 'k' -- "$@" ) test -f "$_agent" && . "$_agent" if [ "$SSH_PAGEANT_PID" ]; then if test "$1" = "-k"; then /usr/bin/ssh-pageant -qk 2> /dev/null fi if ! kill -0 "$SSH_PAGEANT_PID" 2> /dev/null; then # Reap dead agent's socket rm "$SSH_AUTH_SOCK" "$_agent" 2> /dev/null unset SSH_AUTH_SOCK SSH_PAGEANT_PID fi fi test "$1" = "-k" && exit test "$SSH_PAGEANT_PID" && exit socket="$( mktemp -u /var/run/ssh-XXXXXXXX )" eval $( cygdrop -- /usr/bin/ssh-pageant -qsa "$socket" | tee "$_agent" ) # Remove empty settings file (agent failed to start). test -s "$_agent" || rm "$_agent" ----- >8 ----- >8 ----- >8 ----- >8 ----- 3. Create login job to run scripts from ~/profile.d/ on user login. 4. If you need agent settings in a different script, that may be run outside normal terminal/shell workflow, just add ----- 8< ----- 8< ----- 8< ----- 8< ----- test -f "$HOME/.ssh/agent" && . "$HOME/.ssh/agent" ----- >8 ----- >8 ----- >8 ----- >8 ----- near the top. 5. Don't forget to `ssh-pageant.sh -k` before running Cygwin setup. -- With best regards, Andrey Repin Thursday, April 23, 2020 21:28:24 Sorry for my terrible english... -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple