Category: Bash / Terminal / Scripts

09.09.2019

yum install ascii # or apt install ascii ascii Usage: ascii [-dxohv] [-t] [char-alias…] -t = one-line output -d = Decimal table -o = octal table -x = hex table -h = This help screen -v = version information Prints […]

29.08.2019

update: safety first! when it comes to important files: safety comes first thus recommend to the user that wants to go pro the following backup system: have two complete backups at two different places: backupA: at the company, USB 3.0 […]

05.06.2019

WARNING! BE VERY VERY CAREFUL! YOU CAN DESTROY YOUR SYSTEM! so better use a system that is not production important/not a live server. use a laptop that has NOTHING ATTACHED TO IT! (unplug all USB Sticks and external USB Drives) […]

15.05.2019

will do exactly that: last -F # -F Print full login and logout times and dates. # output will look like this # username (who logged in) ip (from which was logged in) duration of session username pts/0 123.123.123.123 Tue […]

linux bash – show all crontabs of all users
14.05.2019

cat /scripts/crontab_show_all.sh for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done outputs a nice list like this: in format: user command root no crontab for root actualuser * * * * * echo “stuff” […]

linux bash arrays example
09.04.2019

arrays are pretty useful variables that hold key:value data pairs, per default the “key” is an integer number, BUT: as shown there can also be associative arrays, meaning the index can be any string (needs bash version4) this script demonstrates […]

self hosted wordpress setup script
07.02.2019

WARNING! BACKUP YOUR MACHINE! UNTESTED! before running this script change to your new web root: /home/UserName/web/domain.com/public_html then run it like /scripts/install_wordpress.sh it tries to: download and unpack the latest wordpress into the current directory disable xmlrpc.php disable wp-cron.php requirements: a […]

linux bash script – test if host is alive – internet connection test script – uptime test script
15.12.2018

tested with: tested with/on: Static hostname: CentOS1.localdomain Operating System: CentOS Linux 7 (Core) Kernel: Linux 4.15.9 Architecture: x86-64 bash -version GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu) ping -V ping utility, iputils-s20160308 usage: /scripts/count_host_uptime.sh domain.com cat /scripts/count_host_uptime.sh domain.com #!/bin/bash # ping -c […]

09.08.2018

i want to create a autostart script that starts whenever the server starts. mkdir /scripts vim /scripts/start.sh #!/bin/bash echo “========= starting up docker service” systemctl start docker echo “========= starting up docker containers” docker start containername vim /scripts/stop.sh #!/bin/bash echo […]

Samba4 on CentOS7 in under 10min – add windows file sharing user script – security – from SMB 1.0 to 2.0 – anti ETERNALBLUE EXPLOIT update trouble – SID “username” is not in a valid format – pdb_getsampwnam (tdb) error fetching database – solved
19.04.2018

update: 2019-02: everything was fine… until you decided to update because of the EthernalBlue exploit THAT ALSO AFFECTS OPEN SOURCE IMPLEMENTATIONS OF SMB 1.0! (WTF!? WHY?), samba now miss behaves on Debian and CentOS. (scroll down for details) EternalBlue, sometimes […]