Scripting

Rename files from upper- to lowercase or vice versa

#!/bin/bash # # Shell script to rename given file names to from uppercase to # lowercase OR lowercase to uppercase FILES=”$1″ ME=”$(basename $0)” # function to display message and exit with given exit code function die(){ echo -e “$1” exit $2 } # exit if no command line argument given [ “$FILES” == “” ] […]

Read More
Linux

RESET MASTER

/var/lib/mysql har blitt over 1,5GB stor så jeg Googlet litt for å finne ut hva som kunne gjøre dette og det viser seg at mysql logger all aktivitet. RESET MASTER sletter logger osv og etter å ha kjørt kommandoen så var /var/lib/mysql bare 222MB. You can delete all binary log files with the RESET MASTER […]

Read More
Scripting

macfind

I’ve made a simple bash script to find MAC adresses in DHCP config files. #!/bin/bash if [[ -z $1 || $1 == “–help” ]] then echo “usage: $0 xx:xx:xx:xx:xx:xx ” fi grep -i $1 /etc/dhcpdb/* -R Usage example macfind 00:18:8B:2C:DC:AA Result /etc/dhcpdb/53-nettet/subnet.conf:hardware ethernet 00:18:8b:2c:dc:aa; /etc/dhcpdb/macadresser/it-avd.conf: subclass “it-avd” 1:00:18:8b:2c:dc:aa; # Hans-Henry

Read More
Linux

Samba share permissions simplified

Permission precedence Samba comes with different types of permissions for share. Try to remember few things about UNIX and Samba permissions. (a) Linux system permissions take precedence over Samba permissions. For example if a directory does not have Linux write permission, setting samba writeable = Yes (see below) will not allow to write to shared […]

Read More
Linux

chkrootkit

chkrootkit -x lkm gives more info about the rootkit lmk chkrootkit creates a separate binary called chkproc that allows you to search for hidden processes.

Read More