Skip to content

Instantly share code, notes, and snippets.

@koshatul
koshatul / ssh-copy-id-if-needed.sh
Created February 24, 2016 04:23
ssh-copy-id replacement to copy only if key auth fails
#!/bin/bash
########################################################################################
## ssh-copy-id-if-needed
##
## Copies specified identity file to specified server
##
usage() {
echo "usage: $0 [-i [identity_file]] [user@]machine" >&2
exit 1
@koshatul
koshatul / ssh-copy-id.sh
Created February 24, 2016 04:14
ssh-copy-id, copied from ubuntu
#!/bin/sh
# Shell script to install your public key on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
ID_FILE="${HOME}/.ssh/id_rsa.pub"
if [ "-i" = "$1" ]; then
#!/bin/bash
# Print the serial number of your disks with this script
ls /dev/disk/by-id/ata* | sed -e '/-part[0-9]*$/d;s/.*_//' | while read SERIAL;
do
DEVICE=$(readlink -f /dev/disk/by-id/ata*${SERIAL});
echo ${DEVICE}" "${SERIAL};
done | sort;