====== Shell commands ====== ssh, awk, setxkbdmap ====== SSH "Problem" ====== Sollte beim Versuch sich mit einem Rechner per ssh zu verbinden folgende Fehlermeldung erscheinen, dann hat sich der SSH-Schlüssel geändert. Wurde auf dem Rechner das Betriebssystem neu installiert, ist dies normal und die jeweilige Zeile (s. )muss aus /home//.ssh/known_hosts gelöscht werden. Wurde an dem System nichts geändert, KANN dies der Hinweis auf einen --geglückten-- Hackversuch sein. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: POSSIBLE DNS SPOOFING DETECTED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ The RSA host key for has changed, and the key for the according IP address 134.96.x.x is unknown. This could either mean that DNS SPOOFING is happening or the IP address for the host and its host key have changed at the same time. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that the RSA host key has just been changed. The fingerprint for the RSA key sent by the remote host is xx:xx:xx:ef:79:e8:32:c5:46:dd:17:3f:b3:xx:xx:xx. Please contact your system administrator. Add correct host key in /home//.ssh/known_hosts to get rid of this message . Offending key in /home//.ssh/known_hosts: RSA host key for www has changed and you have requested strict checking. Host key verification failed. ===== awk ===== How To Use awk In Bash Scripting //by nixCraft on August 15, 2009 · 29 comments· LAST UPDATED August 14, 2009// see: http://www.cyberciti.biz/faq/bash-scripting-using-awk/ How do I use awk pattern scanning and processing language under bash scripts? Can you provide a few examples? Awk is an excellent tool for building UNIX/Linux shell scripts. AWK is a programming language that is designed for processing text-based data, either in files or data streams, or using shell pipes. In other words you can combine awk with shell scripts or directly use at a shell prompt. ==== Print a Text File ==== awk '{ print }' /etc/passwd OR awk '{ print $0 }' /etc/passwd ==== Print Specific Field ==== //Use:// as the input field separator and print first field only i.e. usernames (will print the the first field. all other fields are ignored): awk -F':' '{ print $1 }' /etc/passwd Send output to sort command using a shell pipe: awk -F':' '{ print $1 }' /etc/passwd | sort ==== Pattern Matching ==== You can only print line of the file if pattern matched. For e.g. display all lines from Apache log file if HTTP error code is 500 (9th field logs status error code for each http request): awk '$9 == 500 { print $0}' /var/log/httpd/access.log The part outside the curly braces is called the "pattern", and the part inside is the "action". The comparison operators include the ones from C: == != < > <= >= ?: If no pattern is given, then the action applies to all lines. If no action is given, then the entire line is printed. If "print" is used all by itself, the entire line is printed. Thus, the following are equivalent: awk '$9 == 500 ' /var/log/httpd/access.log awk '$9 == 500 {print} ' /var/log/httpd/access.log awk '$9 == 500 {print $0} ' /var/log/httpd/access.log ==== setxkbdmap ==== user@host:~$ setxkbmap -print xkb_keymap { xkb_keycodes { include "evdev+aliases(qwertz)" }; xkb_types { include "complete" }; xkb_compat { include "complete" }; xkb_symbols { include "pc+de+inet(evdev)+terminate(ctrl_alt_bksp)" }; xkb_geometry { include "pc(pc105)" }; }; user@host:~$ setxkbmap -query rules: evdev model: pc105 layout: de options: terminate:ctrl_alt_bksp ===== On Apple MACs ===== Kleine Skripte und Abläufe unter Mac OSX ==== dd unter OS X ==== aus: [[https://degrimmi.musca.uberspace.de/wordpress/?p=302| DeGrimmis Blog - Link]] "Eine Blog über meine Hobbies, Dinge die mich interessieren und ein paar Bilder" Mit dem Befehl dd werden Daten aus einer Imagedatei auf einen Datenträger (SD-Karte, USB-Stick) kopiert. Der normale Befehl sudo dd if=/path/to/source.img of=/dev/diskX bs=1m führt meist zur Fehlermeldung „Device Busy“. Auf dem Mac reicht es nicht, den Zieldatenträger im Finder auszuwerfen. Es funktioniert nur, wenn im Terminal vorher der Befehl sudo diskutil umountDisk /dev/diskX ausgeführt wurde. Nach dem Start von dd beginnt dann das große Warten. Leider gibt es standardmäßig keine Fortschrittsanzeige. Bei sehr großen Image-Dateien nervt das [...] Eine einfache Lösung ist, ein zweites Terminal zu öffnen oder mit CMD-T einen zusätzlichen Tab im Terminalfenster aufzumachen. Mit ps a sucht man such dann die PID von dd heraus und lässt sich mit sudo kill -SIGINFO [PID] den aktuellen Status anzeigen. Wem das zuviel Arbeit ist, der kann diese „Komplettlösung“ verwenden: $ sudo -s # diskutil umountDisk /dev/diskX # dd if=Quellimage.img of=/dev/diskX bs=1m & pid=$! # while true; do clear; kill -SIGINFO $pid; sleep 10; done