New user support script
This commit is contained in:
parent
66f8fdde63
commit
b37eb3270e
@ -1,4 +1,4 @@
|
|||||||
LIST=bell bigorlittle compare-directories compress-all diff-args expand-all logged-shell standardize-folder whatismyip new-irssi-config
|
LIST=bell bigorlittle compare-directories compress-all diff-args expand-all logged-shell standardize-folder whatismyip new-irssi-config replicate-ssh-profiles
|
||||||
LOCATION=/usr/local/bin
|
LOCATION=/usr/local/bin
|
||||||
PERMISSION=0755
|
PERMISSION=0755
|
||||||
compile:
|
compile:
|
||||||
|
15
Shared/replicate-ssh-profiles
Executable file
15
Shared/replicate-ssh-profiles
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
searchterm="$1"
|
||||||
|
if [ -z "$searchterm" ]; then searchterm="'*'"; fi
|
||||||
|
for system in `egrep '^Host ' $HOME/.ssh/config | cut -f 2 -d ' ' | egrep $searchterm`; do
|
||||||
|
printf "$system ... "
|
||||||
|
privfile="$(grep IdentityFile $HOME/.ssh/config | grep `echo $system | cut -f 1 -d '-'` | head -n 1 | cut -f 2 -d ' ')"
|
||||||
|
command='chmod 0700 $HOME $HOME/.ssh; echo "'`cat $privfile.pub`'" > $HOME/.ssh/authorized_keys; cp $HOME/.ssh/authorized_keys $HOME/.ssh/id_rsa.pub; chmod 0600 $HOME/.ssh/authorized_keys; chown -R `whoami` $HOME; mv $HOME/.profile $HOME/.profile.bak; mv $HOME/.bashrc $HOME/.bashrc.bak'
|
||||||
|
ssh $system bash -c "$command"
|
||||||
|
if [ $? -ne 0 ]; then printf "FAILED\n"; continue; fi
|
||||||
|
scp $privfile $system:.ssh/id_rsa
|
||||||
|
scp $HOME/.bashrc $system:.bashrc
|
||||||
|
scp $HOME/.profile $system:.profile
|
||||||
|
printf "DONE\n"
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user