[ Prev ] [ Index ] [ Next ]

07crontab

Created Friday 25 September 2020

# Adjust time with ntpdate -B
55 * * * * /usr/sbin/ntpdate -B -s ntp.inet.tele.dk >> /tmp/ntpdate.log 2>&1
#
# Send efaktura to KMD
0 21 * * * su - efaktura -c "/home/efaktura/bin/FADLToKMD.sh" >> /tmp/FADLToKMD.cron.log 2>&1
0 04 * * * su - efaktura -c "/home/efaktura/bin/FADLToKMD.sh" >> /tmp/FADLToKMD.cron.log 2>&1
# Modtag kvitteringsfejl fra KMD
0 07 * * * su - efaktura -c "/home/efaktura/bin/KMDToFADL.sh" >> /tmp/KMDToFADL.cron.log 2>&1
# Send epost to PostDanmark
30 20 * * * su - eboks -c "/home/eboks/bin/FADLToPOSTDK.sh" >> /tmp/FADLToPOSTDK.cron.log 2>&1
#
# Analyze XAL_SUPERVISOR's object on XALP
03 10 * * 0 su - oracle -c "/u01/app/oracle/admin/XALP/scripts/analyze.sh" > /u01/app/oracle/admin/XALP/scripts/analyze.log 2>&1
#
#
# Oracle Backup
03 22 * * 1-5 su - oracle -c "/u01/app/oracle/admin/XALP/scripts/RMAN/startBackup.sh onlineFull.rman" >> /u01/app/oracle/admin/XALP/scripts/RMAN/log/startbackup.cron.log 2>&1
05 21 * * 1-5 su - oracle -c "/u01/app/oracle/admin/XALP/scripts/RMAN/startBackup.sh deleteObsolete.rman" >> /u01/app/oracle/admin/XALP/scripts/RMAN/log/startbackup.cron.log 2>&1
#
# Nordic-Backup (Oracle backup only)
03 23 * * 1-5 /usr/local/obm/bin/RunBackupSet.sh "Oracle RMAN" > /tmp/nordic-backup.log 2>&1
#
#
#Get Objectsize
30 07 * * 0 /bin/su - oracle -c "/u01/app/oracle/admin/XALP/scripts/storage/getobjectsize.sh XALP" >/dev/null 2>>/dev/null



07leoFADLToPOSTDK.pl

Created Friday 25 September 2020

#!/usr/bin/perl -w
#Torben : placering /home/eboks/bin
#
# PostDK, Version 1.0/01.02.2006
#
# Introduction
# ------------
# This is a sample Perl-script for uploading and downloading files
# to Post Danmark ftp/ssh-server, "ftpssh.post.dk", using sftp (ssh2).
#
# On some platforms, sftp requires entering a password, when authentication
# is based solely on login/password. The password cannot be piped or read
# from file, and requires user intervention. This introduces a problem for
# automation of file transfers.
#
# This script presents a method to automate sftp-based file transfers, by making
# it possible to enter login/password in the script.
#
# What does the script do?
# ------------------------
# 1) Uploads all files in local upload directory, by first placing files
# in remote home directory, and - if successful - moving the files to
# the remote upload directory, where PostDK will pick them up.
# If desired, successfully uploaded files will be deleted locally.
# 2) Download all files from the remote download directory, to the local
# download directory.
# If desired, successfully downloaded files will be deleted on the remote
# host.
#
# Preparing to run the script
# ---------------------------
# 1) Perl must be installed
# 2) Perl modules "Net::SSH::Perl" and "Net::SFTP" must be installed
# 3) Customize the script, entering your login/password etc..
#
# Performance of the script
# -------------------------
# Computation of keys, hashes etc. is done in perl-scripts, and performance
# suffers from this. Establishing the session will be significantly slower
# when running this script, and could take 1-2 minutes. Afterwards file
# tranfers are performing better, although they are slow compared to regular
# sftp. But overall, this script will do the job.
#
use strict;
# use Net::SSH::W32Perl; (Use this module for Windows2000/Windows2003)
use Time::Local ;
use Net::SSH::Perl;
use Net::SFTP;

# Where to find local files to be uploaded (enter your directory here)
my $local_upload_dir = "/mnt/epost/eboks/proces/" ;
# Where to place downloaded files (enter your directory here)
my $local_download_dir = "/mnt/epost/eboks/inbox/" ;
# Remote host (should not be changed)
my $remote_host = "ftpssh.post.dk" ; # ip = 193.3.125.70
# Remote login/password (enter your creditials here)
my $remote_login = "xibu55fadl" ;
my $remote_password = "y57rkvh270" ;
# Where to place files on remote server (should not be changed)
my $remote_upload_dir = "/upload/" ;
my $remote_home_dir = "/home/" ;
my $remote_download_dir = "/download/" ;
# Should remote files be deleted after successful download 0=No, 1=Yes
my $delete_remote_file_after_successful_download = 0 ;
# Should local files be deleted after successful upload 0=No, 1=Yes
my $delete_local_file_after_successful_upload = 0 ;
# Should sftp print debug information 0=No, 1=Yes
my $debug_sftp = 1 ;

my $transfer_active ;
my $transfers_succeeded ;
my $transfers_failed ;

my $temphold ;
my @temphold1 ;
my $hashkeys ;
my $a ;
my $b ;
my $filenamehold ;
my $localfile ;
my @localfiles ;
my $remotefile ;
my @remotefiles ;
my $sftp = undef ;
my $ret ;

sub timestamp {
my $sec = 0 ;
my $min = 0 ;
my $hour = 0 ;
my $mday = 0 ;
my $mon = 0 ;
my $year = 0 ;
my $wday = 0 ;
my $yday = 0 ;
my $isdst = 0 ;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime (time) ;
return sprintf "%04u\-%02u\-%02u %02u.%02u.%02u: ", (1900 + $year), (1 + $mon), $mday, $hour, $min, $sec ;
}

sub callback {

my($sftp, $data, $offset, $size) = @_;
$transfer_active++ ;
}

# Connect section BEGIN #####################################################
$sftp = undef;
print timestamp() . "Connecting to " . $remote_host . "...\n";
eval{

$sftp = Net::SFTP->new($remote_host,
user=>$remote_login,
password=>$remote_password,
debug=>$debug_sftp
);
};
if ($@) { print timestamp . "Sftp connection failed:\n $@\n"; }

if (! $sftp) {
print timestamp . "I can't connect!\n";
exit(1) ;
}else{
print timestamp . "Connected!\n";
}
# Connect section END #####################################################



# Upload section BEGIN #####################################################
opendir LOCAL_UPLOAD_DIR, $local_upload_dir || die "Could not access local upload dir.\n" ;
@localfiles = readdir LOCAL_UPLOAD_DIR ;
closedir LOCAL_UPLOAD_DIR ;
$transfers_succeeded = 0 ;
$transfers_failed = 0 ;

print timestamp . "Upload starting from local dir " . $local_upload_dir . "...\n" ;
foreach $filenamehold ( @localfiles)
{

$localfile = $local_upload_dir . $filenamehold ;
$remotefile = $remote_home_dir . $filenamehold ;
if (-d $localfile or $filenamehold eq '.' or $filenamehold eq '..') {
} else {
$transfer_active = 0 ;
$sftp->put($localfile,$remotefile,\&callback) ;
$a = $sftp->do_stat($remotefile) or return;
# Check if download was successful
if ((-s $localfile == $a->size) && (($transfer_active) || (-s $localfile == 0))) {
if ($sftp->do_rename($remotefile,$remote_upload_dir . $filenamehold)) {
$transfers_failed++ ;
print timestamp . "Upload of " . $localfile . " (" . (-s $localfile) . " bytes) to " . $remotefile . " failed (rename to " . $remote_upload_dir . " failed).\n" ;
} else {
$transfers_succeeded++ ;
print timestamp . "Upload of " . $localfile . " (" . (-s $localfile) . " bytes) to " . $remotefile . " succeeded.\n" ;
if ($delete_local_file_after_successful_upload) {
unlink $localfile ;
}
}
} else {
$transfers_failed++ ;
print timestamp . "Upload of " . $localfile . " (" . (-s $localfile) . " bytes) to " . $remotefile . " failed (upload to " . $remote_home_dir . " failed).\n" ;
}
}
}
print timestamp . "Upload completed, " . $transfers_succeeded . " file(s) succeeded, " . $transfers_failed . " file(s) failed.\n" ;
# Upload section END #####################################################



# Download section BEGIN #####################################################
@remotefiles = $sftp->ls($remote_download_dir);
$transfers_succeeded = 0 ;
$transfers_failed = 0 ;

print timestamp . "Download starting from remote dir " . $remote_download_dir . "...\n" ;
foreach $temphold( @remotefiles)
{
@temphold1 = keys %$temphold;
foreach $hashkeys ( @temphold1) {

if ($hashkeys eq "filename")
{
$filenamehold = $$temphold{$hashkeys};
if ($filenamehold eq '.' or $filenamehold eq '..') {
} else {
$remotefile = $remote_download_dir . $filenamehold;
$localfile = $local_download_dir . $filenamehold;
$a = $sftp->do_stat($remotefile) or return;
$transfer_active = 0 ;
$sftp->get($remotefile,$localfile,\&callback) ;
# Check if download was successful
if ((-e $localfile) && (-s $localfile == $a->size) && ($transfer_active)) {
print timestamp . "Download of " . $remotefile . " (" . $a->size . " bytes) to " . $localfile . " succeeded.\n" ;
$transfers_succeeded++ ;
if ($delete_remote_file_after_successful_download) {
$sftp->do_remove($remotefile);
}
} else {
$transfers_failed++ ;
print timestamp . "Download of " . $remotefile . " (" . $a->size . " bytes) to " . $localfile . " failed.\n" ;
}
}
}
}
}
print timestamp . "Download completed, " . $transfers_succeeded . " file(s) succeeded, " . $transfers_failed . " file(s) failed.\n" ;
# Download section END #####################################################


END



07leoFADLToPOSTDK.sh

Created Friday 25 September 2020

#!/bin/bash
#
#Torben : placering /home/eboks/bin
#
# $Id$
#
# Copyright (c) 2008, BASECARE, All rights reserved.
#
# NOTES
# SHELL script for epost transfer to PostDanmark
# script is used to ZIP and move PDF-files from FADL to PostDanmark
# PostDanmark does not support passwordless authentication -> using Perl
#
# Modify the variables to reflect settings
# BASE -> Directory for BASE
# POSTFIX -> File extension
# OUTBOX -> Directory for outgoing files
# INBOX -> Directory for incomming files
# PROCES -> Directory where file is to be processed
# ARCHIVE -> Directory where file is to be moved after processed.
# LOG -> Directory for logfile
# LOGFILE -> Filename for log
#
#
# MODIFIED (DD/MM-YYYY)
# apt 18/04-2008 - created
# apt 30/06-2008 - corrected script to handle space in file names
# apt 28/09-2010 - changed .pdf to .PDF
#
# set -x

# Source environment
#. /home/eboks/.bash_profile

progname=`basename $0`
today=`date '+%Y%m%d'`
BASE=/mnt/epost/eboks
POSTFIX=".PDF"
OUTBOX=${BASE}/outbox
INBOX=${BASE}/inbox # only used by perl script
PROCES=${BASE}/proces
ARCHIVE=${BASE}/arkiv
ARCHIVEPDF=${ARCHIVE}/${today}/
LOG=${BASE}/log
LOGFILE=${LOG}/FADLToPOSTDK.log
LOCKFILE=${BASE}/FADLToPOSTDK.lock
#
# <materialenr>_<fadl_jobid>.zip
#
ZIPFILE=`date '+ 26400_%Y%m%d.zip'`

createlogentry()
{
THISDATE=`date '+%d/%m-%Y %H:%M:%S'`
LOGTXT=$1
LOGFIL=$2
LOGTYPE=$3

if [ $LOGTYPE -eq 1 ]
then

echo "${THISDATE} $LOGTXT " >> $LOGFIL
else
echo "${THISDATE} $LOGTXT " >> $LOGFIL
fi
}

# Function terminate

terminate()
{
createlogentry " the execution of $progname was not successful" $LOGFILE 1
createlogentry " $progname terminated, exiting now with rc=1" $LOGFILE 1
rm -f $LOCKFILE
createlogentry "End script" $LOGFILE 1
exit 1
}

terminateOK()
{
createlogentry " $files files processed" $LOGFILE 1
rm -f $LOCKFILE
createlogentry "End script" $LOGFILE 1
exit 0
}

createlogentry "Begin script" $LOGFILE 1
#
# Test for lock file (only run one instance)
# and test for existing ZIP file
#

if [ -f $LOCKFILE ]
then
createlogentry " ERROR : lock file exist: ${LOCKFILE} " $LOGFILE 1
terminate
fi
touch $LOCKFILE

if [ -f $ZIPFILE ]
then
createlogentry " ERROR : ZIP file exist: ${ZIPFILE} " $LOGFILE 1
terminate
fi

#
# Test Directories
#

if [ ! -d $OUTBOX ]
then
createlogentry " ERROR : directory OUTBOX: $OUTBOX does not exist" $LOGFILE 1
terminate
fi
if [ ! -d $INBOX ]
then
createlogentry " ERROR : directory INBOX: $INBOX does not exist" $LOGFILE 1
terminate
fi
if [ ! -d $PROCES ]
then
createlogentry " ERROR : directory PROCES: $PROCES does not exist" $LOGFILE 1
terminate
fi
if [ ! -d $ARCHIVE ]
then
createlogentry " ERROR : directory ARCHIVE: $ARCHIVE does not exist" $LOGFILE 1
terminate
fi
if [ ! -d $LOG ]
then
createlogentry " ERROR : directory LOG: $LOG does not exist" $LOGFILE 1
terminate
fi

#
# Header section
#
# createlogentry "===================================================================" $LOGFILE 1
# createlogentry "BEGIN : `date '+ %m/%d-20%y %H:%M:%S'` "
# createlogentry "-------------------------------------------------------------------" $LOGFILE 1
# createlogentry "OUTBOX : $OUTBOX " $LOGFILE 1
# createlogentry "INBOX : $INBOX " $LOGFILE 1
# createlogentry "PROCES : $PROCES " $LOGFILE 1
# createlogentry "ARCHIVE : $ARCHIVE " $LOGFILE 1
# createlogentry "ZIPFILE : $ZIPFILE " $LOGFILE 1
# createlogentry "-------------------------------------------------------------------" $LOGFILE 1
#
#
# Check for new files to proces
#
files=`expr 0`
for file in $OUTBOX/*$POSTFIX
do
if [ -f "$file" ]
then

files=`expr $files + 1`
fi
done

if [ ! $files -gt 0 ]
then
terminateOK
fi

#
# CD to PROCES directory
#
cd $PROCES

files=`expr 0`
for file in $PROCES/*$POSTFIX
do
if [ -f "$file" ]
then

files=`expr $files + 1`
fi
done

if [ $files -gt 0 ]
then
createlogentry " ERROR : directory $PROCES is NOT empty" $LOGFILE 1
terminate
fi

#
# Begin processing
#
files=`expr 0`
for file in $OUTBOX/*$POSTFIX
do
if [ -f "$file" ]
then

# Move file to proces
mv "$file" $PROCES
retval=$?
file2Proces=$PROCES/`basename "$file"`
if [ $retval -eq 0 ]
then
createlogentry " processing file : `basename $file` " $LOGFILE 1
else
createlogentry " ERROR : moving file to PROCES directory failed" $LOGFILE 1
terminate
fi
files=`expr $files + 1`
fi
done
#
# ZIP files
#
createlogentry " Creating ZIP file " $LOGFILE 1
zip ${ZIPFILE} *${POSTFIX} > /dev/null 2>&1
retval=$?
if [ $retval -eq 0 ]
then
createlogentry " ZIP file created successfully " $LOGFILE 1
else
createlogentry " ERROR : ZIP failed with return code $retval " $LOGFILE 1
terminate
fi

#
# move pdf files to archive
#
mkdir ${ARCHIVEPDF}
retval=$?
if [ $retval -eq 0 ]
then
createlogentry " created pdf archive directory successfully " $LOGFILE 1
else
createlogentry " ERROR : creating PDF archive directory failed with return code $retval " $LOGFILE 1
terminate
fi
mv *${POSTFIX} ${ARCHIVEPDF}
retval=$?
if [ $retval -eq 0 ]
then
createlogentry " pdf moved to archive successfully " $LOGFILE 1
else
createlogentry " ERROR : moving pdf to archive failed with return code $retval " $LOGFILE 1
terminate
fi

#
# send/receive files with Post Danmark
#
perl ${HOME}/bin/FADLToPOSTDK.pl >> ${LOG}/FADLToPOSTDK.pl.log 2>&1
retval=$?
if [ $retval -eq 0 ]
then
createlogentry " communication with Post Danmark completed successfully " $LOGFILE 1
else
createlogentry " ERROR : communication with Post Danmark failed with return code $retval " $LOGFILE 1
terminate
fi

#
# move zip to archive
#
mv ${ZIPFILE} ${ARCHIVE}
retval=$?
if [ $retval -eq 0 ]
then
createlogentry " ZIP moved to archive successfully " $LOGFILE 1
else
createlogentry " ERROR : moving ZIP to archive failed with return code $retval " $LOGFILE 1
terminate
fi

terminateOK



07smb.conf

Created Friday 25 September 2020
.
.
.
# workgroup = NT-Domain-Name or Workgroup-Name
## BASECARE/apt, 20080305
workgroup = FADL
.
.
# server string is the equivalent of the NT Description field
## BASECARE/apt, 20080305
server string = Oracle Database Server
.
.
security = share
.
.
[epost]
comment = XAL - ebox og efaktura
path = /mnt/epost
public = yes
writable = yes
only guest = yes
browsable = yes
printable = no
create mask = 0770
directory mask =0770
force group = epost



10.1.0.7

Created Friday 25 September 2020

07smb.conf

07leoFADLToPOSTDK.sh

07leoFADLToPOSTDK.pl

07crontab



10.1.0.15

Created Friday 25 September 2020

ubuntudev


15fstab

15systemrapport.sh

15raidmonitor.sh

15scrub_md0.sh

15scrub_md1.sh

15test.sh

15root



10.1.0.16

Created Saturday 26 September 2020

asterisk


modermaskine10.1.0.35



10.1.0.17

Created Wednesday 13 January 2021

klient10.1.0.44
klient10.1.0.45

17scripts

17pv

17vg

17lv

17virsh




10.1.0.21

Created Sunday 27 September 2020

ubuntu18a


modermaskine10.1.0.22

18anotat



10.1.0.22

Created Saturday 26 September 2020

testserver


klient10.1.0.21

klient10.1.0.yy

22notat

22pv

22vg

22lv



10.1.0.24

Created Saturday 22 May 2021

port 22
adgang mangler



10.1.0.26

Created Saturday 26 September 2020

wordpress2


modermaskine10.1.0.35

26rc.local

26crontab

26root



10.1.0.27

Created Friday 25 September 2020

webbooking


modermaskine10.1.0.35

27sqlsave.sh

27crontab

27rc.local

27SQL_backup.sh

27SQL_restore.sh

27root

Mem: 6111824k total ifølge top

mysql -V -> mysql Ver 14.14 Distrib 5.5.54, for debian-linux-gnu (x86_64) using readline 6.2 (2020/11/15)
mysql 1195 5.4 1.4 1929448 90608 ? Ssl Sep01 5877:27 /usr/sbin/mysqld (knap 2Gb mem. brugt)

php -v -> PHP 5.3.10-1ubuntu3.26 with Suhosin-Patch (cli) (built: Feb 13 2017 20:37:53) (2020/11/15)



10.1.0.28

Created Friday 25 September 2020

28sqlfetch.sh

28sqlfetch mit fadl dk.sh

rc.local

hosts

KiB Mem : 8167544 total ifølge top (2020/11/15)

mysql -V -> mysql Ver 14.14 Distrib 5.7.32, for Linux (x86_64) using EditLine wrapper (2020/11/15)
mysql 2603 0.1 2.3 1818220 192552 ? Sl okt28 26:47 /usr/sbin/mysqld (1,8 Gb mem. brugt)

php -v -> PHP 7.2.24-0ubuntu0.18.04.7 (cli) (built: Oct 7 2020 15:24:25) ( NTS ) (2020/11/15)



10.1.0.32

Created Monday 28 September 2020

32rc.local

32crontab

32rootcrontab

32root

32sqlfetch.sh

32sqlfetch_mit_fadl_dk.dk

32SQL_backup.sh

32SQL_restore.sh

32SQLrestore_mit_fadl_dk.sh

32tmpmountINFO.txt



10.1.0.35

Created Friday 25 September 2020

websme


klient10.1.0.16

klient10.1.0.26

klient10.1.0.27

klient10.1.0.38

35scripts

35root

35pv

35vg

35lv





10.1.0.38

Created Saturday 26 September 2020

SMEserver


modermaskine10.1.0.35



10.1.0.44

Created Wednesday 13 January 2021

modermaskine10.1.0.17

Er konfigureret som 10.1.0.27 og skal erstatte den.



10.1.0.45

Created Wednesday 13 January 2021

modermaskine10.1.0.17



10.1.0.52

Created Wednesday 25 November 2020

2020fadldk
ubuntu 18.04

modermaskine10.1.0.53



10.1.0.53

Created Saturday 26 September 2020

virtmedlemssystem

klient10.1.0.52

klient10.1.0.54

klient10.1.0.55

53crontab

53rc.local

53pv

53vg

53lv

53root



10.1.0.54

Created Friday 25 September 2020

medlemssystem


modermaskine10.1.0.53

54crontab

54sqlsave.sh

54rc.local

54SQL_restore.sh

54SQL_backup.sh

54scanjob.sh

54root



10.1.0.55

Created Sunday 27 September 2020

modermaskine10.1.0.53


55rc.local

55crontab

55root





15copystatus.sh

Created Monday 28 September 2020

#!/bin/bash
scp -o port=2233 /home/fadl/10.1.0.15_systemrapport.html root@10.1.0.28:/var/www/monitor/



15fstab

Created Friday 25 September 2020

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=56416c25-924b-45a6-a775-083b948065cc / ext4 errors=remount-ro 0 1
# /home was on /dev/sdc1 during installation
UUID=b8e87ff0-f97e-4f39-b76c-4c6d1b9a2dba /home ext4 defaults 0 2
# swap was on /dev/sda2 during installation
UUID=9c7bab83-dbe5-4b67-a85b-4030d8a54dea none swap sw 0 0
# swap was on /dev/sdc2 during installation
UUID=11a85f16-52df-412f-87c6-56effb7c2a55 none swap sw 0 0
/dev/vg0/sqlbackups /home/fadl/mountpoint_for_sqlbackups ext4 defaults 0 0



15raidmonitor.sh

Created Friday 25 September 2020

#!/bin/bash
ADMIN="leo@fadl.dk"
HOSTNAME="10.1.0.15"

if egrep "\[.*_.*\]" /proc/mdstat > /dev/null
then

/usr/bin/sendemail -f udvikling@fadl.dk -t ${ADMIN} -s mail.fadl.dk -u "RAID fejl!" -m "Fejl paa en eller flere software RAID \
enheder on ${HOSTNAME}"
fi



15root

Created Monday 28 September 2020

15copystatus.sh

15systemrapport.sh



15scrub md0.sh

Created Friday 25 September 2020

#!/bin/sh
cat /sys/block/md0/md/mismatch_cnt>/home/fadl/md0_check.txt
echo check >/sys/block/md0/md/sync_action
sleep 240
cat /proc/mdstat>>/home/fadl/md0_check.txt



15scrub md1.sh

Created Friday 25 September 2020

#!/bin/sh
cat /sys/block/md1/md/mismatch_cnt>/home/fadl/md1_check.txt
echo check >/sys/block/md1/md/sync_action
sleep 240
cat /proc/mdstat>>/home/fadl/md1_check.txt



15systemrapport.sh

Created Friday 25 September 2020

#!/bin/bash

function linie {
echo "- - - - - - - - - - - - - - - - - - - -<BR>">>nyrap.html
}

cd /home/fadl
ip=$(/sbin/ifconfig|grep 0.15|awk {'print $2'})

#begynd at opbygge nyrap.html
echo "<!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.0 Transitional//EN">" > nyrap.html
echo "<HTML>" >> nyrap.html
echo "<HEAD>" >> nyrap.html
echo "<META NAME="Description" CONTENT="generated_by_Linux_autoindex">" >> nyrap.html
echo "<META HTTP-EQUIV=CONTENT-TYPE CONTENT=text/html; charset=iso-8859-15>" >> nyrap.html
echo "<META NAME="robots" content="noindex,nofollow">" >> nyrap.html
echo "<TITLE>Systemrapport</TITLE>" >> nyrap.html
echo "</HEAD>" >> nyrap.html
echo "<BODY LANG="da-DK" DIR="LTR">" >> nyrap.html
echo "<p align=center><font face=Verdana>rapport fra 10.1.0.15<BR>" >> nyrap.html
echo "<p align=center><font face=Verdana>$ip<BR>" >> nyrap.html
date >> nyrap.html
echo "<BR></p><PRE>" >> nyrap.html

df -hP|while read line
do
echo $line>>nyrap.html
#echo "<BR>">>nyrap.html
done

linie
/sbin/mdadm --detail /dev/md0>>nyrap.html
linie
/sbin/mdadm --detail /dev/md1>>nyrap.html
linie
cat /proc/mdstat>>nyrap.html
linie
for i in `seq 0 1`;
do
if [ -e "md"$i"_check.txt" ];
then
echo "periodisk check af RAID integritet md"$i>>nyrap.html
stat --format=%z md$i"_check.txt">>nyrap.html
cat md$i"_check.txt">>nyrap.html
linie
#mv -f "md"$i"_check.txt" "md"$i"_check.old"
fi
done

linie
vnstat -d>>nyrap.html
echo "</PRE></BODY>" >> nyrap.html
echo "</HTML>" >> nyrap.html
rm -f 10.1.0.15_systemrapport.html
cp -f nyrap.html 10.1.0.15_systemrapport.html
rm -f nyrap.html



15test.sh

Created Friday 25 September 2020

#!/bin/bash
ADMIN="leo@fadl.dk"
HOSTNAME="10.1.0.15"


/usr/bin/sendemail -f udvikling@fadl.dk -t ${ADMIN} -s mail.fadl.dk -u "RAID fejl!" -m "Fejl paa en eller flere software RAID \
enheder on ${HOSTNAME}"



17backup44.sh

Created Saturday 15 May 2021

#!/bin/bash
#LVM backup script tager backup af webbooking paa 10.1.0.44 (linuxdelen)
#LV2021/01/12
#
# restore:installer pv og eksekver som nedenfor
# pv backupfilnavn.gz | gzip -d | dd of=/dev/vgX/partition
# editer/kopier /etc/libvirt/qemu/navn_paa_maskine
# virsh define den nye maskine
#
snapvg="/dev/vg0"
lvol="webbooking"
backupstore="/home/fadl/backup/snapshots/webbooking44/"
mailserver="smtp-relay.gmail.com"
todaysdate=`date "+%Y-%m-%d"`

trap 'cleanup;exit 1' 1 2

cleanup()
{
/sbin/lvremove -f $snapvg/$lvol-snapshot
echo "###--cleanup executed--###" >> /var/log/lvmbackup.log
}

echo "-----------------------------" >> /var/log/lvmbackup.log
date >> /var/log/lvmbackup.log 2>&1

/sbin/lvcreate -L 1G -s -n $lvol-snapshot $snapvg/$lvol >> /var/log/lvmbackup.log 2>&1
echo "backup of $lvol"

/bin/dd if=$snapvg/$lvol-snapshot bs=4k | /bin/gzip>$backupstore$lvol.$todaysdate.gz

if [ "$?" -eq 1 ]
then

echo -e "*Webbooking-SCRIPT FAILED, THERE WERE ERRORS*" >> /var/log/lvmbackup.log 2>&1
date >> /var/log/lvmbackup.log 2>&1
/sbin/lvremove -f $snapvg/$lvol-snapshot
/root/scripts/sendemail -f admin@fadl.dk -t tsh@fadl.dk -s $mailserver -u "Backup af webbooking44 fejlede!" -m "backup log"
#slet ikke-afsluttet backup
rm -f $backupstore$lvol.$todaysdate.gz
exit 1
else
echo -e "backup of $lvol done OK!" >> /var/log/lvmbackup.log 2>&1
date >> /var/log/lvmbackup.log 2>&1
#slet tidligere backup
rm -f $backupstore$lvol.gz
#rename backupfil
mv -f $backupstore$lvol.$todaysdate.gz $backupstore$lvol.gz
fi

/sbin/lvremove -f $snapvg/$lvol-snapshot



17backup45.sh

Created Saturday 15 May 2021

#!/bin/bash
#LVM backup script tager backup af webbooking paa 10.1.0.45 (linuxdelen)
#LV2021/01/12
#
# restore:installer pv og eksekver som nedenfor
# pv backupfilnavn.gz | gzip -d | dd of=/dev/vgX/partition
# editer/kopier /etc/libvirt/qemu/navn_paa_maskine
# virsh define den nye maskine
#
snapvg="/dev/vg0"
lvol="freja"
backupstore="/home/fadl/backup/snapshots/freja45/"
mailserver="smtp-relay.gmail.com"
todaysdate=`date "+%Y-%m-%d"`

trap 'cleanup;exit 1' 1 2

cleanup()
{
/sbin/lvremove -f $snapvg/$lvol-snapshot
echo "###--cleanup executed--###" >> /var/log/lvmbackup.log
}

echo "-----------------------------" >> /var/log/lvmbackup.log
date >> /var/log/lvmbackup.log 2>&1
/sbin/lvcreate -L 1G -s -n $lvol-snapshot $snapvg/$lvol >> /var/log/lvmbackup.log 2>&1
echo "backup of $lvol"

/bin/dd if=$snapvg/$lvol-snapshot bs=4k | /bin/gzip>$backupstore$lvol.$todaysdate.gz

if [ "$?" -eq 1 ]
then

echo -e "*Webbooking-SCRIPT FAILED, THERE WERE ERRORS*" >> /var/log/lvmbackup.log 2>&1
date >> /var/log/lvmbackup.log 2>&1
/sbin/lvremove -f $snapvg/$lvol-snapshot
/root/scripts/sendemail -f admin@fadl.dk -t tsh@fadl.dk -s $mailserver -u "Backup af freja45 fejlede!" -m "backup log"
#slet ikke-afsluttet backup
rm -f $backupstore$lvol.$todaysdate.gz
exit 1
else
echo -e "backup of $lvol done OK!" >> /var/log/lvmbackup.log 2>&1
date >> /var/log/lvmbackup.log 2>&1

#slet tidligere backup
rm -f $backupstore$lvol.gz
#rename backupfil
mv -f $backupstore$lvol.$todaysdate.gz $backupstore$lvol.gz
fi

/sbin/lvremove -f $snapvg/$lvol-snapshot




17copystatus.sh

Created Sunday 16 May 2021

#!/bin/bash
scp -o port=2233 /home/fadl/10.1.0.17_systemrapport.html root@10.1.0.28:/var/www/monitor/



17lv

Created Saturday 15 May 2021

--- Logical volume ---
LV Path /dev/vg0/webbooking
LV Name webbooking
VG Name vg0
LV UUID DUeuSu-oYsD-4qGX-D8eL-hYHM-UYm6-fQWIPB
LV Write Access read/write
LV Creation host, time vmwebbooking, 2021-01-12 13:59:41 +0100
LV Status available
# open 1
LV Size 100.00 GiB
Current LE 25600
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

--- Logical volume ---
LV Path /dev/vg0/freja
LV Name freja
VG Name vg0
LV UUID PxBAMN-EoN7-NyT0-pCOA-vFou-Tq5b-Hsekg2
LV Write Access read/write
LV Creation host, time vmwebbooking, 2021-01-12 14:02:45 +0100
LV Status available
# open 1
LV Size 100.00 GiB
Current LE 25600
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1



17pv

Created Saturday 15 May 2021

pvdisplay
--- Physical volume ---
PV Name /dev/md0
VG Name vg0
PV Size 447.00 GiB / not usable 4.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 114432
Free PE 63232
Allocated PE 51200
PV UUID 3LTvDb-y1bk-vmHu-QutP-otiP-d5vM-qc2lAF



17raidmonitor.sh

Created Saturday 15 May 2021

#!/bin/bash
ADMIN="leo@fadl.dk"
HOSTNAME="10.1.0.17"
MAILSERVER="smtp-relay.gmail.com"

if egrep "\[.*_.*\]" /proc/mdstat > /dev/null
then
/usr/bin/sendemail -f udvikling@fadl.dk -t ${ADMIN} -s ${MAILSERVER} -u "RAID fejl!" -m "Fejl paa en eller flere software RAID \
enheder on ${HOSTNAME}"
fi



17rc.local

Created Sunday 16 May 2021

#LV20210516
mount -t cifs //10.1.0.57/Maskiner /home/fadl/backup -o credentials=/home/fadl/.cred1/MyBackup,user=fadl,uid=fadl,gid=users,vers=2.0
#



17scripts

Created Saturday 15 May 2021

17backup44.sh

17backup45.sh

17raidmonitor.sh

17scrub_md0.sh

17systemrapport.sh

17copystatus.sh

17rc.local



17scrub md0.sh

Created Saturday 15 May 2021

#!/bin/sh
cat /sys/block/md0/md/mismatch_cnt>/home/fadl/md0_check.txt
echo check >/sys/block/md0/md/sync_action
sleep 240
cat /proc/mdstat>>/home/fadl/md0_check.txt



17systemrapport.sh

Created Saturday 15 May 2021

#!/bin/bash

function linie {

echo "- - - - - - - - - - - - - - - - - - - -<BR>">>nyrap.html
}

cd /home/fadl
ip=$(/sbin/ifconfig|grep 0.35|awk {'print $2'})

#begynd at opbygge nyrap.html
echo "<!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.0 Transitional//EN">" > nyrap.html
echo "<HTML>" >> nyrap.html
echo "<HEAD>" >> nyrap.html
echo "<META NAME="Description" CONTENT="generated_by_Linux_autoindex">" >> nyrap.html
echo "<META HTTP-EQUIV=CONTENT-TYPE CONTENT=text/html; charset=iso-8859-15>" >> nyrap.html
echo "<META NAME="robots" content="noindex,nofollow">" >> nyrap.html
echo "<TITLE>Systemrapport</TITLE>" >> nyrap.html
echo "</HEAD>" >> nyrap.html
echo "<BODY LANG="da-DK" DIR="LTR">" >> nyrap.html
echo "<p align=center><font face=Verdana>rapport fra 10.1.0.17<BR>" >> nyrap.html
echo "<p align=center><font face=Verdana>$ip<BR>" >> nyrap.html
date >> nyrap.html
echo "<BR></p><PRE>" >> nyrap.html

df -hP|while read line
do

echo $line>>nyrap.html
#echo "<BR>">>nyrap.html
done

linie/sbin/mdadm --detail /dev/md0>>nyrap.html
linie
cat /proc/mdstat>>nyrap.html
linie
for i in `seq 0 1`;
do
if [ -e "md"$i"_check.txt" ];
then
echo "periodisk check af RAID integritet md"$i>>nyrap.html
stat --format=%z md$i"_check.txt">>nyrap.html
cat md$i"_check.txt">>nyrap.html
linie
mv -f "md"$i"_check.txt" "md"$i"_check.old"
fi
done
linie
vnstat -d>>nyrap.html
echo "</PRE></BODY>" >> nyrap.html
echo "</HTML>" >> nyrap.html
rm -f 10.1.0.17_systemrapport.html
cp -f nyrap.html 10.1.0.17_systemrapport.html
rm -f nyrap.html



17vg

Created Saturday 15 May 2021

--- Volume group ---
VG Name vg0
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 447.00 GiB
PE Size 4.00 MiB
Total PE 114432
Alloc PE / Size 51200 / 200.00 GiB
Free PE / Size 63232 / 247.00 GiB
VG UUID s3aMXi-Bd5P-Jad0-2ryK-lEIC-diDj-fA5IMR



17virsh

Created Saturday 15 May 2021

virsh list
Id Name State


1 freja running
2 webbooking running



18ahistory

Created Sunday 27 September 2020

1 sudo su

2 exit
3 ip a
4 sudo su
5 exit
6 cd
7 ll
8 mkdir LV
9 cp /etc/netplan/01-netcfg.yaml .
10 ll
11 mv 01-netcfg.yaml LV/
12 cd LV
13 ll
14 mv 01-netcfg.yaml 01-netcfg.yaml.21
15 ll
16 exit
17 sudo apt-get install nmap
18 sudo nmap -vv localhost
19 man ss
20 ss -li
21 q
22 exit
23 ss -lntu
24 q
25 exot
26 exit
27 sudo useradd -m -d /home/fadl leo
28 passwd leo
29 sudo passwd leo
30 exit
31 sudo passwd fadl
32 exit
33 ll
34 exit
35 sudo nano /etc/apt/sources.list
36 wget http://www.webmin.com/jcameron-key.asc
37 sudo apt-key add jcameron-key.asc
38 sudo apt update
39 sudo apt install webmin
40 sudo passwd
41 su
42 ps -ef |grep webmin
43 exit
44 sudo su
45 exit
46 sudo su
47 exit
48 sudo su
49 screen -r
50 sudo service ssh restart
51 psg ssh
52 ps -ef|grep ssh
53 exit
54 sudo systemctl stop mysql.service
55 sudo systemctl status mysql.service
56 mysqld_safe --skip-grant-tables
57 mysql -u root
58 sudo systemctl start mysql.service
59 mysql -u root
60 exit
61 psg
62 history
63 sudo systemctl status mysql.service
64 sudo systemctl stop mysql.service
65 sudo systemctl status mysql.service
66 mysqld_safe --skip-grant-tables
67 sudo mysqld_safe --skip-grant-tables
68 cat /var/log/mysql/error.log
69 ls /var/run/mysqld
70 mkdir -p /var/run/mysqld
71 sudo mkdir -p /var/run/mysqld
72 sudo chown mysql:mysql /var/run/mysqld
73 ls /var/run/mysqld
74 ls /var/run/
75 ll /var/run/
76 sudo mysqld_safe --skip-grant-tables
77 ps -ef|grep mysql
78 mysql -u root
79 mysql -u root -p
80 sudo systemctl stop mysql.service
81 ps -ef|grep mysql
82 sudo systemctl stop mysqld_safe
83 sudo systemctl stop mysql
84 ps -ef|grep mysql
85 cat /var/log/mysql/error.log
86 sudo ll /var/lib/mysql
87 sudo ls -l /var/lib/mysql
88 sudo ls -l /var/run/mysqld
89 kill `cat /var/run/mysqld/mysqld.pid`
90 sudo kill `cat /var/run/mysqld/mysqld.pid`
91 cd /var/run/mysqld
92 ll
93 sudo cat mysqld.pid
94 kill `cat mysqld.pid`
95 sudo kill `cat mysqld.pid`
96 ps -ef|grep mysql
97 cat mysqld.pid
98 sudo cat mysqld.pid
99 kill 2246
100 sudo kill 2246
101 ps -ef|grep mysql
102 cd
103 ll
104 vi mysql-init
105 ll
106 chown fadl:mysql mysql-init
107 sudo chown fadl:mysql mysql-init
108 ll
109 mysqld --init-file=/home/fadl/mysql-init &
110 sudo mysqld --init-file=/home/fadl/mysql-init &
111 mysql -u root -p
112 ps -ef|grep mysql
113 sudo service mysql start
114 ps -ef|grep mysql
115 mysql -u root -p
116 ps -ef|grep mysql
117 sudo service mysql stop
118 ps -ef|grep mysql
119 sudo mysqld --init-file=/home/fadl/mysql-init &
120 mysql -u root -p
121 ll /var/run/mysqld/mysqld.sock
122 ll /var/run/mysqld/
123 sudo ls -l /var/run/mysqld/
124 sudo ls -l /var/run/
125 cat /etc/mysql/my.cnf
126 ll /etc/mysql/conf.d/
127 cat /etc/mysql/mysql.conf.d/mysqld.cnf
128 ll /etc/mysql/conf.d/
129 cat /etc/mysql/mysql.conf.d/mysqld.cnf
130 sudo find / -type s | grep mysqld.sock
131 cd /erc/mysq
132 cd /etc/mysql/
133 ll
134 less mysql.cnf
135 ll
136 cd mysql.conf.d/
137 ll
138 less mysqld.cnf
139 ll
140 ll /var/run/
141 ll
142 cd
143 sudo mkdir -p /var/run/mysqld
144 sudo chown mysql /var/run/mysqld/
145 ps -ef|grep mysql
146 service mysql start
147 sudo service mysql start
148 ps -ef|grep mysql
149 mysql -u root -p
150 ps -ef|grep mysql
151 kill 2978
152 sudo kill 2978
153 ps -ef|grep mysql
154 cd
155 ll
156 sudo mysqld --init-file=/home/fadl/mysql-init &
157 mysql -u root -p
158 ps -ef|grep mysql
159 ll /var/run/mysqld/mysqld.sock
160 ll /var/run/mysqld/
161 ll /var/run/
162 sudo mkdir -p /var/run/mysqld
163 ll /var/run/
164 sudo chown mysql /var/run/mysqld/
165 ll /var/run/
166 sudo service mysql restart
167 ps -ef|grep mysql
168 mysql -u root -p
169 ll /var/run/
170 ll /var/run/mysqld/
171 sudo service mysql stop
172 ll /var/run/mysqld/
173 sudo service mysql start
174 ll /var/run/mysqld/
175 sudo service mysql stop
176 ll
177 mysql -u root -p
178 ps -ef|grep mysql
179 history|grep mysqld
180 ps -ef|grep mysql
181 ll
182 rm mysql-init
183 ll
184 ps -ef|grep mysql
185 mysqld_safe --skip-grant-tables
186 sudo mysqld_safe --skip-grant-tables
187 mysql
188 ll /var/log/
189 ll mysql
190 ll /var/log/mysql/
191 sudo mysqld_safe --skip-grant-tables
192 ll /var/run
193 ll /var/run/
194 sudo mysqld_safe --skip-grant-tables
195 sudo mkdir -p /var/run/mysqld
196 sudo chown mysql /var/run/mysqld/
197 sudo mysqld_safe --skip-grant-tables
198 sudo chown mysql /var/run/mysqld/
199 sudo mysqld_safe --skip-grant-tables &
200 mysql
201 ps -ef|grep mysql
202 sudo kill 5559
203 ps -ef|grep mysql
204 service mysql start
205 sudo service mysql start
206 ps -ef|grep mysql
207 mysql
208 mysql -u root -p
209 exit
210 screen
211 screen -r
212 ps -ef|grep mysql
213 kill 5035
214 sudo kill 5035
215 ps -ef|grep mysql
216 screen -r
217 psg mysql
218 ps -ef|grep mysql
219 ll /var/run/mysqld/
220 ll /run/mysqld/
221 exit
222 cd /etc/netplan/
223 ll
224 cat 01-netcfg.yaml
225 cat 01-netcfg.yaml.ORG
226 exit
227 sudo su
228 exit
229 history
230 sudo su
231 exit
232 sudo su
233 exit
234 virsh list
235 ll
236 ll LV/
237 cat /etc/crontab
238 ll
239 sudo su
240 ll
241 cat LV
242 cd LV/
243 ll
244 cat 01-netcfg.yaml.21
245 cd
246 ll
247 less jcameron-key.asc
248 history
249 history>hist.txt



18anotat

Created Sunday 27 September 2020

cat 01-netcfg.yaml.21
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:

ens3:
dhcp4: no
addresses: [10.1.0.21/24, ]
gateway4: 10.1.0.1
nameservers:
addresses: [8.8.8.8,208.67.220.220]

18ahistory

18aroothistory




18ahist

1 sudo su
2 exit
3 ip a
4 sudo su
5 exit
6 cd
7 ll
8 mkdir LV
9 cp /etc/netplan/01-netcfg.yaml .
10 ll
11 mv 01-netcfg.yaml LV/
12 cd LV
13 ll
14 mv 01-netcfg.yaml 01-netcfg.yaml.21
15 ll
16 exit
17 sudo apt-get install nmap
18 sudo nmap -vv localhost
19 man ss
20 ss -li
21 q
22 exit
23 ss -lntu
24 q
25 exot
26 exit
27 sudo useradd -m -d /home/fadl leo
28 passwd leo
29 sudo passwd leo
30 exit
31 sudo passwd fadl
32 exit
33 ll
34 exit
35 sudo nano /etc/apt/sources.list
36 wget http://www.webmin.com/jcameron-key.asc
37 sudo apt-key add jcameron-key.asc
38 sudo apt update
39 sudo apt install webmin
40 sudo passwd
41 su
42 ps -ef |grep webmin
43 exit
44 sudo su
45 exit
46 sudo su
47 exit
48 sudo su
49 screen -r
50 sudo service ssh restart
51 psg ssh
52 ps -ef|grep ssh
53 exit
54 sudo systemctl stop mysql.service
55 sudo systemctl status mysql.service
56 mysqld_safe --skip-grant-tables
57 mysql -u root
58 sudo systemctl start mysql.service
59 mysql -u root
60 exit
61 psg
62 history
63 sudo systemctl status mysql.service
64 sudo systemctl stop mysql.service
65 sudo systemctl status mysql.service
66 mysqld_safe --skip-grant-tables
67 sudo mysqld_safe --skip-grant-tables
68 cat /var/log/mysql/error.log
69 ls /var/run/mysqld
70 mkdir -p /var/run/mysqld
71 sudo mkdir -p /var/run/mysqld
72 sudo chown mysql:mysql /var/run/mysqld
73 ls /var/run/mysqld
74 ls /var/run/
75 ll /var/run/
76 sudo mysqld_safe --skip-grant-tables
77 ps -ef|grep mysql
78 mysql -u root
79 mysql -u root -p
80 sudo systemctl stop mysql.service
81 ps -ef|grep mysql
82 sudo systemctl stop mysqld_safe
83 sudo systemctl stop mysql
84 ps -ef|grep mysql
85 cat /var/log/mysql/error.log
86 sudo ll /var/lib/mysql
87 sudo ls -l /var/lib/mysql
88 sudo ls -l /var/run/mysqld
89 kill `cat /var/run/mysqld/mysqld.pid`
90 sudo kill `cat /var/run/mysqld/mysqld.pid`
91 cd /var/run/mysqld
92 ll
93 sudo cat mysqld.pid
94 kill `cat mysqld.pid`
95 sudo kill `cat mysqld.pid`
96 ps -ef|grep mysql
97 cat mysqld.pid
98 sudo cat mysqld.pid
99 kill 2246
100 sudo kill 2246
101 ps -ef|grep mysql
102 cd
103 ll
104 vi mysql-init
105 ll
106 chown fadl:mysql mysql-init
107 sudo chown fadl:mysql mysql-init
108 ll
109 mysqld --init-file=/home/fadl/mysql-init &
110 sudo mysqld --init-file=/home/fadl/mysql-init &
111 mysql -u root -p
112 ps -ef|grep mysql
113 sudo service mysql start
114 ps -ef|grep mysql
115 mysql -u root -p
116 ps -ef|grep mysql
117 sudo service mysql stop
118 ps -ef|grep mysql
119 sudo mysqld --init-file=/home/fadl/mysql-init &
120 mysql -u root -p
121 ll /var/run/mysqld/mysqld.sock
122 ll /var/run/mysqld/
123 sudo ls -l /var/run/mysqld/
124 sudo ls -l /var/run/
125 cat /etc/mysql/my.cnf
126 ll /etc/mysql/conf.d/
127 cat /etc/mysql/mysql.conf.d/mysqld.cnf
128 ll /etc/mysql/conf.d/
129 cat /etc/mysql/mysql.conf.d/mysqld.cnf
130 sudo find / -type s | grep mysqld.sock
131 cd /erc/mysq
132 cd /etc/mysql/
133 ll
134 less mysql.cnf
135 ll
136 cd mysql.conf.d/
137 ll
138 less mysqld.cnf
139 ll
140 ll /var/run/
141 ll
142 cd
143 sudo mkdir -p /var/run/mysqld
144 sudo chown mysql /var/run/mysqld/
145 ps -ef|grep mysql
146 service mysql start
147 sudo service mysql start
148 ps -ef|grep mysql
149 mysql -u root -p
150 ps -ef|grep mysql
151 kill 2978
152 sudo kill 2978
153 ps -ef|grep mysql
154 cd
155 ll
156 sudo mysqld --init-file=/home/fadl/mysql-init &
157 mysql -u root -p
158 ps -ef|grep mysql
159 ll /var/run/mysqld/mysqld.sock
160 ll /var/run/mysqld/
161 ll /var/run/
162 sudo mkdir -p /var/run/mysqld
163 ll /var/run/
164 sudo chown mysql /var/run/mysqld/
165 ll /var/run/
166 sudo service mysql restart
167 ps -ef|grep mysql
168 mysql -u root -p
169 ll /var/run/
170 ll /var/run/mysqld/
171 sudo service mysql stop
172 ll /var/run/mysqld/
173 sudo service mysql start
174 ll /var/run/mysqld/
175 sudo service mysql stop
176 ll
177 mysql -u root -p
178 ps -ef|grep mysql
179 history|grep mysqld
180 ps -ef|grep mysql
181 ll
182 rm mysql-init
183 ll
184 ps -ef|grep mysql
185 mysqld_safe --skip-grant-tables
186 sudo mysqld_safe --skip-grant-tables
187 mysql
188 ll /var/log/
189 ll mysql
190 ll /var/log/mysql/
191 sudo mysqld_safe --skip-grant-tables
192 ll /var/run
193 ll /var/run/
194 sudo mysqld_safe --skip-grant-tables
195 sudo mkdir -p /var/run/mysqld
196 sudo chown mysql /var/run/mysqld/
197 sudo mysqld_safe --skip-grant-tables
198 sudo chown mysql /var/run/mysqld/
199 sudo mysqld_safe --skip-grant-tables &
200 mysql
201 ps -ef|grep mysql
202 sudo kill 5559
203 ps -ef|grep mysql
204 service mysql start
205 sudo service mysql start
206 ps -ef|grep mysql
207 mysql
208 mysql -u root -p
209 exit
210 screen
211 screen -r
212 ps -ef|grep mysql
213 kill 5035
214 sudo kill 5035
215 ps -ef|grep mysql
216 screen -r
217 psg mysql
218 ps -ef|grep mysql
219 ll /var/run/mysqld/
220 ll /run/mysqld/
221 exit
222 cd /etc/netplan/
223 ll
224 cat 01-netcfg.yaml
225 cat 01-netcfg.yaml.ORG
226 exit
227 sudo su
228 exit
229 history
230 sudo su
231 exit
232 sudo su
233 exit
234 virsh list
235 ll
236 ll LV/
237 cat /etc/crontab
238 ll
239 sudo su
240 ll
241 cat LV
242 cd LV/
243 ll
244 cat 01-netcfg.yaml.21
245 cd
246 ll
247 less jcameron-key.asc
248 history
249 history>hist.txt



18ahistroot

1 cd /etc/netplan
2 ll
3 cat 01-netcfg.yaml
4 cp 01-netcfg.yaml 01-netcfg.yaml.ORG
5 cp 01-netcfg.yaml 01-netcfg.yaml.NY
6 ll
7 vi 01-netcfg.yaml.NY
8 cat 01-netcfg.yaml.NY
9 netplan --debug try
10 ll
11 cp 01-netcfg.yaml.NY 01-netcfg.yaml
12 cat 01-netcfg.yaml
13 netplan --debug try
14 cat 01-netcfg.yaml.ORG
15 vi 01-netcfg.yaml
16 netplan --debug try
17 vi 01-netcfg.yaml
18 ll
19 cp 01-netcfg.yaml 01-netcfg.yaml.NY
20 cp 01-netcfg.yaml.ORG 01-netcfg.yaml
21 cat 01-netcfg.yaml
22 exit
23 cd /etc/netplan
24 ll
25 vi 01-netcfg.yaml.NY
26 cp 01-netcfg.yaml.NY 01-netcfg.yaml
27 netplan --debug try
28 vi 01-netcfg.yaml.NY
29 netplan --debug try
30 man netplan
31 vi 01-netcfg.yaml.NY
32 cp 01-netcfg.yaml.NY 01-netcfg.yaml
33 netplan --debug try
34 vi 01-netcfg.yaml.NY
35 cp 01-netcfg.yaml.NY 01-netcfg.yaml
36 netplan --debug try
37 ip a
38 exit
39 whoami
40 exit
41 passwd root
42 exit
43 passwd root
44 exit
45 cd /etc/ssh
46 less sshd_config
47 man sshd_config
48 ll
49 cp sshd_config 20190521sshd_config
50 vi sshd_config
51 exit
52 shutdown -r now
53 php --version
54 exit
55 find / -iname "mysqld.sock"
56 find / -name "mysqld.sock"
57 find -name "mysqld.sock"
58 find -iname "mysqld.sock"
59 mysql -u root
60 ll /var/run/
61 find -iname "mysql"
62 find / -name "mysql"
63 systemctl stop mysql.service
64 systemctl start mysql.service
65 systemctl status mysql.service
66 exit
67 systemctl stop mysql.service
68 mysqld_safe --skip-grant-tables
69 systemctl status mysql.service
70 mysqld_safe --skip-grant-tables
71 mysql -u root
72 systemctl status mysql.service
73 mysqld_safe --skip-grant-tables &
74 systemctl status mysql.service
75 mysql -u root
76 mysqld_safe
77 touch /var/lib/mysql/MySql.sock
78 systemctl status mysql.service
79 systemctl stop mysql.service
80 mysqld_safe --skip-grant-tables
81 mysql -u root
82 systemctl start mysql.service
83 mysql -u root
84 mysqld_safe --skip-grant-tables
85 mysql -u root
86 systemctl stop mysql.service
87 mysqld_safe --skip-grant-tables
88 systemctl set-environment MYSQLD_OPTS="--skip-grant-tables --skip-networking"
89 mysql -u root
90 systemctl status mysql.service
91 systemctl start mysql.service
92 mysql -u root
93 systemctl stop mysql.service
94 systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
95 systemctl start mysql.service
96 sudo mysql -u root
97 systemctl edit mysql.service
98 sudo mysql -u root
99 use mysql;
100 systemctl status mysql.service
101 use mysql;
102 apt install use
103 exit
104 cd /var/lib/mysql
105 ls
106 vim MySql.sock
107 cd ..
108 Stop MySql
109 stop MySql
110 sudo systemclt stop mysql.service
111 sudo systemctl stop mysql.service
112 mysqld_safe --skip-grant-tables
113 mysql -u root
114 sudo systemctl start mysql.service
115 touch /var/lib/mysql/mysqld.sock
116 sudo systemctl stop mysql.service
117 mysqld_safe --skip-grant-tables
118 mysql -u root
119 sudo systemctl start mysql.service
120 cd /var/run/mysqld
121 ls
122 vim mysqld.sock
123 cd..
124 cd ..
125 cd lib/mysql
126 ls
127 cd ..
128 cd etc
129 ls
130 cd mysql/
131 ls
132 vim my.cnf
133 vim mysql.cnf
134 vim mysql.conf.d
135 vim conf.d
136 cd ..
137 sudo systemctl stop mysql.service
138 mysqld_safe --skip-grant-tables
139 sudo systemctl status mysql.service
140 sudo systemctl start mysql.service
141 sudo systemctl status mysql.service
142 cd var/run/mysqld/
143 ls
144 cd ..
145 ls
146 sudo cp -rp ./mysqld ./mysqld.bak
147 cd ..
148 sudo systemctl stop mysql.service
149 sudo mv ./mysqld.bak ./mysqld
150 cd var/run
151 sudo mv ./mysqld.bak ./mysqld
152 mysqld_safe --skip-grant-tables
153 quit
154 exit
155 sudo systemctl status mysql.service
156 sudo systemctl start mysql.service
157 cd var/run
158 cd var
159 ls
160 sudo systemctl start mysql.service
161 cd /var/run
162 ls
163 cd mysqld/
164 ls
165 cd ..
166 cd lib
167 ls
168 cd mysql
169 ls
170 cd ..
171 cd run
172 ls
173 cd mysqld/
174 ls
175 cd ..
176 cd .
177 cd ..
178 sudo systemctl start mysql.service
179 systemctl status mysql.service
180 sudo systemctl start mysql.service
181 bg
182 screen
183 systemctl status mysql.service
184 ps
185 systemctl status mysql.service
186 mysql -u root
187 sudo systemctl stop mysql.service
188 cd var/run
189 cd mysqld
190 ls
191 cd .
192 cd ..
193 cd lib
194 ls
195 cd mysql
196 ls
197 cd mysql/
198 ls
199 cd ..
200 ls
201 cd ..
202 cd run
203 ls
204 cd ..
205 sudo systemctl start mysql.service
206 journalctl -xe
207 exit
208 sudo systemctl status mysql.service
209 sudo systemctl stop mysql.service
210 sudo systemctl status mysql.service
211 sudo systemctl start mysql.service
212 cd var/run
213 cd var
214 cd /var
215 cd /run
216 ls
217 cd mysqld
218 ls
219 sudo systemctl start mysql.service
220 sudo systemctl status mysql.service
221 sudo systemctl stop mysql.service
222 cd ..
223 sudo systemctl status mysql.service
224 cd /var/lib
225 ls
226 cd mysql
227 ls
228 cd ..
229 cd run
230 ls
231 cd mysql
232 ls
233 cd mysql
234 cd /mysql
235 cd /mysqld
236 cd mysqld
237 ls
238 touch mysqld.sock
239 cd ..
240 sudo systemctl stop mysql.service
241 sudo systemctl start mysql.service
242 sudo systemctl status mysql.service
243 cd /user/sbin/mysqld
244 cd /usr/sbin/mysqld
245 cd /usr
246 cd sbin/
247 ls
248 cd mysqld
249 cd /mysqld
250 ls
251 im mysql
252 vim mysql
253 cd ../..
254 cd var/lib
255 cd ..
256 cd run
257 ls
258 cd mysqld
259 ls
260 touch mysqld.sock
261 sudo systemctl start mysql.service
262 sudo systemctl status mysql.service
263 mysql -u root
264 sudo systemctl start mysql.service
265 history
266 uit
267 shutdown -r now
268 netstat
269 clear
270 x
271 log
272 help
273 clear
274 sudo systemctl status mysql.service
275 exit
276 sudo systemctl status mysql.service
277 sudo systemctl stop mysql.service
278 mysql_safe --skip-grant-tables
279 mysqld_safe --skip-grant-tables
280 mysql -u root
281 screen
282 sudo systemctl status mysql.service
283 sudo systemctl start mysql.service
284 sudo systemctl status mysql.service
285 cd var/run
286 cd /var/run
287 ls
288 cd mysqld
289 ls
290 cd ..
291 sudo cp -rp ./mysqld ./mysqld.bak
292 ls
293 sudo systemctl stop mysql.service
294 sudo mv ./mysqld.bak ./mysqld
295 ls
296 sudo mysqld_safe --skip-grant-tables
297 shutdown -r now
298 sudo systemctl status mysql.service
299 service MySql stop
300 service MySQL stop
301 sudo systemctl stop mysql.service
302 mysqld_safe --skip-grant-tables
303 cd /var/run/mysqld
304 cd /var/run
305 ls
306 mkdir mysqld
307 mysqld_safe --skip-grant-tables
308 mysql -u root
309 ls
310 mysqld_safe --skip-grant-tables
311 sudo systemctl start mysql.service
312 sudo systemctl status mysql.service
313 sudo systemctl stop mysql.service
314 mysqld_safe --skip-grant-tables
315 mkdir mysqld
316 mysqld_safe
317 ls
318 mysqld_safe --skip-grant-tables
319 mysql -u root
320 mysqld_safe --skip-grant-tables
321 mysqld_safe --skip-grant-tables --skip-networking &
322 mysqld_safe --skip-grant-tables
323 ls
324 cd mysqld/
325 ls
326 mysqld_safe --skip-grant-tables
327 mysqld_safe --skip-grant-tabls
328 ls
329 cd ../../..
330 mysqld_safe --skip-grant-tabls &
331 mysql -u root
332 mysqld_safe --skip-grant-tabls
333 mysqld_safe --skip-grant-tables
334 mysqld_safe --skip-grant-tables &
335 mysql -u root
336 sudo systemctl status mysql.service
337 sudo systemctl start mysql.service
338 cd /var/run
339 ls
340 sudo systemctl stop mysql.service
341 mysqld_safe --skip-grant-tables &
342 mysqld_safe --skip-grant-tables
343 mkdir mysqld
344 mysqld_safe --skip-grant-tables
345 mysql -u root
346 sudo systemctl status mysql.service
347 mysqld_safe --skip-grant-tables
348 sudo systemctl status mysql.service
349 ls
350 mysql
351 cd mysqld/
352 ls
353 mysqld_safe --skip-grant-tables
354 sudo mysql_safe --skip-grant-tables
355 sudo mysqld_safe --skip-grant-tables
356 cd ../../
357 cd ..
358 sudo systemctl start mysql.service
359 cd /var/run
360 ls
361 sudo cp -rp ./mysqld ./mysqld.bak
362 sudo systemctl stop mysql.service
363 sudo mv ./mysqld.bak ./mysqld
364 sudo mysqld_safe --skip-grant-tables &
365 mysql -u root
366 sudo systemctl stop mysql.service
367 sudo systemctl start mysql.service
368 shutdown -r now
369 mysql -u root -p
370 sudo systemctl status mysql.service
371 cd /var/run
372 sudo cp -rp ./mysqld ./mysqld.bak
373 sudo systemctl stop mysql.service
374 sudo mv ./mysqld.bak ./mysqld
375 sudo mysqld_safe --skip-grant-tables &
376 mysql -u root
377 sudo systemctl stop mysql.service
378 sudo systemctl start mysql.service
379 ls
380 rm mysqld
381 cd mysqld
382 ls
383 cd ..
384 rmdir mysqld
385 cd mysqld/
386 rm mysqld.pid
387 rm mysqld.sock
388 rm mysqld.sock.lock
389 cd mysqld.sock.lock
390 ls
391 cd ..
392 rmdir mysqld
393 sudo systemctl start mysql.service
394 sudo systemctl status mysql.service
395 sudo systemctl stop mysql.service
396 ls
397 sudo systemctl stop mysql.service
398 sudo systemctl start mysql.service
399 shutdown -r now
400 sudo systemctl status mysql.service
401 cd /var/run
402 sudo cp -rp ./mysqld ./mysqld.bak
403 sudo systemctl stop mysql.service
404 sudo mv ./mysqld.bak ./mysqld
405 sudo mysqld_safe --skip-grant-tables &
406 mysql -u root
407 sudo systemctl stop mysql.service
408 sudo systemctl start mysql.service
409 sudo systemctl status mysql.service
410 journal -xe
411 journalctl -xe
412 sudo systemctl status mysql.service
413 ls
414 rmdir mysqld
415 sudo systemctl stop mysql.service
416 ls
417 sudo systemctl status mysql.service
418 sudo systemctl start mysql.service
419 shutdown -r now
420 /var
421 cd var
422 ls
423 cd/var
424 cd /var
425 ls
426 cat mysql_password
427 cd ..
428 cd /var/run
429 ls
430 cd mysqld
431 ls
432 cd ../../..
433 /etc
434 cd /etc
435 ls
436 cd init.d
437 ls
438 cd mysql
439 vim mysql
440 cd ..
441 sudo systemctl status mysql.service
442 cd /var/run
443 sudo cp -rp ./mysqld ./mysqld.bak
444 sudo systemctl stop mysql.service
445 sudo mv ./mysqld.bak ./mysqld
446 ls -l mysqld
447 chown root mysqld
448 ls -l mysqld
449 chown root:root mysqld
450 sudo mysqld_safe --skip-grant-tables &
451 mysqlmysql -u root
452 sudo mysqld_safe --skip-grant-tables &
453 mysql -u root
454 chown mysql:mysql mysqld
455 sudo mysqld_safe --skip-grant-tables &
456 mysql -u root
457 chown root:root mysqld
458 sudo systemctl stop mysql.service
459 sudo systemctl start mysql.service
460 chown root:root mysqld
461 sudo systemctl start mysql.service
462 mkdir mysqld
463 sudo systemctl start mysql.service
464 sudo systemctl stop mysql.service
465 sudo systemctl start mysql.service
466 cd ..
467 cd lib
468 ls
469 cd mysql
470 ls
471 cd ../../..
472 sudo systemctl status mysql.service
473 cd /var/run
474 chown root:root mysqld
475 cd ..
476 cd lib
477 sudo systemctl status mysql.service
478 cd ..
479 cd run
480 cd mysqld/
481 touch mysqld.sock
482 cd ..
483 sudo systemctl status mysql.service
484 sudo systemctl stop mysql.service
485 shutdown -r now
486 quit
487 history
488 sudo systemctl status mysql.service
489 uit
490 quit
491 exit
492 history
493 sudo systemctl status mysql.service
494 mysql -u root
495 mysql -u root -p 1111
496 mysql -u root -p
497 history
498 clear
499 ls
500 cd var
501 cd /var
502 ls
503 cd /lib
504 ls
505 cd ..
506 cd /root
507 ls
508 cd /run
509 ls
510 cd /user
511 cd user
512 ls
513 cd ..
514 ls
515 quit
516 c d..
517 exit
518 sudo systemctl status mysql.service
519 sudo systemctl stop mysql.service
520 sudo systemctl status mysql.service
521 sudo apt-get remove --purge mysql*
522 sudo apt-get autoremove
523 sudo apt-get autoclean
524 sudo rm -rf /var/lib/mysql
525 sudo rm -rf /etc/mysql
526 sudo apt-get update
527 sudo apt-get install mysql-server
528 sudo ufw allow mysql
529 systemctl start mysql
530 systemctl enable mysql
531 /usr/bin/mysql -u root -p
532 sudo systemctl stop mysql.service
533 sudo systemctl start mysql.service
534 mysql -u root -p
535 exit
536 mysql -u root -p
537 sudo systemctl status mysql.service
538 quit
539 exit
540 mysql -u root -p
541 exit
542 mysql -u root
543 mysql -u root -p
544 mysql -u test -p
545 mysql -u root -p
546 quit
547 exit
548 sudo apt update
549 exit
550 pt list --upgradable
551 apt list --upgradable
552 sudo apt update
553 sudo apt-get upgrade
554 exit
555 mysql -u root -p
556 chown -R root:root /var/www/html/wp-conent/
557 cd var
558 cd /var/
559 ls
560 cd /www/
561 cd /www
562 cd www
563 ls
564 cd ..
565 chown -R root:root /var/www/html/wp-content/
566 sudo apt-get proftpd server
567 sudo apt-get install proftpd server
568 sudo apt-get install proftpd-basic
569 exit
570 cd /var/www/
571 ls
572 cd ..
573 cd /etc/apache2/
574 ls
575 vim apache2.conf
576 cd /etc/apache2/
577 vim apache2.conf
578 sudo service apache2 restart
579 a2enmod rewrite
580 systemctl restart apache2
581 exit
582 history
583 exit
584 history
585 virsh list
586 exit
587 sudo chmod 775 /var/www/html/wp-content/uploads/2019/09
588 quit
589 exit
590 sudo chown -R www-data:www-data wp-content/plugins/
591 sudo chmod 775 wp-content
592 sudo chown -R www-data:www-data wp-content/sudo chown -R www-data:www-data /var/www/html/wp-content/plugins
593 sudo chown -R www-data:www-data /var/www/html/wp-content/plugins/
594 sudo chmod 775 /var/www/html/wp-content/
595 sudo chown -R www-data:www-data /var/www/html/wp-content/
596 exit
597 chmod www-data:www-data /var/www/html/wp-includes/
598 chmod--help
599 chmod --help
600 chmod -R www-data:www-data /var/www/html/wp-includes/
601 chown -R root:root /var/www/html/wp-content/
602 chown -R root:root /var/www/html/wp-includes/
603 chown -R www-data:www-data /var/www/html/wp-content/
604 chown -R www-data:www-d /var/www/html/wp-includes/
605 chown -R root:root /var/www/html/wp-includes/
606 chown -R root:root /var/www/html/wp-content/
607 exit
608 chown -R www-data:www-data /var/www/html/wp-content/
609 exit
610 history
611 virsh list
612 clear
613 virsh list
614 exit
615 chown -R www-data:www-data /var/www/html/wp-content/
616 chown -R www-data:www-data /var/www/html/wp-includes/
617 chown -R root:root /var/www/html/wp-content/
618 chown -R www-data:www-data /var/www/html/wp-content/
619 chown -R root:root /var/www/html/wp-includes/
620 exit
621 ls
622 cd /var/
623 ls
624 cd www
625 ls
626 cd html
627 ls
628 chown -R www-data:www-data /var/www/html/wp-admin/
629 chown -R www-data:www-data /var/www/html/wp-includes/
630 cd ..
631 chown -R www-data:www-data /var/www/html/
632 exit
633 ls
634 cd var
635 cd /var/
636 ls
637 sudo apt-get update
638 sudo apt-get install software-properties-common
639 sudo add-apt-repository universe
640 sudo add-apt-repository ppa:certbot/certbot
641 sudo apt-get update
642 sudo apt-get install certbot python-certbot-apache
643 sudo certbot --apache
644 sudo certbot renew --dry-run
645 apachectlp stop
646 apachectl stop
647 apachectl startssl
648 apachectl start
649 ls
650 cd www
651 ls
652 cd html/
653 ls
654 cd ..
655 cd..
656 cd ..
657 cd etc/
658 ls
659 cd apache2/
660 ls
661 cd ..
662 ls
663 cd apache2/
664 ls
665 apachectl stop
666 apachectl start
667 exit
668 history
669 exit
670 ll
671 ll LV/
672 cd
673 ll
674 cat /etc/rc.local
675 exit
676 hist>histroot.txt
677 history>histroot.txt



18aroothistory

Created Sunday 27 September 2020

1 cd /etc/netplan

2 ll
3 cat 01-netcfg.yaml
4 cp 01-netcfg.yaml 01-netcfg.yaml.ORG
5 cp 01-netcfg.yaml 01-netcfg.yaml.NY
6 ll
7 vi 01-netcfg.yaml.NY
8 cat 01-netcfg.yaml.NY
9 netplan --debug try
10 ll
11 cp 01-netcfg.yaml.NY 01-netcfg.yaml
12 cat 01-netcfg.yaml
13 netplan --debug try
14 cat 01-netcfg.yaml.ORG
15 vi 01-netcfg.yaml
16 netplan --debug try
17 vi 01-netcfg.yaml
18 ll
19 cp 01-netcfg.yaml 01-netcfg.yaml.NY
20 cp 01-netcfg.yaml.ORG 01-netcfg.yaml
21 cat 01-netcfg.yaml
22 exit
23 cd /etc/netplan
24 ll
25 vi 01-netcfg.yaml.NY
26 cp 01-netcfg.yaml.NY 01-netcfg.yaml
27 netplan --debug try
28 vi 01-netcfg.yaml.NY
29 netplan --debug try
30 man netplan
31 vi 01-netcfg.yaml.NY
32 cp 01-netcfg.yaml.NY 01-netcfg.yaml
33 netplan --debug try
34 vi 01-netcfg.yaml.NY
35 cp 01-netcfg.yaml.NY 01-netcfg.yaml
36 netplan --debug try
37 ip a
38 exit
39 whoami
40 exit
41 passwd root
42 exit
43 passwd root
44 exit
45 cd /etc/ssh
46 less sshd_config
47 man sshd_config
48 ll
49 cp sshd_config 20190521sshd_config
50 vi sshd_config
51 exit
52 shutdown -r now
53 php --version
54 exit
55 find / -iname "mysqld.sock"
56 find / -name "mysqld.sock"
57 find -name "mysqld.sock"
58 find -iname "mysqld.sock"
59 mysql -u root
60 ll /var/run/
61 find -iname "mysql"
62 find / -name "mysql"
63 systemctl stop mysql.service
64 systemctl start mysql.service
65 systemctl status mysql.service
66 exit
67 systemctl stop mysql.service
68 mysqld_safe --skip-grant-tables
69 systemctl status mysql.service
70 mysqld_safe --skip-grant-tables
71 mysql -u root
72 systemctl status mysql.service
73 mysqld_safe --skip-grant-tables &
74 systemctl status mysql.service
75 mysql -u root
76 mysqld_safe
77 touch /var/lib/mysql/MySql.sock
78 systemctl status mysql.service
79 systemctl stop mysql.service
80 mysqld_safe --skip-grant-tables
81 mysql -u root
82 systemctl start mysql.service
83 mysql -u root
84 mysqld_safe --skip-grant-tables
85 mysql -u root
86 systemctl stop mysql.service
87 mysqld_safe --skip-grant-tables
88 systemctl set-environment MYSQLD_OPTS="--skip-grant-tables --skip-networking"
89 mysql -u root
90 systemctl status mysql.service
91 systemctl start mysql.service
92 mysql -u root
93 systemctl stop mysql.service
94 systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
95 systemctl start mysql.service
96 sudo mysql -u root
97 systemctl edit mysql.service
98 sudo mysql -u root
99 use mysql;
100 systemctl status mysql.service
101 use mysql;
102 apt install use
103 exit
104 cd /var/lib/mysql
105 ls
106 vim MySql.sock
107 cd ..
108 Stop MySql
109 stop MySql
110 sudo systemclt stop mysql.service
111 sudo systemctl stop mysql.service
112 mysqld_safe --skip-grant-tables
113 mysql -u root
114 sudo systemctl start mysql.service
115 touch /var/lib/mysql/mysqld.sock
116 sudo systemctl stop mysql.service
117 mysqld_safe --skip-grant-tables
118 mysql -u root
119 sudo systemctl start mysql.service
120 cd /var/run/mysqld
121 ls
122 vim mysqld.sock
123 cd..
124 cd ..
125 cd lib/mysql
126 ls
127 cd ..
128 cd etc
129 ls
130 cd mysql/
131 ls
132 vim my.cnf
133 vim mysql.cnf
134 vim mysql.conf.d
135 vim conf.d
136 cd ..
137 sudo systemctl stop mysql.service
138 mysqld_safe --skip-grant-tables
139 sudo systemctl status mysql.service
140 sudo systemctl start mysql.service
141 sudo systemctl status mysql.service
142 cd var/run/mysqld/
143 ls
144 cd ..
145 ls
146 sudo cp -rp ./mysqld ./mysqld.bak
147 cd ..
148 sudo systemctl stop mysql.service
149 sudo mv ./mysqld.bak ./mysqld
150 cd var/run
151 sudo mv ./mysqld.bak ./mysqld
152 mysqld_safe --skip-grant-tables
153 quit
154 exit
155 sudo systemctl status mysql.service
156 sudo systemctl start mysql.service
157 cd var/run
158 cd var
159 ls
160 sudo systemctl start mysql.service
161 cd /var/run
162 ls
163 cd mysqld/
164 ls
165 cd ..
166 cd lib
167 ls
168 cd mysql
169 ls
170 cd ..
171 cd run
172 ls
173 cd mysqld/
174 ls
175 cd ..
176 cd .
177 cd ..
178 sudo systemctl start mysql.service
179 systemctl status mysql.service
180 sudo systemctl start mysql.service
181 bg
182 screen
183 systemctl status mysql.service
184 ps
185 systemctl status mysql.service
186 mysql -u root
187 sudo systemctl stop mysql.service
188 cd var/run
189 cd mysqld
190 ls
191 cd .
192 cd ..
193 cd lib
194 ls
195 cd mysql
196 ls
197 cd mysql/
198 ls
199 cd ..
200 ls
201 cd ..
202 cd run
203 ls
204 cd ..
205 sudo systemctl start mysql.service
206 journalctl -xe
207 exit
208 sudo systemctl status mysql.service
209 sudo systemctl stop mysql.service
210 sudo systemctl status mysql.service
211 sudo systemctl start mysql.service
212 cd var/run
213 cd var
214 cd /var
215 cd /run
216 ls
217 cd mysqld
218 ls
219 sudo systemctl start mysql.service
220 sudo systemctl status mysql.service
221 sudo systemctl stop mysql.service
222 cd ..
223 sudo systemctl status mysql.service
224 cd /var/lib
225 ls
226 cd mysql
227 ls
228 cd ..
229 cd run
230 ls
231 cd mysql
232 ls
233 cd mysql
234 cd /mysql
235 cd /mysqld
236 cd mysqld
237 ls
238 touch mysqld.sock
239 cd ..
240 sudo systemctl stop mysql.service
241 sudo systemctl start mysql.service
242 sudo systemctl status mysql.service
243 cd /user/sbin/mysqld
244 cd /usr/sbin/mysqld
245 cd /usr
246 cd sbin/
247 ls
248 cd mysqld
249 cd /mysqld
250 ls
251 im mysql
252 vim mysql
253 cd ../..
254 cd var/lib
255 cd ..
256 cd run
257 ls
258 cd mysqld
259 ls
260 touch mysqld.sock
261 sudo systemctl start mysql.service
262 sudo systemctl status mysql.service
263 mysql -u root
264 sudo systemctl start mysql.service
265 history
266 uit
267 shutdown -r now
268 netstat
269 clear
270 x
271 log
272 help
273 clear
274 sudo systemctl status mysql.service
275 exit
276 sudo systemctl status mysql.service
277 sudo systemctl stop mysql.service
278 mysql_safe --skip-grant-tables
279 mysqld_safe --skip-grant-tables
280 mysql -u root
281 screen
282 sudo systemctl status mysql.service
283 sudo systemctl start mysql.service
284 sudo systemctl status mysql.service
285 cd var/run
286 cd /var/run
287 ls
288 cd mysqld
289 ls
290 cd ..
291 sudo cp -rp ./mysqld ./mysqld.bak
292 ls
293 sudo systemctl stop mysql.service
294 sudo mv ./mysqld.bak ./mysqld
295 ls
296 sudo mysqld_safe --skip-grant-tables
297 shutdown -r now
298 sudo systemctl status mysql.service
299 service MySql stop
300 service MySQL stop
301 sudo systemctl stop mysql.service
302 mysqld_safe --skip-grant-tables
303 cd /var/run/mysqld
304 cd /var/run
305 ls
306 mkdir mysqld
307 mysqld_safe --skip-grant-tables
308 mysql -u root
309 ls
310 mysqld_safe --skip-grant-tables
311 sudo systemctl start mysql.service
312 sudo systemctl status mysql.service
313 sudo systemctl stop mysql.service
314 mysqld_safe --skip-grant-tables
315 mkdir mysqld
316 mysqld_safe
317 ls
318 mysqld_safe --skip-grant-tables
319 mysql -u root
320 mysqld_safe --skip-grant-tables
321 mysqld_safe --skip-grant-tables --skip-networking &
322 mysqld_safe --skip-grant-tables
323 ls
324 cd mysqld/
325 ls
326 mysqld_safe --skip-grant-tables
327 mysqld_safe --skip-grant-tabls
328 ls
329 cd ../../..
330 mysqld_safe --skip-grant-tabls &
331 mysql -u root
332 mysqld_safe --skip-grant-tabls
333 mysqld_safe --skip-grant-tables
334 mysqld_safe --skip-grant-tables &
335 mysql -u root
336 sudo systemctl status mysql.service
337 sudo systemctl start mysql.service
338 cd /var/run
339 ls
340 sudo systemctl stop mysql.service
341 mysqld_safe --skip-grant-tables &
342 mysqld_safe --skip-grant-tables
343 mkdir mysqld
344 mysqld_safe --skip-grant-tables
345 mysql -u root
346 sudo systemctl status mysql.service
347 mysqld_safe --skip-grant-tables
348 sudo systemctl status mysql.service
349 ls
350 mysql
351 cd mysqld/
352 ls
353 mysqld_safe --skip-grant-tables
354 sudo mysql_safe --skip-grant-tables
355 sudo mysqld_safe --skip-grant-tables
356 cd ../../
357 cd ..
358 sudo systemctl start mysql.service
359 cd /var/run
360 ls
361 sudo cp -rp ./mysqld ./mysqld.bak
362 sudo systemctl stop mysql.service
363 sudo mv ./mysqld.bak ./mysqld
364 sudo mysqld_safe --skip-grant-tables &
365 mysql -u root
366 sudo systemctl stop mysql.service
367 sudo systemctl start mysql.service
368 shutdown -r now
369 mysql -u root -p
370 sudo systemctl status mysql.service
371 cd /var/run
372 sudo cp -rp ./mysqld ./mysqld.bak
373 sudo systemctl stop mysql.service
374 sudo mv ./mysqld.bak ./mysqld
375 sudo mysqld_safe --skip-grant-tables &
376 mysql -u root
377 sudo systemctl stop mysql.service
378 sudo systemctl start mysql.service
379 ls
380 rm mysqld
381 cd mysqld
382 ls
383 cd ..
384 rmdir mysqld
385 cd mysqld/
386 rm mysqld.pid
387 rm mysqld.sock
388 rm mysqld.sock.lock
389 cd mysqld.sock.lock
390 ls
391 cd ..
392 rmdir mysqld
393 sudo systemctl start mysql.service
394 sudo systemctl status mysql.service
395 sudo systemctl stop mysql.service
396 ls
397 sudo systemctl stop mysql.service
398 sudo systemctl start mysql.service
399 shutdown -r now
400 sudo systemctl status mysql.service
401 cd /var/run
402 sudo cp -rp ./mysqld ./mysqld.bak
403 sudo systemctl stop mysql.service
404 sudo mv ./mysqld.bak ./mysqld
405 sudo mysqld_safe --skip-grant-tables &
406 mysql -u root
407 sudo systemctl stop mysql.service
408 sudo systemctl start mysql.service
409 sudo systemctl status mysql.service
410 journal -xe
411 journalctl -xe
412 sudo systemctl status mysql.service
413 ls
414 rmdir mysqld
415 sudo systemctl stop mysql.service
416 ls
417 sudo systemctl status mysql.service
418 sudo systemctl start mysql.service
419 shutdown -r now
420 /var
421 cd var
422 ls
423 cd/var
424 cd /var
425 ls
426 cat mysql_password
427 cd ..
428 cd /var/run
429 ls
430 cd mysqld
431 ls
432 cd ../../..
433 /etc
434 cd /etc
435 ls
436 cd init.d
437 ls
438 cd mysql
439 vim mysql
440 cd ..
441 sudo systemctl status mysql.service
442 cd /var/run
443 sudo cp -rp ./mysqld ./mysqld.bak
444 sudo systemctl stop mysql.service
445 sudo mv ./mysqld.bak ./mysqld
446 ls -l mysqld
447 chown root mysqld
448 ls -l mysqld
449 chown root:root mysqld
450 sudo mysqld_safe --skip-grant-tables &
451 mysqlmysql -u root
452 sudo mysqld_safe --skip-grant-tables &
453 mysql -u root
454 chown mysql:mysql mysqld
455 sudo mysqld_safe --skip-grant-tables &
456 mysql -u root
457 chown root:root mysqld
458 sudo systemctl stop mysql.service
459 sudo systemctl start mysql.service
460 chown root:root mysqld
461 sudo systemctl start mysql.service
462 mkdir mysqld
463 sudo systemctl start mysql.service
464 sudo systemctl stop mysql.service
465 sudo systemctl start mysql.service
466 cd ..
467 cd lib
468 ls
469 cd mysql
470 ls
471 cd ../../..
472 sudo systemctl status mysql.service
473 cd /var/run
474 chown root:root mysqld
475 cd ..
476 cd lib
477 sudo systemctl status mysql.service
478 cd ..
479 cd run
480 cd mysqld/
481 touch mysqld.sock
482 cd ..
483 sudo systemctl status mysql.service
484 sudo systemctl stop mysql.service
485 shutdown -r now
486 quit
487 history
488 sudo systemctl status mysql.service
489 uit
490 quit
491 exit
492 history
493 sudo systemctl status mysql.service
494 mysql -u root
495 mysql -u root -p 1111
496 mysql -u root -p
497 history
498 clear
499 ls
500 cd var
501 cd /var
502 ls
503 cd /lib
504 ls
505 cd ..
506 cd /root
507 ls
508 cd /run
509 ls
510 cd /user
511 cd user
512 ls
513 cd ..
514 ls
515 quit
516 c d..
517 exit
518 sudo systemctl status mysql.service
519 sudo systemctl stop mysql.service
520 sudo systemctl status mysql.service
521 sudo apt-get remove --purge mysql*
522 sudo apt-get autoremove
523 sudo apt-get autoclean
524 sudo rm -rf /var/lib/mysql
525 sudo rm -rf /etc/mysql
526 sudo apt-get update
527 sudo apt-get install mysql-server
528 sudo ufw allow mysql
529 systemctl start mysql
530 systemctl enable mysql
531 /usr/bin/mysql -u root -p
532 sudo systemctl stop mysql.service
533 sudo systemctl start mysql.service
534 mysql -u root -p
535 exit
536 mysql -u root -p
537 sudo systemctl status mysql.service
538 quit
539 exit
540 mysql -u root -p
541 exit
542 mysql -u root
543 mysql -u root -p
544 mysql -u test -p
545 mysql -u root -p
546 quit
547 exit
548 sudo apt update
549 exit
550 pt list --upgradable
551 apt list --upgradable
552 sudo apt update
553 sudo apt-get upgrade
554 exit
555 mysql -u root -p
556 chown -R root:root /var/www/html/wp-conent/
557 cd var
558 cd /var/
559 ls
560 cd /www/
561 cd /www
562 cd www
563 ls
564 cd ..
565 chown -R root:root /var/www/html/wp-content/
566 sudo apt-get proftpd server
567 sudo apt-get install proftpd server
568 sudo apt-get install proftpd-basic
569 exit
570 cd /var/www/
571 ls
572 cd ..
573 cd /etc/apache2/
574 ls
575 vim apache2.conf
576 cd /etc/apache2/
577 vim apache2.conf
578 sudo service apache2 restart
579 a2enmod rewrite
580 systemctl restart apache2
581 exit
582 history
583 exit
584 history
585 virsh list
586 exit
587 sudo chmod 775 /var/www/html/wp-content/uploads/2019/09
588 quit
589 exit
590 sudo chown -R www-data:www-data wp-content/plugins/
591 sudo chmod 775 wp-content
592 sudo chown -R www-data:www-data wp-content/sudo chown -R www-data:www-data /var/www/html/wp-content/plugins
593 sudo chown -R www-data:www-data /var/www/html/wp-content/plugins/
594 sudo chmod 775 /var/www/html/wp-content/
595 sudo chown -R www-data:www-data /var/www/html/wp-content/
596 exit
597 chmod www-data:www-data /var/www/html/wp-includes/
598 chmod--help
599 chmod --help
600 chmod -R www-data:www-data /var/www/html/wp-includes/
601 chown -R root:root /var/www/html/wp-content/
602 chown -R root:root /var/www/html/wp-includes/
603 chown -R www-data:www-data /var/www/html/wp-content/
604 chown -R www-data:www-d /var/www/html/wp-includes/
605 chown -R root:root /var/www/html/wp-includes/
606 chown -R root:root /var/www/html/wp-content/
607 exit
608 chown -R www-data:www-data /var/www/html/wp-content/
609 exit
610 history
611 virsh list
612 clear
613 virsh list
614 exit
615 chown -R www-data:www-data /var/www/html/wp-content/
616 chown -R www-data:www-data /var/www/html/wp-includes/
617 chown -R root:root /var/www/html/wp-content/
618 chown -R www-data:www-data /var/www/html/wp-content/
619 chown -R root:root /var/www/html/wp-includes/
620 exit
621 ls
622 cd /var/
623 ls
624 cd www
625 ls
626 cd html
627 ls
628 chown -R www-data:www-data /var/www/html/wp-admin/
629 chown -R www-data:www-data /var/www/html/wp-includes/
630 cd ..
631 chown -R www-data:www-data /var/www/html/
632 exit
633 ls
634 cd var
635 cd /var/
636 ls
637 sudo apt-get update
638 sudo apt-get install software-properties-common
639 sudo add-apt-repository universe
640 sudo add-apt-repository ppa:certbot/certbot
641 sudo apt-get update
642 sudo apt-get install certbot python-certbot-apache
643 sudo certbot --apache
644 sudo certbot renew --dry-run
645 apachectlp stop
646 apachectl stop
647 apachectl startssl
648 apachectl start
649 ls
650 cd www
651 ls
652 cd html/
653 ls
654 cd ..
655 cd..
656 cd ..
657 cd etc/
658 ls
659 cd apache2/
660 ls
661 cd ..
662 ls
663 cd apache2/
664 ls
665 apachectl stop
666 apachectl start
667 exit
668 history
669 exit
670 ll
671 ll LV/
672 cd
673 ll
674 cat /etc/rc.local
675 exit



22lv

Created Sunday 27 September 2020

--- Logical volume ---
LV Path /dev/vg0/ubutest1
LV Name ubutest1
VG Name vg0
LV UUID 4pAhGP-Uob1-UEdh-lQdV-IKYh-o3j4-SMTCgn
LV Write Access read/write
LV Creation host, time testserver, 2019-02-23 19:31:46 +0100
LV Status available
# open 2
LV Size 100.00 GiB
Current LE 25600
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

--- Logical volume ---
LV Path /dev/vg0/test32
LV Name test32
VG Name vg0
LV UUID UrsUoI-eos6-RTnl-lfsi-7lRM-SeHP-uyn0yI
LV Write Access read/write
LV Creation host, time testserver, 2019-08-20 09:02:29 +0200
LV Status available
# open 2
LV Size 100.00 GiB
Current LE 25600
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1



c22notat

Created Saturday 26 September 2020

cat /etc/netplan/01-netcfg.yaml.22
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:

eno1:
dhcp4: no
dhcp6: no
bridges:
br0:
interfaces: [eno1]
dhcp4: no
addresses: [10.1.0.22/24, ]
gateway4: 10.1.0.1
nameservers:
addresses: [8.8.8.8, 4.4.4.4]



22pv

Created Sunday 27 September 2020

--- Physical volume ---
PV Name /dev/md127
VG Name vg0
PV Size 410.87 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 105183
Free PE 53983
Allocated PE 51200
PV UUID cGoKSE-W9oT-9iD0-Bd3s-ouUy-eZxb-xPDTa3



22vg

Created Sunday 27 September 2020

--- Volume group ---
VG Name vg0
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 410.87 GiB
PE Size 4.00 MiB
Total PE 105183
Alloc PE / Size 51200 / 200.00 GiB
Free PE / Size 53983 / 210.87 GiB
VG UUID Qh6Okp-QCev-TIv3-qxBL-lcg3-6kiy-S1apju



26crontab

Created Sunday 27 September 2020

# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
00 3 * * * root /root/scripts/scanjob.sh
#



26iptables.saved

Created Sunday 27 September 2020

# Generated by iptables-save v1.6.0 on Fri Mar 2 08:23:13 2018
*filter
:INPUT ACCEPT [520:45730]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [406:631544]
:f2b-sshd - [0:0]
-A INPUT -p tcp -m multiport --dports 22 -j f2b-sshd
-A INPUT -m set --match-set cn.zone src -j DROP
-A INPUT -m set --match-set ru.zone src -j DROP
-A INPUT -m set --match-set tw.zone src -j DROP
-A OUTPUT -m set --match-set cn.zone dst -j DROP
-A OUTPUT -m set --match-set ru.zone dst -j DROP
-A OUTPUT -m set --match-set tw.zone dst -j DROP
-A f2b-sshd -j RETURN
COMMIT
# Completed on Fri Mar 2 08:23:13 2018



26rc.local

Created Sunday 27 September 2020

sleep 5
/root/scripts/restoreIptables.sh



26restoreIptables.sh

Created Sunday 27 September 2020

#!/bin/bash
iptables -F
ipset restore </root/scripts/ipset_cn.zone
ipset restore </root/scripts/ipset_ru.zone
ipset restore </root/scripts/ipset_tw.zone
iptables-restore < /root/scripts/iptables.saved



26root

Created Sunday 27 September 2020

ipset_cn.zone
ipset_ru.zone
ipset_tw.zone

26iptables.saved

26restoreIptables.sh

26scanjob.sh



26scanjob.sh

Created Sunday 27 September 2020

#!/bin/bash
# 2018/11/27 Leo Vendler. Scanning af system med clamscan
#
UDSKRIV=0
DIR="/"
HOMEDIR="/home/fadl"
mkdir -p $HOMEDIR/scan_log
LOGFILE="$HOMEDIR/scan_log/clam.log"
UDSKRIV="0"
IPADR=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk -F'[/ ]+' '{print $3}')
MAILFROM="admin@fadl.dk"
MAILTO="tsh@fadl.dk"
MAILMSG="$HOMEDIR/scan_log/scanresultat.txt"
MAILSERVER="smtp-relay.gmail.com"
SUBJECT="Scanning af $MAILFROM ($IPADR) har fundet problemer"

#clamscan -i $DIR >$LOGFILE
nice -n 19 clamscan -r -i --exclude-dir="^/sys" $DIR>$LOGFILE

while read linie
do
FOUND=$(echo $linie|grep -v grep|grep FOUND)
if [ "$FOUND" <> " " ]
then
UDSKRIV=1
fi
done<$LOGFILE

if [ "$UDSKRIV" == "1" ]
then
echo "**** Virus/Worm fundet på $IPADR ****">$MAILMSG
cat $LOGFILE>>$MAILMSG
echo "*****************************************">>$MAILMSG
/usr/local/bin/sendemail -f $MAILFROM -t $MAILTO -u $SUBJECT -m $MAILMSG -s $MAILSERVER
fi



27check csvtrans.sh

Created Friday 25 September 2020

#!/bin/bash
if [ "$(mount|grep -v grep|grep csvtrans)" == "" ]
then
#mount C5 mappe til overfoersel af kommaseparerede filer fra webbooking
mount -t cifs //10.1.0.9/webbooking -o credentials=/home/fadl/cred,uid=www-data,gid=root /var/www/ssl-sites/csvtrans
fi



27check kursusmateriale.sh

Created Friday 25 September 2020

#!/bin/bash
if [ "$(mount|grep -v grep|grep kursusmateriale)" == "" ]
then
#mount kursusmateriale på smeserver
/usr/bin/sshfs -o password_stdin,allow_other,uid=33,gid=0 root@10.1.0.38:/home/e-smith/files/ibays/x/html/kursusmateriale /var/www/fadlvagt/04_opskrivning/spv_kursus/kursusmateriale </root/.cred/sme.cred
/usr/bin/sshfs -o password_stdin,allow_other,uid=34,gid=0 root@10.1.0.38:/home/e-smith/files/ibays/x/html/kursusmateriale /var/www/ssl-sitesfadlvagt/04_opskrivning/spv_kursus/kursusmateriale </root/.cred/sme.cred
fi



27crontab

Created Saturday 26 September 2020

root crontab
11 01 * * * ntpdate ntp.tuxfamily.net
30 * * * * /home/fadl/SQL_backup.sh
00 * * * * /root/scripts/check_csvtrans.sh
05 * * * * /root/scripts/check_kursusmateriale.sh
plus en masse php fra Torben

etc/crontab
00 3 * * * root /root/scripts/scanjob.sh
45 * * * * fadl /home/fadl/sqlsave.sh



27rc.local

Created Monday 28 September 2020

#mount C5 mappe til overfoersel af kommaseparerede filer fra webbooking
mount -t cifs //10.1.0.9/webbooking -o credentials=/home/fadl/cred,uid=www-data,gid=root /var/www/ssl-sites/csvtrans

#mount kursusmateriale på smeserver
sleep 5
/usr/bin/sshfs -o password_stdin,allow_other,uid=33,gid=0 root@10.1.0.38:/home/e-smith/files/ibays/x/html/kursusmateriale /var/www/fadlvagt/04_opskrivning/spv_kursus/kursusmateriale </root/.cred/sme.cred
#
sleep 5
#LV20200928
mount -t cifs //10.1.0.57/Maskiner -o credentials=/home/fadl/.cred1/MyBackup,user=fadl,uid=fadl,gid=users /home/fadl/backup
#
sleep 5
/root/scripts/restoreIPtables.sh
#
exit 0



27restoreiptables.sh

Created Friday 25 September 2020

#!/bin/bash
iptables -F
ipset restore </root/scripts/ipset_cn.zone
ipset restore </root/scripts/ipset_ru.zone
ipset restore </root/scripts/ipset_tw.zone
iptables-restore < /root/scripts/iptables.saved



27root

Created Friday 25 September 2020

27scanjob.sh

27check_csvtrans.sh

27check_kursusmateriale.sh

27restoreiptables.sh



27scanjob.sh

Created Friday 25 September 2020

#!/bin/bash
# 2018/11/27 Leo Vendler. Scanning af system med clamscan
#
UDSKRIV=0
DIR="/"
HOMEDIR="/home/fadl"
mkdir -p $HOMEDIR/scan_log
LOGFILE="$HOMEDIR/scan_log/clam.log"
UDSKRIV="0"
IPADR=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk -F'[/ ]+' '{print $3}')
MAILFROM="admin@fadl.dk"
MAILTO="tsh@fadl.dk"
MAILMSG="$HOMEDIR/scan_log/scanresultat.txt"
MAILSERVER="smtp-relay.gmail.com"
SUBJECT="Scanning af $MAILFROM ($IPADR) har fundet problemer"

#clamscan -i $DIR >$LOGFILE
nice -n 19 clamscan -r -i --exclude-dir="^/sys" $DIR>$LOGFILE

while read linie
do
FOUND=$(echo $linie|grep -v grep|grep FOUND)
if [ "$FOUND" <> " " ]
then
UDSKRIV=1
fi
done<$LOGFILE

if [ "$UDSKRIV" == "1" ]
then
echo "**** Virus/Worm fundet på $IPADR ****">$MAILMSG
cat $LOGFILE>>$MAILMSG
echo "*****************************************">>$MAILMSG
/usr/local/bin/sendemail -f $MAILFROM -t $MAILTO -u $SUBJECT -m $MAILMSG -s $MAILSERVER
fi



27SQL backup.sh

Created Friday 25 September 2020

#!/bin/bash
#2012/02/18 Leo Vendler

#NOW=`date +"%Y_%m_%d";
NOW=`date +"%Y_%m_%d_%H%M"`;
BACKUPDIR="/home/fadl/SQLbackups"
CURRENTBACKUP="$BACKUPDIR/$NOW";

### Server Setup ###
#* MySQL login user name *#
MUSER="root";

#* MySQL login PASSWORD name *#
#MPASS="pleaseb@home2me";
MPASS="1qaz@wsx";

#* MySQL login HOST name *#
MHOST="127.0.0.1";
MPORT="3306";

# DO NOT BACKUP these databases
IGNOREDB="
information_schema
mysql
test
"

#* MySQL binaries *#
MYSQL=`which mysql`;
MYSQLDUMP=`which mysqldump`;
GZIP=`which gzip`;

# create current backupdir
if [ ! -d $CURRENTBACKUP ]; then
mkdir -p $CURRENTBACKUP
else
:
fi

#remove oldest backup if >= 24 backups present
dirlist=$(find $BACKUPDIR/* -type d)
count=0
for i in $dirlist; do
let count++
done
if [ "$count" -ge "25" ]
then
echo "old folder found - deleting..."
find $BACKUPDIR/ -type d -printf "%TY%Tm%Td%TH%TM%TS %p\n" | sort -nr | tail -1 | cut -d" " -f2 | xargs -n1 rm -Rf
echo "...old folder deleted"
fi

# get all database listing
DBS="$($MYSQL -u $MUSER -p$MPASS -h $MHOST -P $MPORT -Bse 'show databases')"

# start to dump database one by one
for db in $DBS
do

DUMP="yes";
if [ "$IGNOREDB" != "" ]; then
for i in $IGNOREDB # Store all value of $IGNOREDB ON i
do
if [ "$db" == "$i" ]; then # If result of $DBS(db) is equal to $IGNOREDB(i) then
DUMP="NO"; # SET value of DUMP to "no"
#echo "$i database is being ignored!";
fi
done
fi

if [ "$DUMP" == "yes" ]; then # If value of DUMP is "yes" then backup database
# FILE="$CURRENTBACKUP/$db.gz";
FILE="$CURRENTBACKUP/$db.sql";
echo "BACKING UP $db";
# $MYSQLDUMP --add-drop-database --opt --lock-all-tables -u $MUSER -p$MPASS -h $MHOST -P $MPORT $db | gzip > $FILE
$MYSQLDUMP --add-drop-database --opt --lock-all-tables -u $MUSER -p$MPASS -h $MHOST -P $MPORT $db > $FILE
fi
done



27SQL restore.sh

Created Friday 25 September 2020

#!/bin/bash

#20120218 Leo Vendler

### Databases to restore ###
DATABASES="webbooking
taskmanager
"
#DATABASES="webbooking"

#* DIR where the backup is stored *#
BACKUPDIR="/home/fadl/SQLbackups/2016_04_06_2030";

### MySQL Setup ###
#* MySQL login user name *#
MUSER="root";

#* MySQL login PASSWORD name *#
read -p "Indtast password: " pasord;
MPASS=$pasord

#* MySQL login HOST name *#
MHOST="127.0.0.1";
MPORT="3306";

#* MySQL binaries *#
MYSQL=`which mysql`;


#* Restore databases *#
for db in $DATABASES
do
echo "Restoring $db";
$MYSQL --user=$MUSER --password=$MPASS -h $MHOST -P $MPORT $db < $BACKUPDIR/$db.sql
done



27sqlsave.sh

Created Monday 28 September 2020

#!/bin/bash
#20200928 Leo Vendler
BACKUPDIR="/home/fadl/backup/SQLbackups"
FROMDIR="/home/fadl/SQLbackups"
#
/usr/bin/rsync -az $FROMDIR/* $BACKUPDIR/
#
#remove oldest backup if >= 340 backups present
dirlist=$(find $BACKUPDIR/* -type d)
count=0
for i in $dirlist;
do
let count++
done
if
[ "$count" -ge "340" ]
then
echo "old folder found - deleting..."
find $BACKUPDIR/ -type d -printf "%TY%Tm%Td%TH%TM%TS %p\n" | sort -nr | tail -1 | cut -d" " -f2 | xargs -n1 rm -Rf
echo "...old folder deleted"
fi



28hosts

Created Friday 25 September 2020

217.116.222.126 fadl.dk
217.116.222.122 mit.fadl.dk
37.49.143.118 filer.fadlvagt.dk
37.49.143.123 fadlvagt.dk
217.116.222.125 filserver.fadlvagt.dk
37.49.143.115 booking.fadlvagt.dk
37.49.143.122 udvikling.fadlvagt.dk



28rc.local

Created Friday 25 September 2020

#mount C5 mappe til overfoersel af kommaseparerede filer fra webbooking
#mount -t cifs //10.1.0.9/webbooking -o credentials=/home/fadl/cred,uid=www-data,gid=root /var/www/ssl-sites/csvtrans
#mount kursusmateriale på smeserver
sleep 5
/usr/bin/sshfs -o password_stdin,allow_other,uid=33,gid=0 root@10.1.0.38:/home/e-smith/files/ibays/x/html/kursusmateriale /var/www/fadlvagt/04_opskrivning/spv_kursus/kursusmateriale </root/.cred/sme.cred
#mount drev på 10.1.0.15 til sqlbackup
/usr/bin/sshfs -o password_stdin,allow_other,uid=1000,gid=1000 fadl@10.1.0.15:/home/fadl/mountpoint_for_sqlbackups /home/fadl/SQLbackups </root/.cred/15.cred
#
exit 0



28sqlfetch mit fadl dk.sh

Created Friday 25 September 2020

#!/bin/bash
#20130902 Leo Vendler
#20160404 Torben
#20171106 Leo sshfs

BACKUPDIR="/home/fadl/backup/SQLbackups_mit_fadl_dk"
SERVERDIR="fadl@10.1.0.54:/home/fadl/SQLbackups"
TEMPFILER="/home/fadl/tmpmount"
#
/usr/bin/sshfs -o port=2233 $SERVERDIR $TEMPFILER
/usr/bin/rsync -az $TEMPFILER/* $BACKUPDIR/
/bin/fusermount -u $TEMPFILER
#
#remove oldest
#backup if >= 340 backups present
dirlist=$(find $BACKUPDIR/* -type d)
count=0
for i in $dirlist;
do
let count++
done
if
[ "$count" -ge "340" ]
then
echo "old folder found - deleting..."
find $BACKUPDIR/ -type d -printf "%TY%Tm%Td%TH%TM%TS %p\n" | sort -nr | tail -1 | cut -d" " -f2 | xargs -n1 rm -Rf
echo "...old folder deleted"
fi



28sqlfetch.sh

Created Friday 25 September 2020

#!/bin/bash
#2012/02/18 Leo Vendler
#2017/11/06 Leo Vendler

BACKUPDIR="/home/fadl/backup/SQLbackups"
SERVERDIR="fadl@10.1.0.27:SQLbackups"
TEMPFILER="/home/fadl/tmpmount"
#
/usr/bin/sshfs -o port=2233 $SERVERDIR $TEMPFILER
/usr/bin/rsync -az $TEMPFILER/* $BACKUPDIR/
/bin/fusermount -u $TEMPFILER
#
#remove oldest backup if >= 340 backups present
dirlist=$(find $BACKUPDIR/* -type d)
count=0
for i in $dirlist;
do
let count++
done
if
[ "$count" -ge "340" ]
then
echo "old folder found - deleting..."
find $BACKUPDIR/ -type d -printf "%TY%Tm%Td%TH%TM%TS %p\n" | sort -nr | tail -1 | cut -d" " -f2 | xargs -n1 rm -Rf
echo "...old folder deleted"
fi



32checkmount.sh

Created Monday 28 September 2020

#!/bin/bash
if [ "$(mount|grep -v grep|grep Maskiner)" == "" ]
then
mount -t cifs //10.1.0.57/Maskiner -o credentials=/root/cred/57,user=fadl,uid=fadl,gid=users /home/fadl/backup
fi



32crontab

Created Monday 28 September 2020

# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
45 * * * * fadl /home/fadl/sqlfetch.sh
50 * * * * fadl /home/fadl/sqlfetch_mit_fadl_dk.sh
00 3 * * * root /root/scripts/scanjob.sh
#



32mountsme.sh

Created Monday 28 September 2020

sshfs -o password_stdin,allow_other,uid=33,gid=0 root@10.1.0.38:/home/e-smith/files/ibays/x/html/kursusmateriale /var/www/fadlvagt/04_opskrivning/spv_kursus/kursusmateriale </root/.cred/sme.cred



32rc.local

Created Monday 28 September 2020

#mount C5 mappe til overfoersel af kommaseparerede filer fra webbooking
#mount -t cifs //10.1.0.9/webbooking -o credentials=/home/fadl/cred,uid=www-data,gid=root /var/www/ssl-sites/csvtrans
#mount kursusmateriale på smeserver
sleep 5
/usr/bin/sshfs -o password_stdin,allow_other,uid=33,gid=0 root@10.1.0.38:/home/e-smith/files/ibays/x/html/kursusmateriale /var/www/fadlvagt/04_opskrivning/spv_kursus/kursusmateriale </root/.cred/sme.cred
#mount drev på 10.1.0.15 til sqlbackup
/usr/bin/sshfs -o password_stdin,allow_other,uid=1000,gid=1000 fadl@10.1.0.15:/home/fadl/mountpoint_for_sqlbackups /home/fadl/SQLbackups </root/.cred/15.cred
#
#mount til timeoverførsler af MySQL-ting
mount -t cifs //10.1.0.57/Maskiner -o credentials=/home/fadl/cred/MyBackup,user=fadl,uid=fadl,gid=users /home/fadl/backup
#
sleep 5
/root/scripts/restoreIPtables.sh
#
exit 0

MyBackup=
username=fadl
password=1qaz@wsx



32restoreIPtables.sh

Created Monday 28 September 2020

#!/bin/bash
iptables -F
ipset restore </root/scripts/ipset_cn.zone
ipset restore </root/scripts/ipset_ru.zone
ipset restore </root/scripts/ipset_ua.zone
ipset restore </root/scripts/ipset_hr.zone
ipset restore </root/scripts/ipset_tw.zone
iptables-restore < /root/scripts/iptables.saved



32root

Created Monday 28 September 2020

32checkmount.sh

32scanjob.sh

32restoreIPtables.sh

32mountsme.sh ikke i brug



32rootcrontab

Created Monday 28 September 2020

# m h dom mon dow command
11 01 * * * ntpdate ntp.tuxfamily.net
# er nu i crontab 45 * * * * /home/fadl/sqlfetch.sh
# er nu i crontab 50 * * * * /home/fadl/sqlfetch_mit_fadl_dk.sh
00 * * * * /root/scripts/check_mount_backup.sh



32scanjob.sh

Created Monday 28 September 2020

#!/bin/bash
# 2018/11/27 Leo Vendler. Scanning af system med clamscan
#
UDSKRIV=0
DIR="/"
HOMEDIR="/home/fadl"
mkdir -p $HOMEDIR/scan_log
LOGFILE="$HOMEDIR/scan_log/clam.log"
UDSKRIV="0"
IPADR=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk -F'[/ ]+' '{print $3}')
MAILFROM="admin@fadl.dk"
MAILTO="tsh@fadl.dk"
MAILMSG="$HOMEDIR/scan_log/scanresultat.txt"
MAILSERVER="smtp-relay.gmail.com"
SUBJECT="Scanning af $MAILFROM ($IPADR) har fundet problemer"

#clamscan -i $DIR >$LOGFILE
nice -n 19 clamscan -r -i --exclude-dir="^/sys" $DIR>$LOGFILE

while read linie
do
FOUND=$(echo $linie|grep -v grep|grep FOUND)
if [ "$FOUND" <> " " ]
then
UDSKRIV=1
fi
done<$LOGFILE

if [ "$UDSKRIV" == "1" ]
then
echo "**** Virus/Worm fundet på $IPADR ****">$MAILMSG
cat $LOGFILE>>$MAILMSG
echo "*****************************************">>$MAILMSG
/usr/local/bin/sendemail -f $MAILFROM -t $MAILTO -u $SUBJECT -m $MAILMSG -s $MAILSERVER
fi



32SQL backup.sh

Created Monday 28 September 2020

#!/bin/bash
#2012/02/18 Leo Vendler

#NOW=`date +"%Y_%m_%d";
NOW=`date +"%Y_%m_%d_%H%M"`;
BACKUPDIR="/home/fadl/SQLbackups"
CURRENTBACKUP="$BACKUPDIR/$NOW";

### Server Setup ###
#* MySQL login user name *#
MUSER="root";

#* MySQL login PASSWORD name *#
#MPASS="pleaseb@home2me";
MPASS="1qaz@wsx";

#* MySQL login HOST name *#
MHOST="127.0.0.1";
MPORT="3306";

# DO NOT BACKUP these databases
IGNOREDB="
information_schema
mysql
test
"

#* MySQL binaries *#
MYSQL=`which mysql`;
MYSQLDUMP=`which mysqldump`;
GZIP=`which gzip`;

# create current backupdir
if [ ! -d $CURRENTBACKUP ]; then
mkdir -p $CURRENTBACKUP
else
:
fi

#remove oldest backup if >= 24 backups present
dirlist=$(find $BACKUPDIR/* -type d)
count=0
for i in $dirlist; do
let count++
done
if [ "$count" -ge "25" ]
then
echo "old folder found - deleting..."
find $BACKUPDIR/ -type d -printf "%TY%Tm%Td%TH%TM%TS %p\n" | sort -nr | tail -1 | cut -d" " -f2 | xargs -n1 rm -Rf
echo "...old folder deleted"
fi

# get all database listing
DBS="$($MYSQL -u $MUSER -p$MPASS -h $MHOST -P $MPORT -Bse 'show databases')"

# start to dump database one by one
for db in $DBS
do

DUMP="yes";
if [ "$IGNOREDB" != "" ]; then
for i in $IGNOREDB # Store all value of $IGNOREDB ON i
do
if [ "$db" == "$i" ]; then # If result of $DBS(db) is equal to $IGNOREDB(i) then
DUMP="NO"; # SET value of DUMP to "no"
#echo "$i database is being ignored!";
fi
done
fi

if [ "$DUMP" == "yes" ]; then # If value of DUMP is "yes" then backup database
# FILE="$CURRENTBACKUP/$db.gz";
FILE="$CURRENTBACKUP/$db.sql";
echo "BACKING UP $db";
# $MYSQLDUMP --add-drop-database --opt --lock-all-tables -u $MUSER -p$MPASS -h $MHOST -P $MPORT $db | gzip > $FILE
$MYSQLDUMP --add-drop-database --opt --lock-all-tables -u $MUSER -p$MPASS -h $MHOST -P $MPORT $db > $FILE
fi
done



32sqlfetch mit fadl dk.dk

Created Monday 28 September 2020

#!/bin/bash
#20130902 Leo Vendler
#20160404 Torben
#20171106 Leo sshfs

BACKUPDIR="/home/fadl/backup/SQLbackups_mit_fadl_dk"
SERVERDIR="fadl@10.1.0.54:/home/fadl/SQLbackups"
TEMPFILER="/home/fadl/tmpmount1"
#
/usr/bin/sshfs -o port=2233 $SERVERDIR $TEMPFILER
/usr/bin/rsync -az $TEMPFILER/* $BACKUPDIR/
/bin/fusermount -u $TEMPFILER
#
#remove oldest
#backup if >= 340 backups present
dirlist=$(find $BACKUPDIR/* -type d)
count=0
for i in $dirlist;
do
let count++
done
if
[ "$count" -ge "340" ]
then
echo "old folder found - deleting..."
find $BACKUPDIR/ -type d -printf "%TY%Tm%Td%TH%TM%TS %p\n" | sort -nr | tail -1 | cut -d" " -f2 | xargs -n1 rm -Rf
echo "...old folder deleted"
fi



32sqlfetch.sh

Created Monday 28 September 2020

#!/bin/bash
#2012/02/18 Leo Vendler
#2017/11/06 Leo Vendler

BACKUPDIR="/home/fadl/backup/SQLbackups"
SERVERDIR="fadl@10.1.0.27:SQLbackups"
TEMPFILER="/home/fadl/tmpmount"
#
/usr/bin/sshfs -o port=2233 $SERVERDIR $TEMPFILER
/usr/bin/rsync -az $TEMPFILER/* $BACKUPDIR/
/bin/fusermount -u $TEMPFILER
#
#remove oldest backup if >= 340 backups present
dirlist=$(find $BACKUPDIR/* -type d)
count=0
for i in $dirlist;
do
let count++
done
if
[ "$count" -ge "340" ]
then
echo "old folder found - deleting..."
find $BACKUPDIR/ -type d -printf "%TY%Tm%Td%TH%TM%TS %p\n" | sort -nr | tail -1 | cut -d" " -f2 | xargs -n1 rm -Rf
echo "...old folder deleted"
fi



32SQLrestore mit fadl dk.sh

Created Monday 28 September 2020
#!/bin/bash

#20120218 Leo Vendler
#20180625 Leo Vendler

### Databases to restore ###
DATABASES="webbooking
taskmanager
"

#* DIR where the backup is stored *#
BACKUPDIR="/home/fadl/backup/SQLbackups_mit_fadl_dk/2020_03_14_1230";

### MySQL Setup ###
#* MySQL login user name *#
MUSER="root";

#* MySQL login PASSWORD name *#
read -p "Indtast password: " pasord;
MPASS=$pasord

#* MySQL login HOST name *#
MHOST="127.0.0.1";
MPORT="3306";

#* MySQL binaries *#
MYSQL=`which mysql`;


#* Restore databases *#
for db in $DATABASES
do
echo "Restoring $db";
$MYSQL -u $MUSER --password=$MPASS $db < $BACKUPDIR/$db.sql
done



32SQL restore.sh

Created Monday 28 September 2020

#!/bin/bash

#20120218 Leo Vendler
#20180625 Leo Vendler

### Databases to restore ###
DATABASES="webbooking
taskmanager
"

#* DIR where the backup is stored *#
BACKUPDIR="/home/fadl/backup/SQLbackups/2020_03_14_1230";

### MySQL Setup ###
#* MySQL login user name *#
MUSER="root";

#* MySQL login PASSWORD name *#
read -p "Indtast password: " pasord;
MPASS=$pasord

#* MySQL login HOST name *#
MHOST="127.0.0.1";
MPORT="3306";

#* MySQL binaries *#
MYSQL=`which mysql`;


#* Restore databases *#
for db in $DATABASES
do
echo "Restoring $db";
$MYSQL -u $MUSER --password=$MPASS $db < $BACKUPDIR/$db.sql
done



32tmpmountINFO.txt

Created Monday 28 September 2020

#2017/11/06 Leo
tmpmount og tmpmount1 bruges af sqlfetch-scripts og må ikke slettes eller bruges til andet!



35backup26.sh

Created Friday 25 September 2020

#!/bin/bash
#LVM backup script tager backup af wordpress2 (10.1.0.26) paa 10.1.0.35
#LV2017/02/03
#
# restore:installer pv og eksekver som nedenfor
# pv backupfilnavn.gz | gzip -d | dd of=/dev/vgX/partition
# editer/kopier /etc/libvirt/qemu/navn_paa_maskine
# virsh define den nye maskine
#
snapvg="/dev/vg0"
lvol="wordpress2"
backupstore="/home/fadl/backup/snapshots/wordpress2/"
mailserver="10.1.0.31"
todaysdate=`date "+%Y-%m-%d"`

trap 'cleanup;exit 1' 1 2

cleanup()
{
/sbin/lvremove -f $snapvg/$lvol-snapshot
echo "###--cleanup executed--###" >> /var/log/lvmbackup.log
}

echo "-----------------------------" >> /var/log/lvmbackup.log
date >> /var/log/lvmbackup.log 2>&1

/sbin/lvcreate -L 800M -s -n $lvol-snapshot $snapvg/$lvol >> /var/log/lvmbackup.log 2>&1
echo "backup of $lvol"

/bin/dd if=$snapvg/$lvol-snapshot bs=4k | /bin/gzip>$backupstore$lvol.$todaysdate.gz

if [ "$?" -eq 1 ]
then

echo -e "*Wordpress-SCRIPT FAILED, THERE WERE ERRORS*" >> /var/log/lvmbackup.log 2>&1
date >> /var/log/lvmbackup.log 2>&1
/sbin/lvremove -f $snapvg/$lvol-snapshot
echo "Backup af 10.1.0.26 wordpress2 fejlede!"|msmtp tsh@fadl.dk
#slet ikke-afsluttet backup
rm -f $backupstore$lvol.$todaysdate.gz
exit 1
else
echo -e "backup of $lvol done OK!" >> /var/log/lvmbackup.log 2>&1
date >> /var/log/lvmbackup.log 2>&1
#slet tidligere backup
rm -f $backupstore$lvol.gz
#rename backupfil
mv -f $backupstore$lvol.$todaysdate.gz $backupstore$lvol.gz
fi

/sbin/lvremove -f $snapvg/$lvol-snapshot



35backup27.sh

Created Friday 25 September 2020

#!/bin/bash
#LVM backup script tager backup af webbooking paa 10.1.0.27 (linuxdelen)
#LV2015/05/12
#
# restore:installer pv og eksekver som nedenfor
# pv backupfilnavn.gz | gzip -d | dd of=/dev/vgX/partition
# editer/kopier /etc/libvirt/qemu/navn_paa_maskine
# virsh define den nye maskine
#
snapvg="/dev/vg1"
lvol="webbooking"
backupstore="/home/fadl/backup/snapshots/webbooking/"
mailserver="10.1.0.31"
todaysdate=`date "+%Y-%m-%d"`

trap 'cleanup;exit 1' 1 2

cleanup()
{
/sbin/lvremove -f $snapvg/$lvol-snapshot
echo "###--cleanup executed--###" >> /var/log/lvmbackup.log
}

echo "-----------------------------" >> /var/log/lvmbackup.log
date >> /var/log/lvmbackup.log 2>&1

/sbin/lvcreate -L 1G -s -n $lvol-snapshot $snapvg/$lvol >> /var/log/lvmbackup.log 2>&1
echo "backup of $lvol"

/bin/dd if=$snapvg/$lvol-snapshot bs=4k | /bin/gzip>$backupstore$lvol.$todaysdate.gz

if [ "$?" -eq 1 ]
then

echo -e "*Webbooking-SCRIPT FAILED, THERE WERE ERRORS*" >> /var/log/lvmbackup.log 2>&1
date >> /var/log/lvmbackup.log 2>&1
/sbin/lvremove -f $snapvg/$lvol-snapshot
# /root/scripts/sendemail -f admin@fadl.dk -t tsh@fadl.dk -s $mailserver -u "Backup af webbooking fejlede!" -m "backup log"
echo "Backup af webbooking fejlede!"|msmtp tsh@fadl.dk
#slet ikke-afsluttet backup
rm -f $backupstore$lvol.$todaysdate.gz
exit 1
else
echo -e "backup of $lvol done OK!" >> /var/log/lvmbackup.log 2>&1
date >> /var/log/lvmbackup.log 2>&1

#slet tidligere backup
rm -f $backupstore$lvol.gz
#rename backupfil
mv -f $backupstore$lvol.$todaysdate.gz $backupstore$lvol.gz
fi

/sbin/lvremove -f $snapvg/$lvol-snapshot



35backupSME.sh

Created Friday 25 September 2020

#!/bin/bash
#LVM backup script tager backup af SME paa 10.1.0.38
#LV2015/03/25
#
# restore:installer pv og eksekver som nedenfor
# pv backupfilnavn.gz | gzip -d | dd of=/dev/vgX/partition
# editer/kopier /etc/libvirt/qemu/navn_paa_maskine
# virsh define den nye maskine
#
snapvg="/dev/vg2"
lvol="SME"
backupstore="/home/fadl/backup/snapshots/SME/"
mailserver="10.1.0.31"
todaysdate=`date "+%Y-%m-%d"`

trap 'cleanup;exit 1' 1 2

cleanup()
{
/sbin/lvremove -f $snapvg/$lvol-snapshot
echo "###--cleanup executed--###" >> /var/log/lvmbackup.log
}

echo "-----------------------------" >> /var/log/lvmbackup.log
date >> /var/log/lvmbackup.log 2>&1

/sbin/lvcreate -L 800M -s -n $lvol-snapshot $snapvg/$lvol >> /var/log/lvmbackup.log 2>&1
echo "backup of $lvol"

/bin/dd if=$snapvg/$lvol-snapshot bs=4k | /bin/gzip>$backupstore/$lvol.$todaysdate.gz

if [ "$?" -eq 1 ]
then

echo -e "*SME-SCRIPT FAILED, THERE WERE ERRORS*" >> /var/log/lvmbackup.log 2>&1
date >> /var/log/lvmbackup.log 2>&1
/sbin/lvremove -f $snapvg/$lvol-snapshot
# /root/scripts/sendemail -f admin@fadl.dk -t tsh@fadl.dk -s $mailserver -u "Backupsnapshot af SME fejlede!" -m "backup log"
echo "Backupsnapshot af SME fejlede!"|msmtp tsh@fadl.dk
#slet ikke-afsluttet backup
rm -f $backupstore/$lvol.$todaysdate.gz
exit 1
else
echo -e "backup of $lvol done OK!" >> /var/log/lvmbackup.log 2>&1
date >> /var/log/lvmbackup.log 2>&1
#slet tidligere backup
rm -f $backupstore$lvol.gz
#rename backupfil
mv -f $backupstore$lvol.$todaysdate.gz $backupstore$lvol.gz
fi

/sbin/lvremove -f $snapvg/$lvol-snapshot



35check mount.sh

Created Friday 25 September 2020

#!/bin/bash
if [ "$(mount|grep -v grep|grep Maskiner)" == "" ]
then
mount -t cifs //10.1.0.57/Maskiner -o credentials=/root/cred/57,user=fadl,uid=fadl,gid=users /home/fadl/backup
fi



35copystatus.sh

Created Friday 25 September 2020

#!/bin/bash
scp -o port=2233 /home/fadl/10.1.0.35_systemrapport.html root@10.1.0.28:/var/www/monitor/



35lv

Created Sunday 27 September 2020

--- Logical volume ---
LV Name /dev/vg2/SME
VG Name vg2
LV UUID BwoYA0-LcVt-hhme-djzF-Rofk-Nk2d-UirZ4R
LV Write Access read/write
LV Status available
# open 1
LV Size 600.00 GiB
Current LE 153600
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:0

--- Logical volume ---
LV Name /dev/vg1/webbooking
VG Name vg1
LV UUID 3Ioy9N-MpIH-t6yT-6C7e-SAe1-5BVr-iMGRFH
LV Write Access read/write
LV snapshot status source of

/dev/vg1/webbooking-snapshot [active]
LV Status available
# open 1
LV Size 55.00 GiB
Current LE 14080
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:1

--- Logical volume ---
LV Name /dev/vg1/webbooking-snapshot
VG Name vg1
LV UUID ikovsW-YwZG-BGWN-wSIH-IKNT-3ycE-XziKKf
LV Write Access read/write
LV snapshot status active destination for /dev/vg1/webbooking
LV Status available
# open 1
LV Size 55.00 GiB
Current LE 14080
COW-table size 1.00 GiB
COW-table LE 256
Allocated to snapshot 0.77%
Snapshot chunk size 4.00 KiB
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:3

--- Logical volume ---
LV Name /dev/vg0/wordpress2
VG Name vg0
LV UUID By05Xa-QC5M-O3cT-Gdlk-VSE4-XBLl-LN4iS2
LV Write Access read/write
LV Status available
# open 1
LV Size 25.00 GiB
Current LE 6400
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:2



35pv

Created Sunday 27 September 2020

--- Physical volume ---
PV Name /dev/sdc
VG Name vg2
PV Size 697.56 GiB / not usable 2.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 178575
Free PE 24975
Allocated PE 153600
PV UUID 4pekoJ-p6ID-yQRY-Aerh-zjK2-hbIK-BAyjM2

--- Physical volume ---
PV Name /dev/sdb
VG Name vg1
PV Size 58.67 GiB / not usable 1.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 15020
Free PE 684
Allocated PE 14336
PV UUID yb67bw-rMXy-df6Z-ndy4-C5U3-e1O2-Zb0wYo

--- Physical volume ---
PV Name /dev/sda4
VG Name vg0
PV Size 245.77 GiB / not usable 1.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 62918
Free PE 56518
Allocated PE 6400
PV UUID qjLxRl-Q6ye-1u74-R3lD-5yl1-XLUj-dsKX3E



35raidmonitor.sh

Created Friday 25 September 2020

#!/bin/bash
ADMIN="leo@fadl.dk"
HOSTNAME="10.1.0.15"

if egrep "\[.*_.*\]" /proc/mdstat > /dev/null
then

/usr/bin/sendemail -f udvikling@fadl.dk -t ${ADMIN} -s mail.fadl.dk -u "RAID fejl!" -m "Fejl paa en eller flere software RAID \
enheder on ${HOSTNAME}"
fi



35restoreIptables.sh

Created Friday 25 September 2020

#!/bin/bash
iptables -F
ipset restore </root/scripts/ipset_cn.zone
ipset restore </root/scripts/ipset_ru.zone
ipset restore </root/scripts/ipset_ua.zone
ipset restore </root/scripts/ipset_hr.zone
ipset restore </root/scripts/ipset_tw.zone
iptables-restore < /root/scripts/iptables.saved



35root

Created Friday 25 September 2020

35backupSME.sh

35backup27.sh

35backup26.sh

35check_mount.sh

35copystatus.sh

35restoreIptables.sh



35scripts

Created Friday 25 September 2020

35test.sh

35systemrapport.sh

35raidmonitor.sh

35scrub_md1.sh



35scrub md1.sh

Created Friday 25 September 2020

#!/bin/sh
cat /sys/block/md1/md/mismatch_cnt>/home/fadl/md1_check.txt
echo check >/sys/block/md1/md/sync_action
sleep 240
cat /proc/mdstat>>/home/fadl/md1_check.txt



35systemrapport.sh

Created Friday 25 September 2020

#!/bin/bash

function linie {
echo "- - - - - - - - - - - - - - - - - - - -<BR>">>nyrap.html
}

cd /home/fadl
ip=$(/sbin/ifconfig|grep 0.35|awk {'print $2'})

#begynd at opbygge nyrap.html
echo "<!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.0 Transitional//EN">" > nyrap.html
echo "<HTML>" >> nyrap.html
echo "<HEAD>" >> nyrap.html
echo "<META NAME="Description" CONTENT="generated_by_Linux_autoindex">" >> nyrap.html
echo "<META HTTP-EQUIV=CONTENT-TYPE CONTENT=text/html; charset=iso-8859-15>" >> nyrap.html
echo "<META NAME="robots" content="noindex,nofollow">" >> nyrap.html
echo "<TITLE>Systemrapport</TITLE>" >> nyrap.html
echo "</HEAD>" >> nyrap.html
echo "<BODY LANG="da-DK" DIR="LTR">" >> nyrap.html
echo "<p align=center><font face=Verdana>rapport fra 10.1.0.35<BR>" >> nyrap.html
echo "<p align=center><font face=Verdana>$ip<BR>" >> nyrap.html
date >> nyrap.html
echo "<BR></p><PRE>" >> nyrap.html

df -hP|while read line
do
echo $line>>nyrap.html
#echo "<BR>">>nyrap.html
done

linie
#/sbin/mdadm --detail /dev/md0>>nyrap.html
#linie
#/sbin/mdadm --detail /dev/md1>>nyrap.html
#linie
#cat /proc/mdstat>>nyrap.html
#linie
#for i in `seq 0 1`;
#do
#if [ -e "md"$i"_check.txt" ];
#then
#echo "periodisk check af RAID integritet md"$i>>nyrap.html
#stat --format=%z md$i"_check.txt">>nyrap.html
#cat md$i"_check.txt">>nyrap.html
#linie
#mv -f "md"$i"_check.txt" "md"$i"_check.old"
#fi
#done

#linie
vnstat -d>>nyrap.html
echo "</PRE></BODY>" >> nyrap.html
echo "</HTML>" >> nyrap.html
rm -f 10.1.0.35_systemrapport.html
cp -f nyrap.html 10.1.0.35_systemrapport.html
rm -f nyrap.html



35scrub md0.sh

Created Friday 25 September 2020

#!/bin/sh
cat /sys/block/md0/md/mismatch_cnt>/home/fadl/md0_check.txt
echo check >/sys/block/md0/md/sync_action
sleep 240
cat /proc/mdstat>>/home/fadl/md0_check.txt



35systemrapport.sh 35scrub md0.sh

Created Tuesday 12 January 2021



35test.sh

Created Friday 25 September 2020

#!/bin/bash
ADMIN="leo@fadl.dk"
HOSTNAME="10.1.0.15"
/usr/bin/sendemail -f udvikling@fadl.dk -t ${ADMIN} -s mail.fadl.dk -u "RAID fejl!" -m "Fejl paa en eller flere software RAID \

enheder on ${HOSTNAME}"



35vg

Created Sunday 27 September 2020

--- Volume group ---
VG Name vg2
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 5627
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 697.56 GiB
PE Size 4.00 MiB
Total PE 178575
Alloc PE / Size 153600 / 600.00 GiB
Free PE / Size 24975 / 97.56 GiB
VG UUID hw1DsT-VoLE-tk3m-mgtD-ZTVS-HS4B-N8mqa2

--- Volume group ---
VG Name vg1
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 5266
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 58.67 GiB
PE Size 4.00 MiB
Total PE 15020
Alloc PE / Size 14336 / 56.00 GiB
Free PE / Size 684 / 2.67 GiB
VG UUID zO9SVo-UWfd-s7nB-15tG-dfiv-N6tK-AQYNyJ

--- Volume group ---
VG Name vg0
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4006
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 245.77 GiB
PE Size 4.00 MiB
Total PE 62918
Alloc PE / Size 6400 / 25.00 GiB
Free PE / Size 56518 / 220.77 GiB
VG UUID PzgPCG-MZV7-a4bA-n535-eZB7-UFFq-Vec1d9



53backup52.sh

Created Wednesday 02 December 2020

#!/bin/bash
#LVM backup script tager backup af 2020fadldk paa 10.1.0.55
#LV2020/11/24
#
# restore:installer pv og eksekver som nedenfor
# pv backupfilnavn.gz| gzip -d | dd of=/dev/vgX/partition
# editer/kopier /etc/libvirt/qemu/navn_paa_maskine
#
virsh define den nye maskine
#
snapvg="/dev/vg0"
lvol="2020fadldk"
backupstore="/home/fadl/backup/snapshots/fadldk/"
mailserver="10.1.0.31"
todaysdate=`date
"+%Y-%m-%d"`

trap 'cleanup;exit 1' 1 2

cleanup()
{
/sbin/lvremove
-f $snapvg/$lvol-snapshot
echo "###--cleanup executed--###"
>> /var/log/lvmbackup.log
}

echo "-----------------------------"
>> /var/log/lvmbackup.log
date >> /var/log/lvmbackup.log
2>&1

/sbin/lvcreate -L 800M -s -n $lvol-snapshot $snapvg/$lvol >> /var/log/lvmbackup.log
2>&1
echo "backup of $lvol"

/bin/dd if=$snapvg/$lvol-snapshot
bs=4k | /bin/gzip>$backupstore/$lvol.$todaysdate.gz

if
[ "$?" -eq 1 ]
then

echo -e "***SCRIPT FAILED,
THERE WERE ERRORS***" >> /var/log/lvmbackup.log 2>&1
date >> /var/log/lvmbackup.log 2>&1
/sbin/lvremove -f $snapvg/$lvol-snapshot
/root/scripts/sendemail -f admin@fadl.dk -t tsh@fadl.dk -s $mailserver -u "Backup af 2020fadldk fejlede!" -m "backup log"
#slet ikke-afsluttet backup
rm -f $backupstore/$lvol.$todaysdate.gz
exit 1
else
echo -e "backup of $lvol done OK!" >> /var/log/lvmbackup.log
2>&1
date >> /var/log/lvmbackup.log 2>&1
#slet tidligere backup
rm -f $backupstore$lvol.gz
#rename backupfil
mv -f $backupstore$lvol.$todaysdate.gz $backupstore$lvol.gz
fi
/sbin/lvremove -f $snapvg/$lvol-snapshot



53backup54.sh

Created Saturday 26 September 2020

#!/bin/bash
#LVM backup script tager backup af medlemssystem
paa 10.1.0.54 (linuxdelen)
#LV2013/10/22
#
# restore:installer
pv og eksekver som nedenfor
# pv backupfilnavn.gz | gzip -d |
dd of=/dev/vgX/partition
# editer/kopier /etc/libvirt/qemu/navn_paa_maskine
#
virsh define den nye maskine
#
snapvg="/dev/vg1"
lvol="medlemssystem"
backupstore="/home/fadl/backup/snapshots/mit/"
mailserver="10.1.0.31"
todaysdate=`date
"+%Y-%m-%d"`

trap 'cleanup;exit 1' 1 2

cleanup()
{
/sbin/lvremove
-f $snapvg/$lvol-snapshot
echo "###--cleanup executed--###"
>> /var/log/lvmbackup.log
}

echo "-----------------------------"
>> /var/log/lvmbackup.log
date >> /var/log/lvmbackup.log
2>&1

/sbin/lvcreate -L 800M -s -n $lvol-snapshot $snapvg/$lvol >> /var/log/lvmbackup.log
2>&1
echo "backup of $lvol"

/bin/dd if=$snapvg/$lvol-snapshot
bs=4k | /bin/gzip>$backupstore/$lvol.$todaysdate.gz

if
[ "$?" -eq 1 ]
then

echo -e "***SCRIPT FAILED,
THERE WERE ERRORS***" >> /var/log/lvmbackup.log 2>&1

date >> /var/log/lvmbackup.log 2>&1
/sbin/lvremove
-f $snapvg/$lvol-snapshot
/root/scripts/sendemail -f admin@fadl.dk -t tsh@fadl.dk -s $mailserver -u "Backup af mit fejlede!" -m "backup log"
#slet ikke-afsluttet backup
rm -f $backupstore/$lvol.$todaysdate.gz
exit 1
else
echo -e "backup of $lvol done OK!" >> /var/log/lvmbackup.log
2>&1
date >> /var/log/lvmbackup.log 2>&1
#slet
tidligere backup
rm -f $backupstore$lvol.gz
#rename backupfil

mv -f $backupstore$lvol.$todaysdate.gz $backupstore$lvol.gz
fi

/sbin/lvremove
-f $snapvg/$lvol-snapshot



53backup55.sh

Created Saturday 26 September 2020

#!/bin/bash
#LVM backup script tager backup af fadldk paa
10.1.0.55
#LV2016/10/24
#
# restore:installer pv og eksekver som nedenfor
# pv backupfilnavn.gz| gzip -d | dd of=/dev/vgX/partition
# editer/kopier /etc/libvirt/qemu/navn_paa_maskine
#
virsh define den nye maskine
#
snapvg="/dev/vg0"
lvol="fadldk"
backupstore="/home/fadl/backup/snapshots/fadldk/"
mailserver="10.1.0.31"
todaysdate=`date
"+%Y-%m-%d"`

trap 'cleanup;exit 1' 1 2

cleanup()
{
/sbin/lvremove
-f $snapvg/$lvol-snapshot
echo "###--cleanup executed--###"
>> /var/log/lvmbackup.log
}

echo "-----------------------------"
>> /var/log/lvmbackup.log
date >> /var/log/lvmbackup.log
2>&1

/sbin/lvcreate -L 800M -s -n $lvol-snapshot $snapvg/$lvol >> /var/log/lvmbackup.log
2>&1
echo "backup of $lvol"

/bin/dd if=$snapvg/$lvol-snapshot
bs=4k | /bin/gzip>$backupstore/$lvol.$todaysdate.gz

if
[ "$?" -eq 1 ]
then

echo -e "***SCRIPT FAILED,
THERE WERE ERRORS***" >> /var/log/lvmbackup.log 2>&1

date >> /var/log/lvmbackup.log 2>&1
/sbin/lvremove
-f $snapvg/$lvol-snapshot
/root/scripts/sendemail -f admin@fadl.dk
-t tsh@fadl.dk -s $mailserver -u "Backup af fadldk fejlede!"
-m "backup log"
#slet ikke-afsluttet backup

rm -f $backupstore/$lvol.$todaysdate.gz

exit 1
else

echo -e "backup of $lvol done OK!" >> /var/log/lvmbackup.log
2>&1
date >> /var/log/lvmbackup.log 2>&1
#slet
tidligere backup
rm -f $backupstore$lvol.gz
#rename backupfil

mv -f $backupstore$lvol.$todaysdate.gz $backupstore$lvol.gz
fi

/sbin/lvremove -f $snapvg/$lvol-snapshot



53backupWin.sh

Created Saturday 26 September 2020

#!/bin/bash
#LVM backup script tager backup af c5medlem
(Windows) paa 10.1.0.56
#LV2013/10/22
#
# restore:installer
pv og eksekver som nedenfor
# pv backupfilnavn.gz | gzip -d |
dd of=/dev/vgX/partition
# editer/kopier /etc/libvirt/qemu/navn_paa_maskine
#
virsh define den nye maskine
#
snapvg="/dev/vg0"
lvol="c5medlem"
backupstore="/home/fadl/backup/snapshots/c5medlem/"
mailserver="10.1.0.31"
todaysdate=`date "+%Y-%m-%d"`

trap 'cleanup;exit 1' 1 2

cleanup()
{
/sbin/lvremove -f $snapvg/$lvol-snapshot
echo "###--cleanup executed--###" >> /var/log/lvmbackup.log
}

echo "-----------------------------"
>> /var/log/lvmbackup.log
date >> /var/log/lvmbackup.log
2>&1

/sbin/lvcreate -L 1G -s -n $lvol-snapshot $snapvg/$lvol >> /var/log/lvmbackup.log
2>&1
echo "backup of $lvol"

/bin/dd if=$snapvg/$lvol-snapshot
bs=4k | /bin/gzip>$backupstore/$lvol.$todaysdate.gz

if
[ "$?" -eq 1 ]
then

echo -e "***SCRIPT FAILED,
THERE WERE ERRORS***" >> /var/log/lvmbackup.log 2>&1

date >> /var/log/lvmbackup.log 2>&1
/sbin/lvremove
-f $snapvg/$lvol-snapshot
/root/scripts/sendemail -f admin@fadl.dk
-t tsh@fadl.dk -s $mailserver -u "Backup af c5medlem fejlede!"
-m "backup log"
#slet ikke-afsluttet backup

rm -f $backupstore/$lvol.$todaysdate.gz

exit 1
else

echo -e "backup of $lvol done OK!" >> /var/log/lvmbackup.log
2>&1
date >> /var/log/lvmbackup.log 2>&1
#slet
tidligere backup
rm -f $backupstore$lvol.gz
#rename backupfil

mv -f $backupstore$lvol.$todaysdate.gz $backupstore$lvol.gz
fi

/sbin/lvremove -f $snapvg/$lvol-snapshot



53backupWinSQL.sh

Created Saturday 26 September 2020

#!/bin/bash
#LVM backup script tager backup af c5medlem (SQL-databasen) paa 10.1.0.54 #LV2015/06/11 #
# restore:installer pv og eksekver som nedenfor
# pv backupfilnavn.gz | gzip -d | dd of=/dev/vgX/partition
# editer/kopier /etc/libvirt/qemu/navn_paa_maskine
# virsh define den nye maskine
#
snapvg="/dev/vg1"
lvol="windowsSQL"
backupstore="/home/fadl/backup/snapshots/c5medlem/"
todaysdate=`date "+%Y-%m-%d"`
mailserver="10.1.0.31"
trap 'cleanup;exit 1' 1 2
cleanup()
{
/sbin/lvremove -f $snapvg/$lvol-snapshot
echo "###--cleanup executed--###" >> /var/log/lvmbackup.log
}
echo "-----------------------------" >> /var/log/lvmbackup.log date >> /var/log/lvmbackup.log 2>&1 /sbin/lvcreate -L 500M -s -n $lvol-snapshot $snapvg/$lvol >> /var/log/lvmbackup.log 2>&1 echo "backup of $lvol" /bin/dd if=$snapvg/$lvol-snapshot bs=4k | /bin/gzip>$backupstore/$lvol.$todaysdate.gz if [ "$?" -eq 1 ] then echo -e "*SCRIPT FAILED, THERE WERE ERRORS*" >> /var/log/lvmbackup.log 2>&1 date >> /var/log/lvmbackup.log 2>&1 /sbin/lvremove -f $snapvg/$lvol-snapshot /root/scripts/sendemail -f admin@fadl.dk -t tsh@fadl.dk -s $mailserver -u "Backup af c5medlem-SQL fejlede!" -m "backup log" #slet ikke-afsluttet backup rm -f $backupstore/$lvol.$todaysdate.gz exit 1 else echo -e "backup of $lvol done OK!" >> /var/log/lvmbackup.log 2>&1 date >> /var/log/lvmbackup.log 2>&1 #slet tidligere backup rm -f $backupstore$lvol.gz #rename backupfil mv -f $backupstore$lvol.$todaysdate.gz $backupstore$lvol.gz fi /sbin/lvremove -f $snapvg/$lvol-snapshot]



53crontab

Created Saturday 26 September 2020

0 18 * * * /root/scripts/backup54.sh
0 21 * * * /root/scripts/backup55.sh
0 19 * * * /root/scripts/backupWin.sh
0 20 * * * /root/scripts/backupWinSQL.sh



53lv

Created Saturday 26 September 2020

--- Logical volume ---
LV Name /dev/vg1/windowsSQL
VG
Name vg1
LV UUID hhk01S-Jooy-u5i7-65MQ-B4KX-RTQA-dffcXb

LV Write Access read/write
LV Status available
# open 1

LV Size 28,00 GiB
Current LE 7168
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256

Block device 252:1

--- Logical volume ---
LV Name /dev/vg1/medlemssystem

VG Name vg1
LV UUID 2mfGJA-YHG7-Cycb-6emD-MwzJ-sQ1F-oPd7h0

LV Write Access read/write
LV Status available
# open 1

LV Size 27,00 GiB
Current LE 6912
Segments 1
Allocation

inherit
Read ahead sectors auto
- currently set to 256

Block device 252:2


--- Logical volume ---
LV Name /dev/vg0/c5medlem
VG Name vg0
LV UUID uJia88-imGb-Ff7F-0eTT-dRUZ-NZgU-XntJYQ
LV Write Access read/write
LV Status available
# open 1
LV Size 100,00 GiB
Current LE 25600
Segments 2
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:2

--- Logical volume ---
LV Name /dev/vg0/fadldk
VG Name vg0
LV UUID 3lb4Hm-7hq5-aexM-FgoY-3q4Z-5s2e-ubQfys
LV Write Access read/write
LV Status available
# open 1
LV Size 20,00 GiB
Current LE 5120
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:3

--- Logical volume ---
LV Name /dev/vg0/2020fadldk
VG Name vg0
LV UUID 11hq7Q-w3CU-7WS0-Wl2f-gUPZ-n2ls-zol8xE
LV Write Access read/write
LV Status available
# open 0
LV Size 25,00 GiB
Current LE 6400
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:5



53pv

Created Saturday 26 September 2020

--- Physical volume ---
PV Name /dev/sdb1
VG Name vg1

PV Size 55,88 GiB / not usable 3,00 MiB
Allocatable yes
PE
Size 4,00 MiB
Total PE 14304
Free PE 224
Allocated PE 14080

PV UUID 7Rl4KZ-x82L-vmL0-flJu-3bKm-lfdL-HXCl34

---
Physical volume ---
PV Name /dev/sda4
VG Name vg0
PV Size 240,19
GiB / not usable 3,00 MiB
Allocatable yes
PE Size 4,00 MiB

Total PE 61487
Free PE 48687
Allocated PE 12800
PV UUID ZkzPAq-F07n-ef61-McYy-Ilhh-Y2xJ-907t31



53rc.local

Created Saturday 26 September 2020

#LV20131023
mount -t cifs //10.1.0.57/Maskiner/snapshots -o credentials=/home/fadl/cred,user=fadl,uid=fadl,gid=users /home/fadl/backup
exit 0



53root

Created Saturday 26 September 2020

53backup52.sh

53backup54.sh

53backup55.sh

53backupWin.sh

53backupWinSQL.sh



53vg

Created Saturday 26 September 2020

--- Volume group ---
VG Name vg1
System ID
Format lvm2

Metadata Areas 1
Metadata Sequence No 1599
VG Access read/write

VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0

Cur PV 1
Act PV 1
VG Size 55,88 GiB
PE Size 4,00 MiB
Total
PE 14304
Alloc PE / Size 14080 / 55,00 GiB
Free PE / Size 224 /
896,00 MiB
VG UUID Lidwod-zlhd-TqF0-yRHS-bXoG-pTUy-ovq2Lv


--- Volume group ---
VG Name vg0
System ID
Format lvm2

Metadata Areas 1
Metadata Sequence No 1562
VG Access read/write

VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0

Cur PV 1
Act PV 1
VG Size 240,18 GiB
PE Size 4,00 MiB
Total
PE 61487
Alloc PE / Size 12800 / 50,00 GiB
Free PE / Size 48687/ 190,18 GiB
VG UUID n6O5dY-swbA-NYyQ-bygV-2o2p-sDwt-qWl2hs



54check mount59.sh

Created Friday 25 September 2020

#!/bin/bash
if [ "$(mount|grep -v grep|grep skadedoku)" == "" ]
then
mount -t cifs //10.1.0.59/skadedoku_forsikring -o credentials=/root/scripts/cred59,vers=3.0,uid=www-data,gid=www-data /var/www/medlemssystem/forsikring_skadedoku
mount -t cifs //10.1.0.59/kursusmateriale -o credentials=/root/scripts/cred59,vers=3.0,uid=www-data,gid=www-data /var/www/ssl-sites/medlemssystem/kursusmateriale/
fi



54check mount.sh

Created Friday 25 September 2020

#!/bin/bash
if [ "$(mount|grep -v grep|grep csvtrans)" == "" ]
then
mount -t cifs //10.1.0.56/medlemssystem_filer -o credentials=/home/fadl/cred,uid=www-data,gid=root /var/www/ssl-sites/csvtrans
fi



54crontab

Created Monday 28 September 2020

etc/crontab
00 3 * * * root /root/scripts/scanjob.sh
50 * * * * fadl /home/fadl/sqlsave.sh

root_crontab
# m h dom mon dow command

30 * * * * /home/fadl/SQL_backup.sh
plus en masse php fra Torben



54rc.local

Created Monday 28 September 2020

# mount C5 mappe til overfoersel af kommasep. filer
mount -t cifs //10.1.0.56/medlemssystem_filer -o credentials=/home/fadl/cred,uid=www-data,gid=root /var/www/ssl-sites/csvtrans
#
mount -t cifs //10.1.0.59/skadedoku_forsikring -o credentials=/root/scripts/cred59,uid=www-data,gid=www-data /var/www/medlemssystem/forsikring_skadedoku
#
sleep 5
#
#LV20200928
mount -t cifs //10.1.0.57/Maskiner -o credentials=/home/fadl/.cred1/MyBackup,user=fadl,uid=fadl,gid=users /home/fadl/backup
#
sleep 5
#
/root/scripts/restoreIPtables.sh
#
exit 0
#20171130 Spottet af LV. Er dette forsøg på hacking ?
# /bin/ssh.d
# /bin/ssh.d
# 3 filer i /bin er omdøbt af sikkerhedshensyn til at starte med FAKE
#####################################################################



54restoreIPtables.sh

Created Friday 25 September 2020

#!/bin/bash
iptables -F
ipset restore </root/scripts/ipset_cn.zone
ipset restore </root/scripts/ipset_ru.zone
ipset restore </root/scripts/ipset_ua.zone
ipset restore </root/scripts/ipset_hr.zone
ipset restore </root/scripts/ipset_tw.zone
iptables-restore < /root/scripts/iptables.saved



54root

Created Friday 25 September 2020

54restoreIPtables.sh

54check_mount59.sh

54check_mount.sh



54scanjob.sh

Created Friday 25 September 2020

#!/bin/bash
# 2018/11/27 Leo Vendler. Scanning af system med clamscan
#
UDSKRIV=0
DIR="/"
HOMEDIR="/home/fadl"
mkdir -p $HOMEDIR/scan_log
LOGFILE="$HOMEDIR/scan_log/clam.log"
UDSKRIV="0"
IPADR=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk -F'[/ ]+' '{print $3}')
MAILFROM="admin@fadl.dk"
MAILTO="tsh@fadl.dk"
MAILMSG="$HOMEDIR/scan_log/scanresultat.txt"
MAILSERVER="smtp-relay.gmail.com"
SUBJECT="Scanning af $MAILFROM ($IPADR) har fundet problemer"

#clamscan -i $DIR >$LOGFILE
nice -n 19 clamscan -r -i --exclude-dir="^/sys" $DIR>$LOGFILE

while read linie
do
FOUND=$(echo $linie|grep -v grep|grep FOUND)
if [ "$FOUND" <> " " ]
then
UDSKRIV=1
fi
done<$LOGFILE

if [ "$UDSKRIV" == "1" ]
then
echo "**** Virus/Worm fundet på $IPADR ****">$MAILMSG
cat $LOGFILE>>$MAILMSG
echo "*****************************************">>$MAILMSG
/usr/local/bin/sendemail -f $MAILFROM -t $MAILTO -u $SUBJECT -m $MAILMSG -s $MAILSERVER
fi



54SQL backup.sh

Created Friday 25 September 2020

#!/bin/bash
#2012/02/18 Leo Vendler
#20130902 Dette er kopieret fra 10.1.0.27

#NOW=`date +"%Y_%m_%d";
NOW=`date +"%Y_%m_%d_%H%M"`;
BACKUPDIR="/home/fadl/SQLbackups"
CURRENTBACKUP="$BACKUPDIR/$NOW";

### Server Setup ###
#* MySQL login user name *#
MUSER="root";

#* MySQL login PASSWORD name *#
#MPASS="pleaseb@home2me";
MPASS="1qaz@wsx";

#* MySQL login HOST name *#
MHOST="127.0.0.1";
MPORT="3306";

# DO NOT BACKUP these databases
IGNOREDB="
information_schema
performance_schema
mysql
test
"

#* MySQL binaries *#
MYSQL=`which mysql`;
MYSQLDUMP=`which mysqldump`;
GZIP=`which gzip`;

# create current backupdir
if [ ! -d $CURRENTBACKUP ]; then
mkdir -p $CURRENTBACKUP
else
:
fi

#remove oldest backup if >= 24 backups present
dirlist=$(find $BACKUPDIR/* -type d)
count=0
for i in $dirlist; do
let count++
done
if [ "$count" -ge "25" ]
then
echo "old folder found - deleting..."
find $BACKUPDIR/ -type d -printf "%TY%Tm%Td%TH%TM%TS %p\n" | sort -nr | tail -1 | cut -d" " -f2 | xargs -n1 rm -Rf
echo "...old folder deleted"
fi

# get all database listing
DBS="$($MYSQL -u $MUSER -p$MPASS -h $MHOST -P $MPORT -Bse 'show databases')"

# start to dump database one by one
for db in $DBS
do

DUMP="yes";
if [ "$IGNOREDB" != "" ]; then
for i in $IGNOREDB # Store all value of $IGNOREDB ON i
do
if [ "$db" == "$i" ]; then # If result of $DBS(db) is equal to $IGNOREDB(i) then
DUMP="NO"; # SET value of DUMP to "no"
#echo "$i database is being ignored!";
fi
done
fi

if [ "$DUMP" == "yes" ]; then # If value of DUMP is "yes" then backup database
# FILE="$CURRENTBACKUP/$db.gz";
FILE="$CURRENTBACKUP/$db.sql";
echo "BACKING UP $db";
# $MYSQLDUMP --add-drop-database --opt --lock-all-tables -u $MUSER -p$MPASS -h $MHOST -P $MPORT $db | gzip > $FILE
$MYSQLDUMP --add-drop-database --opt --lock-all-tables -u $MUSER -p$MPASS -h $MHOST -P $MPORT $db > $FILE
fi
done



54SQL restore.sh

Created Friday 25 September 2020

#!/bin/bash

#20130902 Leo Vendler

### Databases to restore REDIGER DETTE###
DATABASES="kkf
"

#* DIR where the backup is stored REDIGER DETTE *#
BACKUPDIR="/home/fadl/SQLbackups/2017_02_09_1230";

### MySQL Setup ###
#* MySQL login user name *#
MUSER="root";

#* MySQL login PASSWORD name *#
read -p "Indtast password: " pasord;
MPASS=$pasord

#* MySQL login HOST name *#
MHOST="127.0.0.1";
MPORT="3306";

#* MySQL binaries *#
MYSQL=`which mysql`;


#* Restore databases *#
for db in $DATABASES
do
echo "Restoring $db";
$MYSQL --user=$MUSER --password=$MPASS -h $MHOST -P $MPORT $db < $BACKUPDIR/$db.sql
done



54sqlsave.sh

Created Monday 28 September 2020

#!/bin/bash
#20200928 Leo Vendler
BACKUPDIR="/home/fadl/backup/SQLbackups_mit_fadl_dk"
FROMDIR="/home/fadl/SQLbackups"
#
/usr/bin/rsync -az $FROMDIR/* $BACKUPDIR/
#
#remove oldest backup if >= 340 backups present
dirlist=$(find $BACKUPDIR/* -type d)
count=0
for i in $dirlist;
do
let count++
done
if
[ "$count" -ge "340" ]
then
echo "old folder found - deleting..."
find $BACKUPDIR/ -type d -printf "%TY%Tm%Td%TH%TM%TS %p\n" | sort -nr | tail -1 | cut -d" " -f2 | xargs -n1 rm -Rf
echo "...old folder deleted"
fi



55crontab

Created Sunday 27 September 2020

17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
00 3 * * * root /root/scripts/scanjob.sh



55rc.local

Created Sunday 27 September 2020

sleep 5
/root/scripts/restoreIptables.sh
#



55restoreIptables.sh

Created Sunday 27 September 2020

#!/bin/bash
iptables -F
ipset restore </root/scripts/ipset_cn.zone
ipset restore </root/scripts/ipset_ru.zone
ipset restore </root/scripts/ipset_tw.zone
iptables-restore < /root/scripts/iptables.saved



55root

Created Sunday 27 September 2020

55restoreIptables.sh

55scanjob.sh



55scanjob.sh

Created Sunday 27 September 2020

#!/bin/bash
# 2018/11/27 Leo Vendler. Scanning af system med clamscan
#
UDSKRIV=0
DIR="/"
HOMEDIR="/home/fadl"
mkdir -p $HOMEDIR/scan_log
LOGFILE="$HOMEDIR/scan_log/clam.log"
UDSKRIV="0"
IPADR=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk -F'[/ ]+' '{print $3}')
MAILFROM="admin@fadl.dk"
MAILTO="tsh@fadl.dk"
MAILMSG="$HOMEDIR/scan_log/scanresultat.txt"
MAILSERVER="smtp-relay.gmail.com"
SUBJECT="Scanning af $MAILFROM ($IPADR) har fundet problemer"

#clamscan -i $DIR >$LOGFILE
nice -n 19 clamscan -r -i --exclude-dir="^/sys" $DIR>$LOGFILE

while read linie
do
FOUND=$(echo $linie|grep -v grep|grep FOUND)
if [ "$FOUND" <> " " ]
then
UDSKRIV=1
fi
done<$LOGFILE

if [ "$UDSKRIV" == "1" ]
then
echo "**** Virus/Worm fundet på $IPADR ****">$MAILMSG
cat $LOGFILE>>$MAILMSG
echo "*****************************************">>$MAILMSG
/usr/local/bin/sendemail -f $MAILFROM -t $MAILTO -u $SUBJECT -m $MAILMSG -s $MAILSERVER
fi



Apache

Created Saturday 28 November 2020

https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04

sudo apt install apache2

vedr. certifikater, enable ssl
https://www.maketecheasier.com/apache-server-ssl-support/
sudo a2enmod ssl

Beskyttelse mod DDoS
https://phoenixnap.com/kb/apache-mod-evasive

sudo apt install apache2-utils
sudo apt install libapache2-mod-evasive
sudo nano /etc/apache2/mods-enable

Postfix Configuration in ubuntu when installing Apache mod_evasive
When unsure, select No configuration or Local only.

Configure mod_evasive
Use a text editor of your choice with the following commands:

sudo nano /etc/apache2/mods-enabled/evasive.conf
sudo nano /etc/httpd/conf.d/mod_evasive.conf
Find the following entry:
#DOSEmailNotify you@yourdomain.com

Remove the # sign, then replace you@yourdomain.com with your actual email address. Use an email that you check regularly – this is where the tool will send alerts.

Remove the comment tag from the following entries, so the log file looks as follows:
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 10
DOSEmailNotify mail@yourdomain.com
DOSLogDir "/var/log/apache2/"
Save the file and exit. Reload the Apache service by entering the following:
sudo systemctl reload apache2

Whitelisting IP addresses: This option isn’t included in the evasive.conf file by default.
Open the file again for editing, then add the following line:
DOSWhitelist 192.168.0.13
DOSWhitelist 192.168.0.*
sudo systemctl reload apache2



awk

Created Wednesday 30 September 2020

awk '{ print $11 }' testfil.txt

awk '{ print $11, $3 }' testfil.txt

awk '{ printf("%-40s %s\n", $11, $3) }' testfil.txt

filter records that match 'firefox'
awk '/firefox/ { print $11, $3 }' testfil.txt

awk '/firefox/ && $3 > 5 { print $11, $3 }' testfil.txt

awk '/firefox/ { print $11, $6/1024 }' testfil.txt

filter records where field2 matches 6685
awk '$2==6685 { print $11, $3 }' testfil.txt

awk '$3 > 5 { print $11, $3 }' testfil.txt



bash

Created Tuesday 27 October 2020
ls
lshw
lsblk
lsscsi -g
lsblk -f
lsblk -m
lsb-release
lsb_release -a
lsusb
lscpu
lspci
lsof

substrings
#!/bin/bash
felt="12345678910"
echo ${felt:3:4}

replacement
felt1=${felt/3/X}
echo $felt1

filename
felt="Hansen.png"
echo ${felt#Hansen}
echo ${felt#Hansen.}
echo ${felt%.png}

variabler
echo ${kiks:?variablen kiks er unset}
$_ f.eks. mkdir folder cd $_

Slet filer ældre end x dage
find /home/pi/data/ftp/kam1/*.jpg -mtime +2 -exec rm {} \;
find /home/pi/data/ftp/kam2/20* -mtime +2 -exec rm -rf {} \;

Slet tomme dir
find /path/to/dir/ -empty -type d -delete

Find and delete all empty files:
find /path/to/dir/ -empty -type f -delete

Tips
!! To rerun previous cmd
"cd -" to change to the previous directory
"Ctrl + H" in the file manager to show hidden files.
sudo !! to run the previous cmd as root
Use nohup to let commands run and terminate after logging off
chroot. Læs howto.



dd

Created Thursday 07 January 2021

If one uses dd with a bigger block size (>= 4096), be sure to use either the oflag=direct or conv=fsync option to have proper error reporting while writing data to a device. I would prefer conv=fsync, dd will then fsync() the file handle once and report the error, without having the performance impact which oflag=direct has.

dd if=/dev/source of=/dev/mapper/target bs=4096 count=1500 conv=fsync
dd: fsync failed for '/dev/mapper/target': Input/output error



examples:
clone disk
dd if=/dev/da0 conv=sync,noerror bs=128K | gzip -c > centos-core-7.gz
Clone til anden disk
gunzip -c centos-core-7.gz | dd of=/dev/da0

Via ssh:dd if=/dev/da0 conv=sync,noerror bs=128K | gzip -c | ssh vivek@somewhere dd of=centos-core-7.g






Debian Reference

Created Tuesday 29 June 2021

https://www.debian.org/doc/manuals/debian-reference/index.en.html



errors

Created Monday 30 November 2020

stop job is running

nano /etc/systemd/system.conf file:

#DefaultTimeoutStartSec=90s
#DefaultTimeoutStopSec=90s ændre til 10s



f.eks. mkdir



fsck

Created Tuesday 03 November 2020

# touch /forcefsck

# shutdown -rF now (virker ikke på mange nyere linux)

sudo tune2fs -c 1 /dev/sdX

sudo tune2fs -i 1w /dev/sdX

If you're using systemd, you can force run fsck at your next boot by entering the following:
fsck.mode=force
fsck.repair=yes

generally you can use -p to allow fsck to automatically apply repairs.
sudo fsck -p /dev/sdX
Similarly, -y will apply corrections to any detected filesystem corruption.

Check the output for any errors. If none displayed, check the exit code with echo $?.




Home

Created Friday 25 September 2020

10.1.0.7 ukendt/udgaaet

10.1.0.15 ubuntudev udgaaet

10.1.0.16 asterisk

10.1.0.17 (2021/01/13)

10.1.0.21 ubuntu18a

10.1.0.22 testserver

10.1.0.24 ukendt

10.1.0.26 wordpress2

10.1.0.27 webbooking

10.1.0.28 testmaskine

10.1.0.32 webbooking ??

10.1.0.35 websme

10.1.0.44 webbooking (2021/01/13)

10.1.0.45 freja (2021/01/13)

10.1.0.52 2020fadldk

10.1.0.53 virtmedlemssystem

10.1.0.54 medlemssystem

10.1.0.55 fadldk udgår. erstattes af 52

tools

Debian Reference

workstation_security



ipset

Created Saturday 28 November 2020

apt install ipset
ipset -N cn.zone nethash
ipset -N ru.zone nethash
ipset -N tw.zone nethash
for IP in $(wget -O - http://www.ipdeny.com/ipblocks/data/countries/cn.zone); do ipset -A cn.zone $IP; echo $IP; done
for IP in $(wget -O - http://www.ipdeny.com/ipblocks/data/countries/ru.zone); do ipset -A ru.zone $IP; echo $IP; done
for IP in $(wget -O - http://www.ipdeny.com/ipblocks/data/countries/tw.zone); do ipset -A tw.zone $IP; echo $IP; done
ipset --save cn.zone >/root/scripts/ipset_cn.zone
ipset --save ru.zone >/root/scripts/ipset_ru.zone
ipset --save tw.zone >/root/scripts/ipset_tw.zone

iptables -A INPUT -m set --match-set cn.zone src -j DROP
iptables -A INPUT -m set --match-set ru.zone src -j DROP
iptables -A INPUT -m set --match-set tw.zone src -j DROP
iptables -A OUTPUT -m set --match-set cn.zone dst -j DROP
iptables -A OUTPUT -m set --match-set ru.zone dst -j DROP
iptables -A OUTPUT -m set --match-set tw.zone dst -j DROP
iptables -S
iptables-save >iptables.saved



kernel

Created Thursday 20 May 2021

slet gamle kernels m.m.:
uname -r
DO NOT REMOVE THIS KERNEL!

Next, type the command below to view/list all installed kernels on your system.

dpkg --list 'linux-image-*'
Find all the kernels that lower than your current kernel. When you know which kernel to remove, continue below to remove it. Run the commands below to remove the kernel you selected.

På nyere linux:
sudo apt autoremove

På gl. linux:
sudo apt-get purge linux-image-x.x.x-x-generic



kvm

Created Wednesday 13 January 2021

install -y qemu qemu-kvm libvirt-daemon libvirt-clients bridge-utils virt-manager

sudo systemctl status libvirtd
skal være active (running)

kan enables med:
sudo systemctl enable --now libvirtd

To check if the KVM modules are loaded, run the command:

$ lsmod | grep -i kvm
From the output, you can observe the presence of the kvm_intel module.
This is the case for Intel processors.
For AMD CPUs, you will get the kvm_intel module instead.



linux tips

Created Wednesday 28 October 2020

firejail (sandbox til kørsel af ukendt pgm)
vmstat 2 check si/so swapin/out
lsblk

show most memory intensive process
ps axch -o cmd:15,%mem --sort=-%mem

Show most CPU intensive process
ps axch -o cmd:15,%cpu --sort=-%cpu

Get the top 10 largest files ordered by size descending, starting from the current folder, recursively:
find . -printf '%s %p\n'| sort -nr | head -10

Find 10 largest folders:
du -hsx * | sort -rh | head -10

What's listening on ports
netstat -ltnp | grep -w ':80'

lsof -i :80
fuser 80/tcp

watch udp and tcp ports in real time
sudo watch netstat -tulpn
sudo watch ss -tulpn

-------------networking---------------
which interface
ip -o -4 route show to default | awk '{print $5}'

opsætning af netværk
nmtui nemt cli værktøj
nmcli
netplan (se 10.1.0.22)

skift mac midlertidigt
sudo ifconfig eth0 down
sudo ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
sudo ifconfig eth0 up

linux tricks
https://www.tecmint.com/

Hardening linux
https://madaidans-insecurities.github.io/guides/linux-hardening.html

efi EFI
boot into efi:
Just run this command as root and the system will reboot and get into the setup:
# systemctl reboot --firmware-setup
or
efibootmgr then reboot
or
have a grub entry that runs fwsetup






lvm

Created Saturday 05 December 2020

Tilsyneladende går der kuk i superblokke hvis det er et styresystem
som er installeret på lvm i modsætning til data.
Så vil resize2fs give op.
Find superblokke med:
# dumpe2fs /dev/vgx/<navn på lvm>|grep -i superblock

unmount det berørte lvm
lvextend -L +10G /dev/volgroup_1/home
resize2fs /dev/volgroup_1/home

20160601
Hvis det er en server , der er på det extendede lvm, dur resize2fs ikke,
men disken er forøget og på serveren som skal have mere disk,
skal du gå ind i gparted og der vil du se, en uallokeret partition,
som er den udviddelse, du foretog.
Denne skal nu formatteres og mountes (i hånden + fstab) efter at et mountpoint er oprettet.


Overfør en lvm fra en maskine til en anden

a) lvcreate nyt lvm, samme størrelse som source på target
b) ssh skal have rootadgang på target
c) husk (noter) hvilken target-vg ligger på
d) fra target do:
dd if=/dev/vg0/asterisk bs=4M | ssh -c arcfour root@target 'dd of=/dev/vg0/asterisk bs=4M'
e) på target eller fra anden med grafisk interface: virt-manager
f) o.s.v.

Shrink lv

Shrink the ext4 file system and the LVM LV ∞
The suggested way to shrink the ext4 file system and the LVM LV is to use the lvresize command:

# lvresize --resizefs --size SIZE /dev/vg/vg_data
Here, SIZE is your intended new size for the LV and file system, such as 200G. --resizefs lets lvresize also resize underlying filesystem together with the logical volume. It is better than resize2fs + lvresize since it is not unlikely for an admin to accidently use inconsistent parameter for resize2fs and lvresize.

It will prints information like (may be different according to the versions of the tools on you system):

fsck from util-linux 2.21.2
/dev/mapper/vg_linux-lv_home: 15741/54419456 files (0.1% non-contiguous), 4781794/217677824 blocks
resize2fs 1.42.3 (14-May-2012)
Resizing the filesystem on /dev/mapper/vg_linux-lv_home to 26214400 (4k) blocks.

Reducing logical volume lv_home to 100.00 GiB
Logical volume lv_home successfully resized
Please note that this command may take much time for moving data to spare disk space. Only do this when you have sufficient time allowing the file system being kept unmounted.

After this command executes successfully, you can remount the file system again and check the file system size by df -hT.

----------ext2 or ext3 filesystems only!-----------
EKS
/dev/mapper/volumegroup-share er 100 Gb
ønskes reduceret til 70 Gb

umount /xxx/share

df -h

tune2fs -l /dev/mapper/volumegroup/

e2fsck -f /dev/mapper/volumegroup-share

resize2fs /dev/mapper/volumegroup-share <blocks>
eller
resize2fs /dev/mapper/volumegroup-share 70G

DONT lvreduce more than you have rezised!!!
lvreduce -L30G /dev/mapper/volumegroup-share
ignore the warning that data might be destroyed because we have shrinked the filesystem before.

mount /dev/mapper/volumegroup-share /xxx/share

df -h

--------- fra Google----------------
Boot with Knoppix
Start a root shell
lvm vgscan --mknodes
if KNOPPIX reports some kernelerror, try sudo modprobe dm-mod
lvm vgchange -ay (activate all discovered VGs)
lvm lvscan (scan and return info about the LVs)
vgdisplay (display info about the VGs)
lvdisplay (display info about the LVs)
tune2fs -l /dev/volumegroup/rootvolume (return file system information for a specific LV) --or-- tune2fs -l /dev/mapper/volumegroup-rootvolume
e2fsck -f /dev/volumegroup/rootvolume (do a check of the current fs)
resize2fs /dev/mapper/volumegroup-rootvolume 70g (resize the file system, where nnn is the number of gigabytes you want, and g tells resize2fs that nnn is in gigs).

lvreduce -L -30G /dev/volumegroup/rootvolume (to reduce the size by xx Gigs).
e2fsck -f /dev/volumegroup/rootvolume (recheck the fs) Note: If the check fails, do an lvextend -L+xxG /dev/volumegroup/rootvolume to resize the LV back to where it was, and then re-run the e2fsck to confirm that it's ok. The most likely cause is using the wrong xx or nnn for the resizes.

When determining the amount to resize, you should use 1024 x Gigs to determine the amount with resize2fs... subtract the amount you want to resize from the current size of the "partition".



MySQL

Created Saturday 28 November 2020

https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04

ubuntu 18.04:
sudo apt install mysql-client-core-5.7
sudo apt install mysql-server
sudo mysql_secure_installation
mysql -v
mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;
Output
+------------------+-------------------------------------------+-----------------------+-----------+
| user | authentication_string | plugin | host |
+------------------+-------------------------------------------+-----------------------+-----------+
| root | | auth_socket | localhost |
| mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | mysql_native_password | localhost |
| debian-sys-maint | *CC744277A401A7D25BE1CA89AFF17BF607F876FF | mysql_native_password | localhost |
+------------------+-------------------------------------------+-----------------------+-----------+

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

********MARIADB***********
If you're running MariaDB < 10.2, the ALTER USER command will not work, as stated above.
To change the authentication method, use:
UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE user = 'root';

In the upper left corner is a "gear"-Icon for Setting up the Mysql Databes area.
There you can choose where the Config-File will be found.
I've switched it to the mariadb.conf.d/50-server.cnf and it works now.
**********************************
Then, run FLUSH PRIVILEGES which tells the server to reload the grant tables and put your new changes into effect:

FLUSH PRIVILEGES;



netdata

Created Thursday 10 December 2020

https://learn.netdata.cloud/docs/agent/getting-started

http://this.machine.ip:19999/

installer netdata:
bash <(curl -Ss https://my-netdata.io/kickstart.sh)

sudo ./edit-config health_alarm_notify.conf
set SEND_EMAIL til NO

To stop netdata run:
systemctl stop netdata

To start netdata run:
systemctl start netdata

Uninstall script generated: ./netdata-uninstaller.sh
Update script generated : ./netdata-updater.sh



netplan

Created Saturday 28 November 2020

/etc/netplan
root@fadldk2020:/etc/netplan# cat 01-netcfg.yaml
# This is the network config written by 'subiquity'
network:
ethernets:

ens6:
dhcp4: no
dhcp6: no
bridges:
br0:
interfaces: [ens6]
dhcp4: no
addresses:
- 10.1.0.52/24
gateway4: 10.1.0.1
nameservers:
addresses:
- 8.8.8.8
- 208.67.220.220
- 208.67.222.222

search:
- fadl.dk
version: 2

virsh net-list --all

opret bridge.xml indeholdende:
<network>
<name>br0</name>
<forward mode="bridge"/>
<bridge name="br0" />
</network>

virsh net-define ./bridge.xml
virsh net-start br0
virsh net-autostart br0
virsh net-list --all



nmap

Created Wednesday 02 December 2020

https://www.redhat.com/sysadmin/finding-rogue-devices

Generel info
$ nmap -sV --allports -T4 10.1.0.0/24

Rogue DHCP servers
sudo nmap --script broadcast-dhcp-discover -e [interface]

Scan alle porte
sudo nmap -sS -sU -PN -p 1-65535 <Your-IP>



PHP

Created Saturday 28 November 2020

https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04

ubuntu 18.04:
sudo apt install php libapache2-mod-php php-mysql



raid1

Created Tuesday 12 January 2021

cat /proc/mdstat
parted -a optimal /dev/sdb1
mklabel gpt
mkpart primary 1MiB 512GiB
set 1 raid on

samme for /dev/sdc1

mdadm –examine /dev/sd[b-c]1
mdadm –create /dev/md0 –level=mirror –raid-devices=2 /dev/sdb1 /dev/sdc1



sed

Created Wednesday 30 September 2020

The sed command is case-sensitive, but /I will ignore case.

see what would be modified = no -i
sed 's/foo/bar/' inputfile
sed 's/foo/bar/I' inputfile (ignore case)

do the modification = with -i
sed -i '/foo/bar/g' inputfile1

only substitute certain lines (-i)
sed '/second/s/should/will/' inputfile2

| | | |
| | | with this pattern
| | this pattern
| substitute
Search for the pattern "second"



tarpit

Created Friday 18 December 2020

sudo apt install xtables-addons-dkms

f.eks telnet
sudo iptables -A INPUT -p tcp --dport telnet -j TARPIT



tools

tools_ssh
tools_autossh
tools_scp
tools_sftp
tools_sshpass
tools_sshfs
tools_rsync
tools_lsyncd
tools_flashdrive
tools_network
bash
awk
dd
kvm
raid1
sed
windows_map
webmin
virt-manager
fsck
netplan
netdata
nmap
ipset
Apache
MySQL
PHP
lvm
usbguard
tarpit
linux tips
stop_job_errors
remove_old_kernels



tools autossh

Created Monday 08 February 2021

remote port 80 til her port 8008
autossh -p2233 -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -o "ExitOnForwardFailure=yes" -L 8008:localhost:80 leo@server.dk



tools flashdrive

Created Saturday 16 April 2022

Unreadable flashdrive:
ddrescue with sparse option (-S) first to make an image to get as much data as possible.
Then target the image with photorec

alternativt safecopy.



tools lsyncd

Created Tuesday 29 September 2020

lsyncd, a daemon that enables you to mirror your directories


to any other directory on your network, or even locally.


# apt install lsyncd
If you’re a RHEL/CentOS/Fedora user, then you have to enable EPEL first. Then:

# yum install lsyncd
After installation, you’ll find sample configurations in /usr/share/doc/lsyncd/examples/ or in /usr/share/doc/lsyncd-VERSION/examples/

# mkdir /etc/lsyncd
In there, we’ll create a new config file:

# nano /etc/lsyncd/lsyncd.conf.lua
Where we’ll put the following code:

settings = {
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd.status"
}

sync {
default.rsync,
source = "$HOME/unixmen/sync_source/",
target = "$HOME/sync_backup",
}
Right now, if you look in the backup directory, you’ll find it empty, because the service is not running.
But, to solve this, simply restart lsyncd with the following:

# systemctl restart lsyncd



via ssh


Once you have properly set up your SSH keys you can begin configuring your environment.
To do this you must create lsyncd.log and lsyncd-status.log files in these respective directories

/var/log/lsyncd/lsyncd.log
and
/var/log/lsyncd/lsyncd-status.log
Once this is complete, you can then begin to set up your configuration file.
There is no default configuration file, however you can create one in your /etc/lsyncd/lsyncd.conf.lua directory on your local machine and add the following information.

settings {

logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd-status.log",
statusInterval = 20
}

sync {

default.rsync,
source="full path to your directory",
target="{username}@rsync.keycdn.com:{zone_name}/",
rsync = {
archive = false,
acls = false,
chmod = "D2755,F644",
compress = true,
links = false,
owner = false,
perms = false,
verbose = true,
rsh = "/usr/bin/ssh -p 22 -o StrictHostKeyChecking=no"
}
}
Change the source to the path to the directory that contains the files you want to synchronize and the target to match your KeyCDN username and Zone name.



tools network

Created Wednesday 25 May 2022

→ arp - see your arp table.
→ aria2 – downloading just about everything. Torrents included.
→ arpwatch – Ethernet Activity Monitor.
→ bmon – bandwidth monitor and rate estimator.
→ bwm-ng – live network bandwidth monitor.
→ curl – transferring data with URLs.(or try httpie)
→ darkstat – captures network traffic, usage statistics.
→ dhclient – Dynamic Host Configuration Protocol Client
→ dig – query DNS servers for information.
→ dstat – replacement for vmstat, iostat, mpstat, netstat and ifstat.
→ ethtool – utility for controlling network drivers and hardware.
→ gated – gateway routing daemon.
→ host – DNS lookup utility.
→ hping – TCP/IP packet assembler/analyzer.
→ ibmonitor – shows bandwidth and total data transferred.
→ ifstat – report network interfaces bandwidth.
→ iftop – display bandwidth usage.
→ ip – a command with more features than ifconfig.
→ iperf3 – network bandwidth measurement tool.
→ iproute2 – collection of utilities for controlling TCP/IP.
→ iptables – take control of network traffic.
→ IPTraf – An IP Network Monitor.
→ iputils – set of small useful utilities for Linux networking.
→ iw – a new nl80211 based CLI configuration utility → for wireless devices.
→ jwhois (whois) – client for the whois service.
→ lsof -i – reveal information about your network sockets.
→ mtr – network diagnostic tool.
→ net-tools – utilities include: arp, hostname, ifconfig, netstat, rarp, route, plipconfig, slattach, mii-tool, iptunnel and ipmaddr.
→ ncat – improved re-implementation of the venerable netcat.
→ netcat – networking utility for reading/writing network connections.
→ nethogs – a small ‘net top’ tool.
→ Netperf – Network bandwidth Testing.
→ netplan – Netplan is a utility for easily configuring
→ netsniff-ng – Swiss army knife for daily Linux network plumbing.
→ netwatch – monitoring Network Connections.
→ ngrep – grep applied to the network layer.
→ nload – display network usage.
→ nmap – network discovery and security auditing.
→ nmcli – a command-line tool for controlling NetworkManager and reporting network status.
→ nmtui – provides a text interface to configure networking by controlling NetworkManager.
→ nslookup – query Internet name servers interactively.
→ route – show / manipulate the IP routing table.
→ slurm – network load monitor.
→ snort – Network Intrusion Detection and Prevention System.
→ smokeping – keeps track of your network latency.
→ socat – establishes two bidirectional byte streams and transfers data between them.
→ speedometer – Measure and display the rate of data across a network.
→ speedtest-cli – test internet bandwidth using speedtest.net
→ ss – utility to investigate sockets. .
→ tcpdump – command-line packet analyzer.
→ tcptrack – Displays information about tcp connections on a network interface.
→ tracepath – very similar function to traceroute.
→ traceroute – print the route packets trace to network host.
→ vnStat – network traffic monitor.
→ websocat – Connection forwarder from/to web sockets to/from usual sockets, in style of socat.
→ Wireless Tools for Linux – includes iwconfig, iwlist, iwspy, iwpriv and ifrename.
→ Wireshark – network protocol analyzer.



tools rsync

Created Tuesday 29 September 2020

kopier & opdater testdir. Bevarer rettigheder, ejer, links m.m.

OBSERVER slash !

rsync -avu --delete /home/leo/dhcp_filer /home/leo/testdir/
herefter vil testdir indeholde testdir/dhcp_filer

synkroniser testdir med dhcp_filer med backup (~filer)

rsync -avub --delete /home/leo/dhcp_filer /home/leo/testdir/

synkroniser testdir med dhcp_filer med backup (~filer) og medtag ikke ~ - filer

rsync -avub --delete --exclude '*~' /home/leo/dhcp_filer /home/leo/testdir/

synkroniser testdir med dhcp_filer med backup (~filer) og medtag ikke ~ - filer eller biblioteket tmp

rsync -avub --delete --exclude '*~' --exclude tmp/ /home/leo/dhcp_filer /home/leo/testdir/

kopier fil via net til anden computer

rsync rsync_howto.txt edbafd@leoarb:/home/edbafd/

rsync via ssh

rsync -auv --rsh=/usr/bin/ssh /data2/lokehomes/Tina edbafd@terminalserver1:/data/lokehomes/



tools scp

Created Thursday 01 October 2020

med sshpass

sshpass -f "/root/scripts/sfpas" scp /home/leo/data/ftp/kam2/uudbakke/*.jpg vendler.dk@ssh.vendler.dk:k2/



tools sftp

Created Tuesday 29 September 2020

med HERE-dokument

sftp vendler.dk@ssh.vendler.dk <<'HERE'
cd k1
rm *.jpg
cd ..
cd k2
rm *.jpg
cd video
rm *.mp4
cd ..
cd ..
cd k3
rm *.jpg
HERE

med HERE og password

sshpass -f "/root/scripts/sfpas" sftp vendler.dk@ssh.vendler.dk <<'HERE'
pwd
cd k2
pwd
mput /home/leo/data/ftp/kam2/uudbakke/*.jpg
ls
HERE



tools ssh

Created Tuesday 29 September 2020

If your SSH connection is dead and is not responding, you can disconnect by:

  1. Pressing enter
  2. Typing ~.
This will immediately disconnect you.

2021/05/05 nødvendig
ssh -o KexAlgorithms=ecdh-sha2-nistp521 username@systemname

ssh-keygen -t rsa

scp ~/.ssh/id_rsa.pub den_anden_maskine:.ssh/authorized_keys2
eller
ssh-copy-id -i ~/.ssh/id_rsa.pub user@den_anden_maskine


eller ny og bedre: ssh-keygen -t ecdsa -b 521

eller med egenvalgt navn: ssh-keygen -f ~/navn-key-ecdsa -t ecdsa -b 521

ssh-copy-id -i ~/.ssh/navn-key-ecdsa user@den_anden_maskine

redirect extern port with ssh
$ ssh -L 9000:imgur.com:80 user@example.com
The key here is -L which says we’re doing local port forwarding. Then it says we’re forwarding our local port 9000 to imgur.com:80, which is the default port for HTTP.
Now open your browser and go to http://localhost:9000.

ssh -p2223 -L 8182:192.168.11.10:8181 username@[domæne || IP]
browser http://localhost:8182[/sti]

connecting to a remote database
$ ssh -L 9000:localhost:5432 user@example.com

The part that changed here is the localhost:5432, which says to forward connections from your local port 9000 to localhost:5432 on your server. Now we can simply connect to our database.

$ psql -h localhost -p 9000

reverse ssh with X
remote:
ssh -Y -N -R 6666:127.0.0.1:22 brugernavn@local
(ssh -Y -N -R some_port:127.0.0.1:local_port_ssh username@local)

local:
ssh -p6666 bruger@remote
(ssh -psome_port username@remote)

ssh tunnels
SSH configurations
Make sure that TCP forwarding is enabled on the SSH server. By default it should be.
/etc/ssh/sshd_config
AllowTcpForwarding yes

If you're forwarding ports on interfaces other than 127.0.0.1 then you'll need to enable GatewayPorts on your local system, either within ssh_config or as a command-line option
/etc/ssh/ssh_config
GatewayPorts yes
Use cases

If you want to use a secure connection to access a remote service that communicates over plaintext. For example, redis and memcached all use plaintext protocols. If you securely access one of these services on a remote server over public networks, you can tunnel a connection from your local system to the remote server instead of having it listen over the public internet.

Remote port forwarding
Forwards a port on a remote system to another system
ssh -R 8080:localhost:80 ssh-server
ssh-server:8080
localhost:80

Fowards traffic to all interfaces on port 8080 on ssh-server to localhost port 80 on your local computer. If one of these interfaces is available to the public internet, traffic connecting to port 8080 will be forwarded to your local system.
ssh -R 1.2.3.4:8080:localhost:80 ssh-server
1.2.3.4
ssh-server:8080
localhost:80

Fowards traffic to ssh-server:8080 to localhost:80 on your local system while only allowing access to the SSH tunnel entrance on ssh-server from IP address 1.2.3.4. Use The GatewayPorts clientspecified directive with this.
ssh -R 8080:example.org:80 ssh-server
ssh-server:8080
example.org:80

Fowards traffic to all interfaces on ssh-server:8080 to localhost:80 on your local system. From your local system, traffic is then forwarded to example.org:80. From the perspective of example.org the traffic is originating from your local system.
SSH server configuration
/etc/ssh/sshd_config
By default, forwarded ports are not accessible to the public internet. You'll need to add this to your sshd_config on your remote server to forward public internet traffic to your local computer.

GatewayPorts yes
Or if you'd like to specify which clients are allowed access, you can use the following in your sshd_config instead

GatewayPorts clientspecified
Dynamic port forwarding
Forward traffic from a range of ports to a remote server
ssh -D 3000 ssh-server
*:3000
ssh-server
*:*

Opens a SOCKS proxy on port 3000 of all interfaces on your local system. This allows you to forward traffic sent through the proxy to the ssh-server on any port or destination host. By default, SSH will use the SOCKS5 protocol, which forwards TCP and UDP traffic.
ssh -D 127.0.0.1:3000 ssh-server
127.0.0.1:3000
ssh-server
*:*

Opens a SOCKS proxy on 127.0.0.1:3000 on your local system.

When you have a SOCKS proxy running, you can configure your web browser to use the proxy to access resources as if connections were originating from ssh-server. For example, if ssh-server had access to other servers within a private network, by using using a SOCKS proxy you could access those other servers locally as if you were on the network, without needing to set up a VPN.

When you have a SOCKS proxy running, you can test it like so
curl -x socks5://127.0.0.1:12345 https://example.org
SSH client configuration
/etc/ssh/ssh_config
If you want the SOCKS proxy to be available to more interfaces than just localhost, make sure to enable GatewayPorts on your local system.
GatewayPorts yes
Since GatewayPorts is being configured on the SSH client here, you can also configure it with a command-line option instead of ssh_config.

ssh -o GatewayPorts=yes -D 3000 ssh-server
Jump hosts and proxy commands
Transparently connecting to a remote host through intermediate hosts
ssh -J user1@jump-host user2@remote-host
ssh -o "ProxyJump user1@jump-host" user2@remote-host
user1@jump-host
user2@remote-host

Establishes an SSH connection with jump-host and forwards TCP traffic to remote-host. Connecting to remote-host through an intermediate jump-host. The above command should work out of the box if jump-host already has SSH access to remote-host. If it does not, you can use agent forwarding to forward the SSH identity of your local computer to remote-host.
ssh -J jump-host1,jump-host2 ssh-server
jump-host1
jump-host2
ssh-server
You can specify multiple comma-separated jump hosts.

ssh -o ProxyCommand="nc -X 5 -x localhost:3000 %h %p" user@remote-host
proxy-host:3128
user2@remote-host
Connecting to a remote server through a SOCKS5 proxy using netcat. From the perspective of the server, the originating IP is from proxy-host. However, the SSH connection itself is end-to-end encrypted so proxy-host only sees an encrypted stream of traffic between the local system and remote-host.

SSH client configuration
/etc/ssh/ssh_config
To enable agent forwarding, you can use ssh-add to add your local SSH identity to your local ssh agent.

ssh-add
Reliable SSH Tunnels
How to keep SSH tunnels open through network failures
The commands listed above work on an ad-hoc basis, but if you want to maintain SSH tunnels through network outages or unreliable connections, you'll have to do some additional setup.

By default, the TCP connection used to establish an SSH tunnel may time out after a period of inactivity. To prevent timeouts, you can configure the server to send heartbeat messages.
/etc/ssh/sshd_config
ServerAliveInterval 15
ServerAliveCountMax 4

You can also configure the client to send heartbeat messages.
/etc/ssh/ssh_config
ClientAliveInterval 15
ClientAliveCountMax 4
Using AutoSSH
While the above options may prevent a connection from dropping due to inactivity, they will not re-establish dropped connections. To ensure that an SSH tunnel will be re-established, you can use autossh, which builds an SSH tunnel and monitors its health.

AutoSSH accepts the same arguments for port forwarding as SSH.
autossh -R 2222:localhost:22 ssh-server
ssh-server:2222
localhost:22

This establishes a reverse tunnel that comes back after network failures. By default, AutoSSH will open extra ports on the SSH client and server for health checks. If traffic appears to no longer pass between the health check ports, AutoSSH will restart the SSH tunnel.
autossh -R 2222:localhost:22 \
-M 0 \
-o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" \
remote-host
Using the -M 0 flag disables the health check ports and allows the SSH client to handle the health checks. In this example, the SSH client expects the server to send a heartbeat every 10 seconds. If 3 heartbeats fail in a row, the SSH client exits, and AutoSSH will re-establish a new connection.

More examples and use cases
Transparent access to remote resource on a private network
Let's say there's a git repository on a private network that's only accessible through a private server on the network. This server is not accessible to the public internet. You have direct access to the server, but don't have VPN access to the private network.

private-server
git@private-network
For convenience, you'd like to access this private git repository as if you were connecting to it directly from your local system. If you have SSH access to another server that's accessible from both your local system and the private server, you can accomplish this by establishing an SSH tunnel and using a couple of ProxyCommand directives.

ssh -L 127.0.0.1:22:127.0.0.1:2222 intermediate-host
127.0.0.1:2222
127.0.0.1:22
This forwards port 2222 on intermediate-host to port 22 on the private server. Now, if you SSH to port 2222 from intermediate-host, you're connecting to the SSH server on the private server despite the private server not being accessible by the public internet.

ssh -p 2222 user@localhost
If you'd like to make the backdoor even more convenient, you can add some directives to your local ~/.ssh/config

Host git.private.network
HostName git.private.network
ForwardAgent yes
ProxyCommand ssh private nc %h %p

Host private
HostName localhost
Port 2222
User private-user
ForwardAgent yes
ProxyCommand ssh tunnel@intermediate-host nc %h %p
127.0.0.1:2222
127.0.0.1:22
Now you have access to the private git repository as if you were on the private network.




tools sshfs

Created Tuesday 29 September 2020

Tilføj (ikke root) brugeren til gruppen fuse
usermod -a -G fuse brugernavnet

sshfs -p 2222 edbafd@80.62.175.198: /home/leo/mounts/loke -o follow_symlinks

fusermount -u /home/leo/mounts/loke


eks.med root

sudo sshfs -o allow_other,default_permissions root@xxx.xxx.xxx.xxx:/ /mnt/droplet

via key:

sudo sshfs -o allow_other,default_permissions,IdentityFile=~/.ssh/id_rsa root@xxx.xxx.xxx.xxx:/ /mnt/droplet

sudo umount /mnt/droplet



tools sshpass

Created Friday 13 August 2021

sshpass -f "/root/scripts/sfpas" sftp vendler.dk@ssh.vendler.dk <<'HERE'
pwd
cd k2
pwd
mput /home/leo/data/ftp/kam2/udbakke/*.jpg
ls
HERE



usbguard

Created Thursday 10 December 2020

https://usbguard.github.io/

https://www.zdnet.com/article/how-to-use-linuxs-built-in-usb-attack-protection/



virt-manager

Created Wednesday 02 December 2020

suao apt-install virt-manager
sudo usermod --append --groups libvirt-qemu $(whoami)
sudo apt install ssh-askpass



vivek@somewhere



webmin

Created Sunday 17 January 2021

sudo apt update
sudo nano /etc/apt/sources.list
add
deb http://download.webmin.com/download/repository sarge contrib
wget -q -O- http://www.webmin.com/jcameron-key.asc | sudo apt-key add
sudo apt update
sudo apt install webmin



windows map

Created Thursday 01 October 2020

SET SME=192.168.122.101
net use H: \\%SME%\homes
net use I: \\%SME%\itafd
net use J: \\%SME%\dokumenter



workstation security

Created Tuesday 13 July 2021

Linux workstation security checklist
https://github.com/lfit/itpol/blob/master/linux-workstation-security.md