added k3sudo function

This commit is contained in:
Jonas Forsberg 2021-05-20 08:08:49 +02:00
parent d2af031ee9
commit 1e30ec6541
No known key found for this signature in database
GPG Key ID: F2E9818C70350CC9

View File

@ -1,5 +1,17 @@
#!/bin/bash #!/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(){ function pc(){
# use pass and copy to clipboard # use pass and copy to clipboard
pass -c1 "$@" pass -c1 "$@"