File: ssh-show-default-key.sh

package info (click to toggle)
cockpit 355-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 311,568 kB
  • sloc: javascript: 774,787; python: 40,655; ansic: 35,157; cpp: 11,141; sh: 3,512; makefile: 580; xml: 261
file content (16 lines) | stat: -rwxr-xr-x 338 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#! /bin/sh

set -euf

# Print the name of default key, if any.

for f in id_dsa id_ecdsa id_ecdsa_sk id_ed25519 id_ed25519_sk id_rsa; do
    p=$HOME/.ssh/$f
    if test -f "$p"; then
        echo "$p"
        if ! ssh-keygen -y -P "" -f "$p" >/dev/null 2>/dev/null; then
            echo "encrypted"
        fi
        exit 0
    fi
done