Download Any Flash Video in Linux

Reason #65,535 that I love Linux: the flash plugin makes it relatively easy to download any embedded flash video from any site (ex. YouTube and all sites like it).
The old (but still the current) version of the Adobe Flash plugin (10.2) would simply save all Flash videos (.flv files) in /tmp with names like «/tmp/Flash########» where the #’s are random numbers and letters. You could simply buffer a video on YouTube or any other video hosting site, then go to /tmp in your file browser and copy these files somewhere else. They typically get deleted when Flash exits.
Read more

Nginx rewrite parameters

Regular expressions to match, of which:
~ For the case-insensitive match
~ * For the case-insensitive match
!~ And !~* Are case-sensitive does not match and are not case-sensitive documents and directories do not match to match, of which:
-F and !-F used to determine the existence of a document
-D and !-D used to determine the existence of directory
-E and !-E used to determine the existence of files or directories
-X and !-X used to determine whether the executable fileflag markers are:
* Last equivalent to Apache’s [L] tag that complete rewrite, no longer match the back of the rules
* Break with the last similar
* Redirect the return of 302 temporary redirect
* Permanent return of 301 permanent redirect some of the available global variables can be used to determine the conditions (to be completed)
Read more

Linux: Rename Expression To Remove First Character From a File Name

I’ve over 1000′s of files starting with _ character as follows:

_file1.txt
_foo1.txt
_2424.txt
_bar10000.txt

How do I remove the first character from a file name:
Read more

UNIX / Linux: Increment The Date

I want to increment the date under UNIX or Linux operating system while writing shell scripts. For example Apr/27/2011 should be incremented as Apr/28/2011 and so on. How do I increment a date in UNIX or Linux shell?

You can display time and date described by format (also known as relative date format) under GNU/date utility which is part of Linux and UNIX like operating systems. The default format is to display current date and time. To display tomorrows date, enter: Read more

TMOUT To Automatically Log Users Out

How do I auto Logout my shell user in Linux after certain minutes of inactivity?

Linux bash shell allows you to define the TMOUT environment variable. Set TMOUT to automatically log users out after a period of inactivity. The value is defined in seconds. For example,

export TMOUT=120

The above command will implement a 2 minute idle time-out for the default /bin/bash shell. You can edit your ~/.bash_profile or /etc/profile file as follows to define a 5 minute idle time out:

# set a 5 min timeout policy for bash shell
TMOUT=300
readonly TMOUT
export TMOUT

Read more

Как ограничить ssh пользователя, входящего в систему по сертификатам лишь заданным диапазоном IP?

Итак, у нас есть Linux пользователь, который входит в систему по ssh с использованием ключей — парольная аутентификация запрещена. Задача — как ограничить пользователю возможный диапазон IP, с которых он входит в систему.

Вариант 1.

Задать диапазон хостов, с которых может входить юзер можно посредством директивы AlloUsers в /etc/ssh/sshd_config.
Read more

PyGrub «grub-probe can’t find drive for /dev/xvda1″ error — Debian Squeeze

If you are getting following while doing «apt-get upgrade»…

Setting up linux-image-2.6.32-5-686-bigmem (2.6.32-31) ...
Running depmod.
Running update-initramfs.
update-initramfs: Generating /boot/initrd.img-2.6.32-5-686-bigmem
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 2.6.32-5-686-bigmem /boot/vmlinuz-2.6.32-5-686-bigmem
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 2.6.32-5-686-bigmem /boot/vmlinuz-2.6.32-5-686-bigmem
Searching for GRUB installation directory ... found: /boot/grub
warning: grub-probe can't find drive for /dev/xvda1.
grub-probe: error: cannot find a GRUB drive for /dev/xvda1. Check your device.map.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-2.6.32-5-686-bigmem.postinst line 799, <stdin> line 2.
dpkg: error processing linux-image-2.6.32-5-686-bigmem (--configure):
subprocess installed post-installation script returned error exit status 2
Setting up isc-dhcp-common (4.1.1-P1-15+squeeze1) ...
configured to not write apport reports
Setting up isc-dhcp-client (4.1.1-P1-15+squeeze1) ...
Setting up firmware-linux-free (2.6.32-31) ...
Setting up linux-libc-dev (2.6.32-31) ...
Setting up dhcp3-client (4.1.1-P1-15+squeeze1) ...
Errors were encountered while processing:
linux-image-2.6.32-5-686-bigmem
E: Sub-process /usr/bin/dpkg returned an error code (1)

Read more

Linux Malware Detect (LMD)

Project URL

Project README

Project Changelog

Overview

Linux Malware Detect (LMD) uses MD5 file hashes and hex pattern matches to identify malware. The goal of LMD is to provide a threat detection, alerting and quarantine tool for Linux web servers, though the MD5/hex signatures are portable to any number of detection tools. There is currently limited availability of open source, restriction free, tools for Linux systems that focus on malware detection and more important that get it right. Many of the AV products that perform malware detection on Linux have a very poor track record of detecting threats, especially those targeted at shared web hosting servers. The threat landscape on shared web hosting servers is unique from that of the standard AV products detection suite in that they are detecting primarily trojans / rootkit content but missing the ever increasing malware on the account level which serves as an attack platform. Using the cymru.com malware hash repository, which provides malware data for Microsoft, Google, Trend Micro, F-Secure, Symantec and more; we can demonstrate this short coming in current threat detection.
Read more

VBScript Regular Expressions: Subexpression Substitutions

Introduction
Although there are a good range of text handling functions in VBScript, there are times when the required text replacement operation would be very tricky to carry out with a combination of calls to functions such as Replace, InStr and Left. In these cases, it is worth considering the use of VBScript’s regular expressions, which are supported from VBScript version 5 upwards. An introduction to VBScript Regular Expressions is available.

Complex Substitutions

A typical use of regular expression substitutions is to process the BBCode tags into HTML. BBCode is a simplified version of HTML used by web-based applications such as the phpBB bulletin board. For example, if the user wishes to insert a hyperlink in their message then they can either use the BBCode:
Read more

NFSv4Howto

Installation
The required packages are different depending on if the system is a client or a server. In this Howto, the server is the host that has the files you want to share and the client is the host that will be mounting the NFS share.

NFSv4 client

apt-get install nfs-common 

NFSv4 server

apt-get install nfs-kernel-server 

After you finish installing nfs-kernel-server, you might see failure to start nfs-kernel-server due to missing entries in /etc/exports. Remember to restart the service when you finish configuring.
Read more