New SSH authorize file; whatismyip fix; PKGBUILDs

This commit is contained in:
DarkFeather
2018-02-13 13:22:57 -06:00
parent d2deb6bee3
commit 861587a99e
8 changed files with 104 additions and 14 deletions

View File

@@ -1,5 +1,5 @@
LIST=bell bigorlittle compare-directories compress-all diff-args expand-all logged-shell standardize-folder whatismyip new-irssi-config replicate-ssh-profiles worktrack
LOCATION=/usr/local/bin
LIST=bell bigorlittle compare-directories compress-all diff-args expand-all logged-shell standardize-folder whatismyip new-irssi-config replicate-ssh-profiles worktrack ssh-authorize-host
LOCATION=${pkgbuild}/usr/local/bin
INSTALLER != curl -s https://aninix.net/foundation/installer-test.bash | /bin/bash
PERMISSION=0755
compile:

41
Shared/ssh-authorize-host Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/bash
#--------------------------------------------------------------------#
#File: ssh-authorize-host
#
#Description: Add a public key to a remote SSH-capable host.
#
#Package: AniNIX::MiscScripts
#Copyright: WTFPL
#
#Author: DarkFeather
#Changelog by editor:
#--------------------------------------------------------------------#
# Show the usage for this script.
function usage {
echo "Usage: $0 host [ pubkeyfile ]"
}
# Create the initial SSH command.
function initialSSHCommand() {
echo 'mkdir -p ${HOME}/.ssh'
echo 'touch ${HOME}/.ssh/authorized_keys'
echo 'chmod 0700 ${HOME} ${HOME}/.ssh'
echo 'chmod 0600 ${HOME}/.ssh/authorized_keys'
echo 'chown -R `whoami`":" ${HOME}'
echo 'cat > ${HOME}/.ssh/authorized_keys'
}
# Parse the CLI arguments.
host="$1"
if [ -z "$host" ]; then usage; exit 1; fi
pubkeyfile="$2"
if [ -z "$pubkeyfile" ] || [ ! -f "$pubkeyfile" ]; then
pubkeyfile="${HOME}/.ssh/id_rsa.pub"
fi
# Execute on the remote host.
(initialSSHCommand; cat "$pubkeyfile") | ssh "$host" /bin/bash

View File

@@ -1,2 +1,2 @@
#!/bin/bash
/usr/bin/lynx -connect_timeout=5 -read_timeout=5 -timeout=5 --dump whatismyipaddress.com | grep '/ip/' | head -n 1 | cut -f 5 -d '/'
/usr/bin/lynx -connect_timeout=5 -read_timeout=5 --dump whatismyipaddress.com | grep '/ip/' | head -n 1 | cut -f 5 -d '/'