initial commit
This commit is contained in:
15
custom-cmds-in-ubuntu/bin_examples/createnewuserns
Normal file
15
custom-cmds-in-ubuntu/bin_examples/createnewuserns
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
###################################
|
||||
############ by Sthope ############
|
||||
###################################
|
||||
|
||||
## nano ~/.bashrc
|
||||
## and add this to the end of the file: export PATH=$PATH:~/bin
|
||||
## sudo chmod +x ~/bin/*;su -l $USER
|
||||
|
||||
#### USAGE
|
||||
# bash -c "$(wget -qLO - https://git.sthope.dev/sthope/sthope_website_examples/raw/branch/master/custom-cmds-in-ubuntu/bin_examples/createnewuserns)" go Username Password
|
||||
# Type "createnewuserns USERNAME PASSWORD" it will create new user without asking all the questions
|
||||
|
||||
adduser ${0} --gecos "${0},69,69,69" --disabled-password
|
||||
echo "${0}:${1}" | chpasswd
|
15
custom-cmds-in-ubuntu/bin_examples/dockerrm
Normal file
15
custom-cmds-in-ubuntu/bin_examples/dockerrm
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
###################################
|
||||
############ by Sthope ############
|
||||
###################################
|
||||
|
||||
## nano ~/.bashrc
|
||||
## and add this to the end of the file: export PATH=$PATH:~/bin
|
||||
## sudo chmod +x ~/bin/*;su -l $USER
|
||||
|
||||
#### USAGE
|
||||
# Type "dockerrm Container_Name" to Stop and Remove running Docker Container
|
||||
# example: dockerrm Container_Name
|
||||
|
||||
docker stop $1
|
||||
docker rm $1
|
26
custom-cmds-in-ubuntu/bin_examples/plsupgrade
Normal file
26
custom-cmds-in-ubuntu/bin_examples/plsupgrade
Normal file
@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
###################################
|
||||
############ by Sthope ############
|
||||
###################################
|
||||
|
||||
## nano ~/.bashrc
|
||||
## and add this to the end of the file: export PATH=$PATH:~/bin
|
||||
## sudo chmod +x ~/bin/*;su -l $USER
|
||||
|
||||
|
||||
#### USAGE
|
||||
# Type plsupgrade to update and upgrade or type plsupgrade get APP_NAME to install some app (max 9)
|
||||
# example: plsupgrade get kodi vlc openssh-server
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade -y
|
||||
|
||||
case $1 in
|
||||
'get') if [ "$1" = get ]; then
|
||||
sudo apt-get install -y $2 $3 $4 $5 $6 $7 $8 $9
|
||||
else
|
||||
echo done
|
||||
fi;;
|
||||
*) exit 1;; #It is good practice to throw a code, hence allowing $? check
|
||||
esac
|
22
custom-cmds-in-ubuntu/bin_examples/proxmox_addnewuser
Normal file
22
custom-cmds-in-ubuntu/bin_examples/proxmox_addnewuser
Normal file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
###################################
|
||||
############ by Sthope ############
|
||||
###################################
|
||||
|
||||
## nano ~/.bashrc
|
||||
## and add this to the end of the file: export PATH=$PATH:~/bin
|
||||
## sudo chmod +x ~/bin/*;su -l $USER
|
||||
|
||||
#### USAGE
|
||||
# bash -c "$(wget -qLO - https://git.sthope.dev/sthope/sthope_website_examples/raw/branch/master/custom-cmds-in-ubuntu/bin_examples/proxmox_addnewuser)" Username Password
|
||||
#
|
||||
|
||||
apt-get update
|
||||
apt-get upgrade -y
|
||||
apt-get install -y sudo
|
||||
|
||||
adduser ${0} --gecos "${0},69,69,69" --disabled-password
|
||||
echo "${0}:${1}" | chpasswd
|
||||
|
||||
usermod -aG sudo ${0}
|
||||
usermod -aG docker ${0}
|
19
custom-cmds-in-ubuntu/bin_examples/proxmoxupgradeyes
Normal file
19
custom-cmds-in-ubuntu/bin_examples/proxmoxupgradeyes
Normal file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
###################################
|
||||
############ by Sthope ############
|
||||
###################################
|
||||
|
||||
## sudo apt-get install -y expect
|
||||
## nano ~/.bashrc
|
||||
## and add this to the end of the file: export PATH=$PATH:~/bin
|
||||
## sudo chmod +x ~/bin/*;su -l $USER
|
||||
|
||||
#### USAGE
|
||||
# Replace "Proxmox_Username", "Proxmox_IP", "Proxmox_Password" with your details
|
||||
# Than enter on the terminal proxmoxupgradeyes and it will ssh into Proxmox and update, upgrade -y and autoremove -y
|
||||
|
||||
spawn ssh -o -o StrictHostKeyChecking=no -t Proxmox_Username@Proxmox_IP "apt-get update; apt-get upgrade -y;apt-get autoremove -y"
|
||||
expect "assword:"
|
||||
send "Proxmox_Password\r"
|
||||
interact
|
15
custom-cmds-in-ubuntu/bin_examples/randomportgenerator
Normal file
15
custom-cmds-in-ubuntu/bin_examples/randomportgenerator
Normal file
@ -0,0 +1,15 @@
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
###################################
|
||||
############ by Sthope ############
|
||||
###################################
|
||||
|
||||
## nano ~/.bashrc
|
||||
## and add this to the end of the file: export PATH=$PATH:~/bin
|
||||
## sudo chmod +x ~/bin/*;su -l $USER
|
||||
|
||||
#### USAGE
|
||||
# Type randomportgenerator and it will generate 10 random ports from range 50000 and 65535
|
||||
|
||||
for i in {1..10}; do echo $((50000 + RANDOM % 65535)); done
|
15
custom-cmds-in-ubuntu/bin_examples/randompwdgenerator
Normal file
15
custom-cmds-in-ubuntu/bin_examples/randompwdgenerator
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
###################################
|
||||
############ by Sthope ############
|
||||
###################################
|
||||
|
||||
|
||||
## nano ~/.bashrc
|
||||
## and add this to the end of the file: export PATH=$PATH:~/bin
|
||||
## sudo chmod +x ~/bin/*;su -l $USER
|
||||
|
||||
#### USAGE
|
||||
# Type randompwdgenerator and it will generate 10 random passwords with 18 chars
|
||||
|
||||
for i in {1..10}; do (tr -cd '[:alnum:]' < /dev/urandom | fold -w$'18' | head -n 1); done
|
24
custom-cmds-in-ubuntu/bin_examples/sshnopwd
Normal file
24
custom-cmds-in-ubuntu/bin_examples/sshnopwd
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/expect -f
|
||||
|
||||
###################################
|
||||
############ by Sthope ############
|
||||
###################################
|
||||
|
||||
## sudo apt-get install -y expect
|
||||
## nano ~/.bashrc
|
||||
## and add this to the end of the file: export PATH=$PATH:~/bin
|
||||
## sudo chmod +x ~/bin/*;su -l $USER
|
||||
|
||||
### USAGE
|
||||
# Type "sshnopwd USERNAME@IP PASSWORD"
|
||||
# it will loggin without asking for password nor ask to confirm the new fingerprint (if applicable)
|
||||
|
||||
set timeout 5
|
||||
|
||||
set h [lindex $argv 0]
|
||||
set p [lindex $argv 1]
|
||||
|
||||
spawn ssh -o StrictHostKeyChecking=no -t "$h"
|
||||
expect "*assword:"
|
||||
send "$p\r";
|
||||
interact
|
15
custom-cmds-in-ubuntu/bin_examples/y2upgrade
Normal file
15
custom-cmds-in-ubuntu/bin_examples/y2upgrade
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
###################################
|
||||
############ by Sthope ############
|
||||
###################################
|
||||
|
||||
## nano ~/.bashrc
|
||||
## and add this to the end of the file: export PATH=$PATH:~/bin
|
||||
## sudo chmod +x ~/bin/*;su -l $USER
|
||||
|
||||
#### USAGE
|
||||
# Type "y2upgrade" ans it will use first sudo apt-get update then sudo apt-get upgrade -y
|
||||
# and it will update and upgrade system
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade -y
|
Reference in New Issue
Block a user