added k3sudo function
This commit is contained in:
parent
d2af031ee9
commit
1e30ec6541
@ -1,5 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
function k3sudo(){
|
||||
# create a passwordless sudo rule on target
|
||||
# usage: k3sudo [add, del] <target ip/hostname>
|
||||
if [[ "$1" == "add" ]];then
|
||||
ssh -t $2 "hostname --long; echo \"$USER ALL=(ALL) NOPASSWD: ALL\" | sudo tee /etc/sudoers.d/k3sup"
|
||||
elif [[ "$1" == "del" ]];then
|
||||
ssh $2 sudo rm /etc/sudoers.d/k3sup
|
||||
else
|
||||
echo "Error: usage: k3sudo [add, del] <target ip/hostname>"
|
||||
fi
|
||||
}
|
||||
|
||||
function pc(){
|
||||
# use pass and copy to clipboard
|
||||
pass -c1 "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user