linux

Send repeat (fail2ban) offenders to hosts.deny

I'm using fail2ban to keep the bandits off my server. It's great!
But there are so many bots that just keep poking at the server that I want to permanently ban them after a few repeated attempts.

Other solutions on the web involve added fail2ban jail scripts that add the offending IP's to the existing list of iptables rules. I am trying a simpler solution:

Tags: 

Using the Linux alternatives command to manage multiple Arduino IDE versions

The Arduino package contains an IDE that can be used to develop and upload code to the micro-controller. A current arduino package is available in the repositories of most Linux distributions (Ubuntu and Fedora, anyway). But sometimes, you need to use a different version of Arduino for a certain use case. For example, the distro doesn't have the most current version that you need to drive your new-fangled dev board from Adafruit or PJRC. Or, the new Arduino package breaks your existing code or compatibility with a different device.

GNOME 3 Nautilus sorting order

I couldn't find the preferences menu for Nautilus file manager in Gnome 3. But the gsettings command works :-)

To set the default sort order to the file name:

gsettings set org.gnome.nautilus.preferences default-sort-order name

To show directories first:

gsettings set org.gnome.nautilus.preferences sort-directories-first true

Hint: In Gnome Shell, application menus are in the system menu, at the upper left of the main display.

Tags: 

grep with color and context

GNU grep on Linux provides some interesting options. When you search for text in a log file, you can also highlight the text in color, and display two lines of context (the two lines preceding and succeeding the line containing the search expression). For example:

# grep --color -C 2 -E "res=failure" /var/log/audit/audit.log
Tags: 

Workload Scheduler power users: You need rlwrap

If you use the Linux shell very much, you find its history functions very useful. You can recall previous commands very easily, just using the arrow keys.
If you use the Workload Scheduler command-line interfaces, conman and composer, you really miss the history. Sure there's the redo command, but its editing capability is limited to the last command you typed.

Tags: 

Backup and restore mySQL (MariaDB) database

Backup

/usr/bin/mysqldump --user=dbuser --password=dbpass --host=localhost --add-drop-table dbname > backups/mydbdump.sql

Restore: (if the db exist)

mysql -u root -p[root_password] [database_name] < dumpfilename.sql

mysql -u root -ps3cre3t

mysql> create database dbname;
Query OK, 1 row affected (0.02 sec)

# mysql -u root -ps3cre3t db < /tmp/mydbdump.sql

 

Tags: 

Firewall rules for HDHomeRun on Fedora 20+

$ sudo firewall-cmd --direct --add-rule ipv4 filter INPUT 0 -m state --state NEW -m udp -p udp --sport 5002 -j ACCEPT
success
$ sudo firewall-cmd --direct --add-rule ipv4 filter INPUT 0 -m state --state NEW -m udp -p udp --sport 5004 -j ACCEPT
success
$ sudo firewall-cmd --direct --add-rule ipv4 filter INPUT 0 -m state --state NEW -m udp -p udp --sport 65001 -j ACCEPT
success
$ sudo firewall-cmd --reload
Tags: