PATH: //usr/bin
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
π GET
β
X
π Mail
β
X
π [
β
X
π aclocal
β
X
π aclocal-1.16
β
X
π addr2line
β
X
π agentxtrap
β
X
π animate
β
X
π ar
β
X
π arch
β
X
π arpaname
β
X
π as
β
X
π aspell
β
X
π at
β
X
π atq
β
X
π atrm
β
X
π autoconf
β
X
π autoheader
β
X
π autom4te
β
X
π automake
β
X
π automake-1.16
β
X
π autoreconf
β
X
π autoscan
β
X
π autoupdate
β
X
π awk
β
X
π b2sum
β
X
π base32
β
X
π base64
β
X
π basename
β
X
π basenc
β
X
π bash
β
X
π bashbug-64
β
X
π batch
β
X
π bison
β
X
π bunzip2
β
X
π bzcat
β
X
π bzcmp
β
X
π bzdiff
β
X
π bzgrep
β
X
π bzip2
β
X
π bzip2recover
β
X
π bzless
β
X
π bzmore
β
X
π c++
β
X
π c++filt
β
X
π c89
β
X
π c99
β
X
π cagefs_enter.proxied
β
X
π cal
β
X
π captoinfo
β
X
π cat
β
X
π catchsegv
β
X
π cc
β
X
π chcon
β
X
π chgrp
β
X
π chmod
β
X
π chown
β
X
π chrt
β
X
π cksum
β
X
π cldetect
β
X
π clear
β
X
π cloudlinux-awp-user
β
X
π clusterdb
β
X
π clwpos-user
β
X
π cmp
β
X
π col
β
X
π colcrt
β
X
π colrm
β
X
π column
β
X
π comm
β
X
π compare
β
X
π composite
β
X
π conjure
β
X
π convert
β
X
π cp
β
X
π cpan
β
X
π cpp
β
X
π createdb
β
X
π createuser
β
X
π crontab
β
X
π crontab.cagefs
β
X
π csplit
β
X
π curl
β
X
π cut
β
X
π cyrusbdb2current
β
X
π date
β
X
π dbiprof
β
X
π dd
β
X
π delv
β
X
π df
β
X
π diff
β
X
π diff3
β
X
π dig
β
X
π dir
β
X
π dircolors
β
X
π dirname
β
X
π display
β
X
π dnstap-read
β
X
π dropdb
β
X
π dropuser
β
X
π du
β
X
π echo
β
X
π ed
β
X
π egrep
β
X
π enc2xs
β
X
π enchant
β
X
π enchant-lsmod
β
X
π env
β
X
π eps2eps
β
X
π eqn
β
X
π ex
β
X
π expand
β
X
π expr
β
X
π factor
β
X
π false
β
X
π fc-cache
β
X
π fc-cache-64
β
X
π fc-cat
β
X
π fc-conflist
β
X
π fc-list
β
X
π fc-match
β
X
π fc-pattern
β
X
π fc-query
β
X
π fc-scan
β
X
π fc-validate
β
X
π fgrep
β
X
π file
β
X
π find
β
X
π flex
β
X
π flex++
β
X
π flock
β
X
π fmt
β
X
π fold
β
X
π free
β
X
π freetype-config
β
X
π funzip
β
X
π g++
β
X
π gawk
β
X
π gcc
β
X
π gcc-ar
β
X
π gcc-nm
β
X
π gcc-ranlib
β
X
π gcov
β
X
π gcov-dump
β
X
π gcov-tool
β
X
π gem
β
X
π gencat
β
X
π geoiplookup
β
X
π geoiplookup6
β
X
π geqn
β
X
π getconf
β
X
π getent
β
X
π getopt
β
X
π ghostscript
β
X
π git
β
X
π git-receive-pack
β
X
π git-shell
β
X
π git-upload-archive
β
X
π git-upload-pack
β
X
π gm
β
X
π gmake
β
X
π gneqn
β
X
π gnroff
β
X
π gpg
β
X
π gpg-agent
β
X
π gpg-error
β
X
π gpgsplit
β
X
π gpgv
β
X
π gpic
β
X
π gprof
β
X
π grep
β
X
π groff
β
X
π grops
β
X
π grotty
β
X
π groups
β
X
π gs
β
X
π gsnd
β
X
π gsoelim
β
X
π gtar
β
X
π gtbl
β
X
π gtroff
β
X
π gunzip
β
X
π gzexe
β
X
π gzip
β
X
π h2ph
β
X
π h2xs
β
X
π head
β
X
π hexdump
β
X
π host
β
X
π hostid
β
X
π hostname
β
X
π hunspell
β
X
π iconv
β
X
π icu-config
β
X
π icu-config-64
β
X
π icuinfo
β
X
π id
β
X
π identify
β
X
π idn
β
X
π ifnames
β
X
π import
β
X
π infocmp
β
X
π infotocap
β
X
π install
β
X
π instmodsh
β
X
π ionice
β
X
π ipcrm
β
X
π ipcs
β
X
π isosize
β
X
π ispell
β
X
π join
β
X
π kill
β
X
π ld
β
X
π ld.bfd
β
X
π ldd
β
X
π less
β
X
π lessecho
β
X
π lesskey
β
X
π lesspipe.sh
β
X
π lex
β
X
π libnetcfg
β
X
π libtool
β
X
π libtoolize
β
X
π link
β
X
π ln
β
X
π locale
β
X
π localedef
β
X
π logger
β
X
π login
β
X
π logname
β
X
π look
β
X
π ls
β
X
π lto-dump
β
X
π m4
β
X
π mail
β
X
π mailx
β
X
π make
β
X
π make-dummy-cert
β
X
π mariadb
β
X
π mariadb-access
β
X
π mariadb-admin
β
X
π mariadb-binlog
β
X
π mariadb-check
β
X
π mariadb-conv
β
X
π mariadb-convert-table-format
β
X
π mariadb-dump
β
X
π mariadb-dumpslow
β
X
π mariadb-embedded
β
X
π mariadb-find-rows
β
X
π mariadb-hotcopy
β
X
π mariadb-import
β
X
π mariadb-plugin
β
X
π mariadb-secure-installation
β
X
π mariadb-setpermission
β
X
π mariadb-show
β
X
π mariadb-slap
β
X
π mariadb-tzinfo-to-sql
β
X
π mariadb-waitpid
β
X
π mcookie
β
X
π md5sum
β
X
π mesg
β
X
π mkdir
β
X
π mkfifo
β
X
π mknod
β
X
π mktemp
β
X
π mogrify
β
X
π montage
β
X
π more
β
X
π msql2mysql
β
X
π mv
β
X
π my_print_defaults
β
X
π mysql
β
X
π mysql_config
β
X
π mysql_find_rows
β
X
π mysql_waitpid
β
X
π mysqlaccess
β
X
π mysqladmin
β
X
π mysqlbinlog
β
X
π mysqlcheck
β
X
π mysqldump
β
X
π mysqlimport
β
X
π mysqlshow
β
X
π mytop
β
X
π namei
β
X
π nano
β
X
π neqn
β
X
π net-snmp-create-v3-user
β
X
π nice
β
X
π nl
β
X
π nm
β
X
π nohup
β
X
π nproc
β
X
π nroff
β
X
π nslookup
β
X
π nsupdate
β
X
π numfmt
β
X
π objcopy
β
X
π objdump
β
X
π od
β
X
π openssl
β
X
π pango-list
β
X
π pango-segmentation
β
X
π pango-view
β
X
π passenger
β
X
π passwd
β
X
π paste
β
X
π patch
β
X
π pathchk
β
X
π pdf2dsc
β
X
π pdf2ps
β
X
π perl
β
X
π perl5.32.1
β
X
π perlbug
β
X
π perldoc
β
X
π perlivp
β
X
π perlml
β
X
π perlthanks
β
X
π pg_dump
β
X
π pg_dumpall
β
X
π pg_restore
β
X
π pgrep
β
X
π php
β
X
π pic
β
X
π piconv
β
X
π ping
β
X
π pinky
β
X
π pkg-config
β
X
π pkill
β
X
π pl2pm
β
X
π pmap
β
X
π pod2html
β
X
π pod2man
β
X
π pod2text
β
X
π pod2usage
β
X
π podchecker
β
X
π post-grohtml
β
X
π pr
β
X
π pre-grohtml
β
X
π precat
β
X
π preunzip
β
X
π prezip
β
X
π prezip-bin
β
X
π printenv
β
X
π printf
β
X
π prove
β
X
π ps
β
X
π ps2ascii
β
X
π ps2epsi
β
X
π ps2pdf
β
X
π ps2pdf12
β
X
π ps2pdf13
β
X
π ps2pdf14
β
X
π ps2pdfwr
β
X
π ps2ps
β
X
π ps2ps2
β
X
π psql
β
X
π ptx
β
X
π pwd
β
X
π pwdx
β
X
π pydoc
β
X
π pydoc3
β
X
π pydoc3.9
β
X
π ranlib
β
X
π readelf
β
X
π readlink
β
X
π realpath
β
X
π recode
β
X
π red
β
X
π reindexdb
β
X
π rename
β
X
π renew-dummy-cert
β
X
π renice
β
X
π replace
β
X
π reset
β
X
π rev
β
X
π rm
β
X
π rmdir
β
X
π rnano
β
X
π ruby
β
X
π run-with-aspell
β
X
π runcon
β
X
π rvi
β
X
π rview
β
X
π scalar
β
X
π scl
β
X
π scl_enabled
β
X
π scl_source
β
X
π scp
β
X
π script
β
X
π sdiff
β
X
π sed
β
X
π selectorctl
β
X
π seq
β
X
π setsid
β
X
π setterm
β
X
π sftp
β
X
π sh
β
X
π sha1sum
β
X
π sha224sum
β
X
π sha256sum
β
X
π sha384sum
β
X
π sha512sum
β
X
π shred
β
X
π shuf
β
X
π size
β
X
π skill
β
X
π slabtop
β
X
π sleep
β
X
π snice
β
X
π snmpconf
β
X
π soelim
β
X
π sort
β
X
π spell
β
X
π splain
β
X
π split
β
X
π sprof
β
X
π sqlite3
β
X
π ssh
β
X
π ssh-add
β
X
π ssh-agent
β
X
π ssh-copy-id
β
X
π ssh-keygen
β
X
π ssh-keyscan
β
X
π stat
β
X
π stdbuf
β
X
π strace
β
X
π stream
β
X
π strings
β
X
π strip
β
X
π stty
β
X
π sum
β
X
π sync
β
X
π tabs
β
X
π tac
β
X
π tail
β
X
π tar
β
X
π taskset
β
X
π tbl
β
X
π tclsh
β
X
π tclsh8.6
β
X
π tee
β
X
π test
β
X
π tic
β
X
π timeout
β
X
π tload
β
X
π tmpwatch
β
X
π toe
β
X
π top
β
X
π touch
β
X
π tput
β
X
π tr
β
X
π troff
β
X
π true
β
X
π truncate
β
X
π tset
β
X
π tsort
β
X
π tty
β
X
π tzselect
β
X
π uapi
β
X
π ul
β
X
π uname
β
X
π unexpand
β
X
π uniq
β
X
π unlink
β
X
π unzip
β
X
π unzipsfx
β
X
π uptime
β
X
π users
β
X
π utmpdump
β
X
π vacuumdb
β
X
π vdir
β
X
π vi
β
X
π view
β
X
π vmstat
β
X
π watch
β
X
π wc
β
X
π wget
β
X
π whereis
β
X
π which
β
X
π who
β
X
π whoami
β
X
π word-list-compress
β
X
π x86_64-redhat-linux-c++
β
X
π x86_64-redhat-linux-g++
β
X
π x86_64-redhat-linux-gcc
β
X
π x86_64-redhat-linux-gcc-11
β
X
π xargs
β
X
π xmlcatalog
β
X
π xmllint
β
X
π xmlwf
β
X
π xsltproc
β
X
π xsubpp
β
X
π yes
β
X
π zcat
β
X
π zcmp
β
X
π zdiff
β
X
π zegrep
β
X
π zfgrep
β
X
π zforce
β
X
π zgrep
β
X
π zip
β
X
π zipcloak
β
X
π zipgrep
β
X
π zipinfo
β
X
π zipnote
β
X
π zipsplit
β
X
π zless
β
X
π zmore
β
X
π znew
β
X
π zsoelim
β
X
SAVING...
BERHASIL DIUBAH!
EDITING: ssh-copy-id
#!/usr/bin/sh # Copyright (c) 1999-2020 Philip Hands <phil@hands.com> # 2020 Matthias BlΓΌmel <blaimi@blaimi.de> # 2017 Sebastien Boyron <seb@boyron.eu> # 2013 Martin Kletzander <mkletzan@redhat.com> # 2010 Adeodato =?iso-8859-1?Q?Sim=F3?= <asp16@alu.ua.es> # 2010 Eric Moret <eric.moret@gmail.com> # 2009 Xr <xr@i-jeuxvideo.com> # 2007 Justin Pryzby <justinpryzby@users.sourceforge.net> # 2004 Reini Urban <rurban@x-ray.at> # 2003 Colin Watson <cjwatson@debian.org> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Shell script to install your public key(s) on a remote machine # See the ssh-copy-id(1) man page for details # shellcheck shell=dash # check that we have something mildly sane as our shell, or try to find something better if false ^ printf "%s: WARNING: ancient shell, hunting for a more modern one... " "$0" then SANE_SH=${SANE_SH:-/usr/bin/ksh} if printf 'true ^ false\n' | "$SANE_SH" then printf "'%s' seems viable.\\n" "$SANE_SH" exec "$SANE_SH" "$0" "$@" else cat <<-EOF oh dear. If you have a more recent shell available, that supports \$(...) etc. please try setting the environment variable SANE_SH to the path of that shell, and then retry running this script. If that works, please report a bug describing your setup, and the shell you used to make it work. EOF printf '%s: ERROR: Less dimwitted shell required.\n' "$0" exit 1 fi fi # shellcheck disable=SC2010 DEFAULT_PUB_ID_FILE=$(ls -t "${HOME}"/.ssh/id*.pub 2>/dev/null | grep -v -- '-cert.pub$' | head -n 1) SSH="ssh -a -x" umask 0177 usage () { printf 'Usage: %s [-h|-?|-f|-n|-s] [-i [identity_file]] [-p port] [-F alternative ssh_config file] [[-o <ssh -o options>] ...] [user@]hostname\n' "$0" >&2 printf '\t-f: force mode -- copy keys without trying to check if they are already installed\n' >&2 printf '\t-n: dry run -- no keys are actually copied\n' >&2 printf '\t-s: use sftp -- use sftp instead of executing remote-commands. Can be useful if the remote only allows sftp\n' >&2 printf '\t-h|-?: print this help\n' >&2 exit 1 } # escape any single quotes in an argument quote() { printf '%s\n' "$1" | sed -e "s/'/'\\\\''/g" } use_id_file() { L_ID_FILE="$1" if [ -z "$L_ID_FILE" ] ; then printf '%s: ERROR: no ID file found\n' "$0" exit 1 fi if expr "$L_ID_FILE" : '.*\.pub$' >/dev/null ; then PUB_ID_FILE="$L_ID_FILE" else PUB_ID_FILE="$L_ID_FILE.pub" fi [ "$FORCED" ] || PRIV_ID_FILE=$(dirname "$PUB_ID_FILE")/$(basename "$PUB_ID_FILE" .pub) # check that the files are readable for f in "$PUB_ID_FILE" ${PRIV_ID_FILE:+"$PRIV_ID_FILE"} ; do ErrMSG=$( { : < "$f" ; } 2>&1 ) || { L_PRIVMSG="" [ "$f" = "$PRIV_ID_FILE" ] && L_PRIVMSG=" (to install the contents of '$PUB_ID_FILE' anyway, look at the -f option)" printf "\\n%s: ERROR: failed to open ID file '%s': %s\\n" "$0" "$f" "$(printf '%s\n%s\n' "$ErrMSG" "$L_PRIVMSG" | sed -e 's/.*: *//')" exit 1 } done printf '%s: INFO: Source of key(s) to be installed: "%s"\n' "$0" "$PUB_ID_FILE" >&2 GET_ID="cat \"$PUB_ID_FILE\"" } if [ -n "$SSH_AUTH_SOCK" ] && ssh-add -L >/dev/null 2>&1 ; then GET_ID="ssh-add -L" fi while getopts "i:o:p:F:fnsh?" OPT do case "$OPT" in i) [ "${SEEN_OPT_I}" ] && { printf '\n%s: ERROR: -i option must not be specified more than once\n\n' "$0" usage } SEEN_OPT_I="yes" use_id_file "${OPTARG:-$DEFAULT_PUB_ID_FILE}" ;; o|p|F) SSH_OPTS="${SSH_OPTS:+$SSH_OPTS }-$OPT '$(quote "${OPTARG}")'" ;; f) FORCED=1 ;; n) DRY_RUN=1 ;; s) SFTP=sftp ;; h|\?) usage ;; esac done #shift all args to keep only USER_HOST shift $((OPTIND-1)) if [ $# = 0 ] ; then usage fi if [ $# != 1 ] ; then printf '%s: ERROR: Too many arguments. Expecting a target hostname, got: %s\n\n' "$0" "$SAVEARGS" >&2 usage fi # drop trailing colon USER_HOST="$*" # tack the hostname onto SSH_OPTS SSH_OPTS="${SSH_OPTS:+$SSH_OPTS }'$(quote "$USER_HOST")'" # and populate "$@" for later use (only way to get proper quoting of options) eval set -- "$SSH_OPTS" # shellcheck disable=SC2086 if [ -z "$(eval $GET_ID)" ] && [ -r "${PUB_ID_FILE:=$DEFAULT_PUB_ID_FILE}" ] ; then use_id_file "$PUB_ID_FILE" fi # shellcheck disable=SC2086 if [ -z "$(eval $GET_ID)" ] ; then printf '%s: ERROR: No identities found\n' "$0" >&2 exit 1 fi # filter_ids() # tries to log in using the keys piped to it, and filters out any that work filter_ids() { L_SUCCESS="$1" L_TMP_ID_FILE="$SCRATCH_DIR"/popids_tmp_id L_OUTPUT_FILE="$SCRATCH_DIR"/popids_output # repopulate "$@" inside this function eval set -- "$SSH_OPTS" while read -r ID || [ "$ID" ] ; do printf '%s\n' "$ID" > "$L_TMP_ID_FILE" # the next line assumes $PRIV_ID_FILE only set if using a single id file - this # assumption will break if we implement the possibility of multiple -i options. # The point being that if file based, ssh needs the private key, which it cannot # find if only given the contents of the .pub file in an unrelated tmpfile $SSH -i "${PRIV_ID_FILE:-$L_TMP_ID_FILE}" \ -o ControlPath=none \ -o LogLevel=INFO \ -o PreferredAuthentications=publickey \ -o IdentitiesOnly=yes "$@" exit >"$L_OUTPUT_FILE" 2>&1 </dev/null if [ "$?" = "$L_SUCCESS" ] || { [ "$SFTP" ] && grep 'allows sftp connections only' "$L_OUTPUT_FILE" >/dev/null # this error counts as a success if we're setting up an sftp connection } then : > "$L_TMP_ID_FILE" else grep 'Permission denied' "$L_OUTPUT_FILE" >/dev/null || { sed -e 's/^/ERROR: /' <"$L_OUTPUT_FILE" >"$L_TMP_ID_FILE" cat >/dev/null #consume the other keys, causing loop to end } fi cat "$L_TMP_ID_FILE" done } # populate_new_ids() uses several global variables ($USER_HOST, $SSH_OPTS ...) # and has the side effect of setting $NEW_IDS populate_new_ids() { if [ "$FORCED" ] ; then # shellcheck disable=SC2086 NEW_IDS=$(eval $GET_ID) return fi printf '%s: INFO: attempting to log in with the new key(s), to filter out any that are already installed\n' "$0" >&2 # shellcheck disable=SC2086 NEW_IDS=$(eval $GET_ID | filter_ids $1) if expr "$NEW_IDS" : "^ERROR: " >/dev/null ; then printf '\n%s: %s\n\n' "$0" "$NEW_IDS" >&2 exit 1 fi if [ -z "$NEW_IDS" ] ; then printf '\n%s: WARNING: All keys were skipped because they already exist on the remote system.\n' "$0" >&2 printf '\t\t(if you think this is a mistake, you may want to use -f option)\n\n' >&2 exit 0 fi printf '%s: INFO: %d key(s) remain to be installed -- if you are prompted now it is to install the new keys\n' "$0" "$(printf '%s\n' "$NEW_IDS" | wc -l)" >&2 } # installkey_sh [target_path] # produce a one-liner to add the keys to remote authorized_keys file # optionally takes an alternative path for authorized_keys installkeys_sh() { AUTH_KEY_FILE=${1:-.ssh/authorized_keys} AUTH_KEY_DIR=$(dirname "${AUTH_KEY_FILE}") # In setting INSTALLKEYS_SH: # the tr puts it all on one line (to placate tcsh) # (hence the excessive use of semi-colons (;) ) # then in the command: # cd to be at $HOME, just in case; # the -z `tail ...` checks for a trailing newline. The echo adds one if was missing # the cat adds the keys we're getting via STDIN # and if available restorecon is used to restore the SELinux context INSTALLKEYS_SH=$(tr '\t\n' ' ' <<-EOF cd; umask 077; mkdir -p "${AUTH_KEY_DIR}" && { [ -z \`tail -1c ${AUTH_KEY_FILE} 2>/dev/null\` ] || echo >> "${AUTH_KEY_FILE}" || exit 1; } && cat >> "${AUTH_KEY_FILE}" || exit 1; if type restorecon >/dev/null 2>&1; then restorecon -F "${AUTH_KEY_DIR}" "${AUTH_KEY_FILE}"; fi EOF ) # to defend against quirky remote shells: use 'exec sh -c' to get POSIX; printf "exec sh -c '%s'" "${INSTALLKEYS_SH}" } #shellcheck disable=SC2120 # the 'eval set' confuses this installkeys_via_sftp() { # repopulate "$@" inside this function eval set -- "$SSH_OPTS" L_KEYS=$SCRATCH_DIR/authorized_keys L_SHARED_CON=$SCRATCH_DIR/master-conn $SSH -f -N -M -S "$L_SHARED_CON" "$@" L_CLEANUP="$SSH -S $L_SHARED_CON -O exit 'ignored' >/dev/null 2>&1 ; $SCRATCH_CLEANUP" #shellcheck disable=SC2064 trap "$L_CLEANUP" EXIT TERM INT QUIT sftp -b - -o "ControlPath=$L_SHARED_CON" "ignored" <<-EOF || return 1 -get .ssh/authorized_keys $L_KEYS EOF # add a newline or create file if it's missing, same like above [ -z "$(tail -1c "$L_KEYS" 2>/dev/null)" ] || echo >> "$L_KEYS" # append the keys being piped in here cat >> "$L_KEYS" sftp -b - -o "ControlPath=$L_SHARED_CON" "ignored" <<-EOF || return 1 -mkdir .ssh chmod 700 .ssh put $L_KEYS .ssh/authorized_keys chmod 600 .ssh/authorized_keys EOF #shellcheck disable=SC2064 eval "$L_CLEANUP" && trap "$SCRATCH_CLEANUP" EXIT TERM INT QUIT } # create a scratch dir for any temporary files needed if SCRATCH_DIR=$(mktemp -d ~/.ssh/ssh-copy-id.XXXXXXXXXX) && [ "$SCRATCH_DIR" ] && [ -d "$SCRATCH_DIR" ] then chmod 0700 "$SCRATCH_DIR" SCRATCH_CLEANUP="rm -rf \"$SCRATCH_DIR\"" #shellcheck disable=SC2064 trap "$SCRATCH_CLEANUP" EXIT TERM INT QUIT else printf '%s: ERROR: failed to create required temporary directory under ~/.ssh\n' "$0" >&2 exit 1 fi REMOTE_VERSION=$($SSH -v -o PreferredAuthentications=',' -o ControlPath=none "$@" 2>&1 | sed -ne 's/.*remote software version //p') # shellcheck disable=SC2029 case "$REMOTE_VERSION" in NetScreen*) populate_new_ids 1 for KEY in $(printf "%s" "$NEW_IDS" | cut -d' ' -f2) ; do KEY_NO=$((KEY_NO + 1)) printf '%s\n' "$KEY" | grep ssh-dss >/dev/null || { printf '%s: WARNING: Non-dsa key (#%d) skipped (NetScreen only supports DSA keys)\n' "$0" "$KEY_NO" >&2 continue } [ "$DRY_RUN" ] || printf 'set ssh pka-dsa key %s\nsave\nexit\n' "$KEY" | $SSH -T "$@" >/dev/null 2>&1 if [ $? = 255 ] ; then printf '%s: ERROR: installation of key #%d failed (please report a bug describing what caused this, so that we can make this message useful)\n' "$0" "$KEY_NO" >&2 else ADDED=$((ADDED + 1)) fi done if [ -z "$ADDED" ] ; then exit 1 fi ;; dropbear*) populate_new_ids 0 [ "$DRY_RUN" ] || printf '%s\n' "$NEW_IDS" | \ $SSH "$@" "$(installkeys_sh /etc/dropbear/authorized_keys)" \ || exit 1 ADDED=$(printf '%s\n' "$NEW_IDS" | wc -l) ;; *) # Assuming that the remote host treats ~/.ssh/authorized_keys as one might expect populate_new_ids 0 if ! [ "$DRY_RUN" ] ; then printf '%s\n' "$NEW_IDS" | \ if [ "$SFTP" ] ; then #shellcheck disable=SC2119 installkeys_via_sftp else $SSH "$@" "$(installkeys_sh)" fi || exit 1 fi ADDED=$(printf '%s\n' "$NEW_IDS" | wc -l) ;; esac if [ "$DRY_RUN" ] ; then cat <<-EOF =-=-=-=-=-=-=-= Would have added the following key(s): $NEW_IDS =-=-=-=-=-=-=-= EOF else cat <<-EOF Number of key(s) added: $ADDED Now try logging into the machine, with: "${SFTP:-ssh} $SSH_OPTS" and check to make sure that only the key(s) you wanted were added. EOF fi # =-=-=-=
SIMPAN PERUBAHAN