File: ssh-show-default-key.sh

package info (click to toggle)
cockpit 358-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 317,272 kB
  • sloc: javascript: 775,788; python: 41,626; ansic: 33,970; cpp: 11,141; sh: 3,566; makefile: 581; xml: 262
file content (17 lines) | stat: -rwxr-xr-x 383 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#! /bin/sh
# SPDX-License-Identifier: LGPL-2.1-or-later

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