Skip to content

An ssh-askpass for MacOS which supports agent confirmation with both a GUI or tmux prompt, automatically detecting which to use.

Notifications You must be signed in to change notification settings

gvengel/ssh-askpass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Installation

Copy or link the ssh-askpass script to /usr/local/bin.

Install newt, so we can use whiptail CLI prompts. (Example uses Homebrew for installation)

brew update && brew install newt

By default, macOS looks for ssh-askpass in /usr/libexec; however, this location is protected by rootless mode. Add the following to your .bash_profile, which redirects ssh-agent to look in /usr/local/bin. Note the call to ssh-add, if you wish to adjust the timeout.

.bash_profile

# Setup our SSH agent
connect_ssh_agent() {
    export SSH_AUTH_SOCK=$(ls /private/tmp/com.apple.launchd.*/Listeners)
    ssh-add -l > /dev/null 2>&1
    if [ "$?" != "0" ]; then
        launchctl setenv SSH_ASKPASS /usr/local/bin/ssh-askpass DISPLAY :0 && launchctl stop com.openssh.ssh-agent
        ssh-add -c -t 12h
    fi
}
connect_ssh_agent

You may also wish to automatically start tmux when connecting over ssh. First add new-session to your .tmux.conf, then add the following to your .bash_profile.

.bash_profile

if [ "$SSH_CONNECTION" -a -z "$TMUX" ]; then
    tmux attach -d
fi

About

An ssh-askpass for MacOS which supports agent confirmation with both a GUI or tmux prompt, automatically detecting which to use.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages