Разные заметки

Показаны сообщения с ярлыком linux. Показать все сообщения
Показаны сообщения с ярлыком linux. Показать все сообщения

понедельник, 25 февраля 2013 г.

Установка Windows 7 с помощью PXE и LINUX сервера


Дано: некий офис с компьютерами типа PC, сервер с Linux.
Задача: Сделать сервис установки системы по сети без использования платных Windows Server и др.
Решение:

понедельник, 23 июля 2012 г.

Установка Asterisk на Debian

Буду краток. Одни команды.


1. Подготовка системы:
Установка необходимых пакетов. Архиваторов. Утилиту Screen.


2. Настройка ядра:
uname -a                     -> выдает Linux srv93 2.6.32-5-amd64 #1 SMP Sun May 6 04:00:17 UTC 2012 x86_64 GNU/Linux
aptitude install linux-source-2.6.32

tar xjf /usr/src/linux-source-2.6.32.tar.bz2

ln -s /usr/src/linux-source-2.6.32 /usr/src/linux

cd /usr/src/linux

make clean && make mrproper

cp /boot/config-2.6.32-5-amd64 ./.config

make menuconfig
Выставляем опции:

Processor type and features >> Timer frequency = 1000 Hz.
Processor type and features >> [*]High Resolution Timer Option
Device Drivers >> Character Devices >> [*]HPET Timer Support

Device Drivers >> [*]Enchanced Real Time Clock Support
Library Routines >> [*]CONFIG_CRC_CCITT



make-kpkg clean

fakeroot make-kpkg --initrd --append-to-version=-mycustom kernel_image kernel_headers

dpkg -i *.deb

3. Настройка загрузки нового ядра:
grep menuentry /boot/grub/grub.cfg
nano /etc/default/grub
update-grub
grep menuentry /boot/grub/grub.cfg
reboot

uname -a             -> выдает Linux srv93 2.6.32-mycustom #1 SMP Mon Jul 23 15:05:23 MSK 2012 x86_64 GNU/Linux


4. Установка пакетов Asterisk.

aptitude install asterisk-1.6.2 asterisk-config asterisk-mp3 libasterisk-agi-perl python-asterisk

Следующие НОВЫЕ пакеты будут установлены:
  asterisk asterisk-config asterisk-core-sounds-en-gsm{a} asterisk-mp3 dahdi{a} dahdi-linux{a} debhelper{a} freetds-common{a} fxload{a} html2text{a}
  libasound2{a} libasterisk-agi-perl libc-client2007e{a} libcorosync4{a} libdirectfb-1.2-9{a} libflac8{a} libgmime-2.0-2a{a} libgsm1{a} libiksemel3{a}
  libjack-jackd2-0{a} libjpeg62{a} libnspr4-0d{a} libnss3-1d{a} libogg0{a} libopenais3{a} libopencore-amrnb0{a} libopencore-amrwb0{a} libopenr2-3{a}
  libperl5.10{a} libpq5{a} libpri1.4{a} libradiusclient-ng2{a} libresample1{a} libsdl1.2debian{a} libsdl1.2debian-alsa{a} libsndfile1{a} libsnmp-base{a}
  libsnmp15{a} libsox-fmt-alsa{a} libsox-fmt-base{a} libsox1b{a} libspandsp2{a} libspeex1{a} libspeexdsp1{a} libsqlite0{a} libss7-1{a} libsvga1{a}
  libsybdb5{a} libsysfs2{a} libtiff4{a} libtonezone2.0{a} libts-0.0-0{a} libvorbis0a{a} libvorbisenc2{a} libvorbisfile3{a} libvpb0{a} libwavpack1{a}
  libx86-1{a} mlock{a} module-assistant{a} odbcinst{a} odbcinst1debian2{a} python-asterisk sox{a} tsconf{a} unixodbc{a} vpb-driver-source{a}
0 пакетов обновлено, 67 установлено новых, 0 пакетов отмечено для удаления, и 0 пакетов не обновлено.
Необходимо получить 19,6 MB архивов. После распаковки 50,1 MB будет занято.
На...Зачем это все? ну ладно...

/etc/init.d/asterisk stop

5. Настройка fail2ban

Конфигурация fail2ban:
Создадим новый фильтр.
Код:
touch /etc/fail2ban/filter.d/asterisk.conf

Содержимое файла /etc/fail2ban/filter.d/asterisk.conf должно быть таким:
Код: 
# Fail2Ban configuration file
#
#
# $Revision: 250 $
#

[INCLUDES]

# Read common prefixes. If any customizations available -- read them from
# common.local
#before = common.conf


[Definition]

#_daemon = asterisk

# Option:  failregex
# Notes.:  regex to match the password failures messages in the logfile. The
#          host must be matched by a group named "host". The tag "" can
#          be used for standard IP/hostname matching and is only an alias for
#          (?:::f{4,6}:)?(?P\S+)
# Values:  TEXT
#

failregex = NOTICE.* .*: Registration from '.*' failed for '' - Wrong password
            NOTICE.* .*: Registration from '.*' failed for '' - No matching peer found
            NOTICE.* .*: Registration from '.*' failed for '' - Username/auth name mismatch
            NOTICE.* .*: Registration from '.*' failed for '' - Device does not match ACL
            NOTICE.* .*: Registration from '.*' failed for '' - Peer is not supposed to register
            NOTICE.* failed to authenticate as '.*'$
            NOTICE.* .*: No registration for peer '.*' \(from \)
            NOTICE.* .*: Host failed MD5 authentication for '.*' (.*)
            NOTICE.* .*: Failed to authenticate user .*@.*

# Option:  ignoreregex
# Notes.:  regex to ignore. If this regex matches, the line is ignored.
# Values:  TEXT
#
ignoreregex =

в переменную ignoreregex через запятую, можете прописать ip, которые не будут блокироваться.

Следующим шагом мы редактируем файл /etc/fail2ban/jail.conf. В самый низ данного файла помещаем новый блок:
Код: 
[asterisk-iptables]
enabled  = true
filter   = asterisk
action   = iptables-allports[name=ASTERISK, protocol=all]
         sendmail-whois[name=ASTERISK, dest=root, sender=fail2ban@example.org]
logpath  = /var/log/asterisk/full
maxretry = 5
bantime = 259200

тут у нас следующая ситуация:
fail2ban@example.org - email куда будут отправляться репорты о банах
logpath = /var/log/asterisk/full - лог, который анализируется (смотрите куда пишется у вас лог)
maxretry = 5 - число неправильных попыток авторизации
bantime = 259200 - время бана в секундах

теперь включим полное логирование нашего asterisk:
Правим файл /etc/asterisk/logger.conf.
Должно получиться примерно такое:
Код: 
[general]
dateformat=%F %T;

; Logging Configuration
;
; In this file, you configure logging to files or to
; the syslog system.
;
; For each file, specify what to log.
;
; For console logging, you set options at start of
; Asterisk with -v for verbose and -d for debug
; See 'asterisk -h' for more information.
;
; Directory for log files is configures in asterisk.conf
; option astlogdir
;
[logfiles]
;
; Format is "filename" and then "levels" of debugging to be included:
;    debug
;    notice
;    warning
;    error
;    verbose
;
; Special filename "console" represents the system console
;
;debug => debug
; The DTMF log is very handy if you have issues with IVR's
;dtmf => dtmf
;console => notice,warning,error
;console => notice,warning,error,debug
messages => notice,warning,error
full => notice,warning,error,debug,verbose

;syslog keyword : This special keyword logs to syslog facility
;
;syslog.local0 => notice,warning,error
;


ну и последний шаг, перезагрузим наши сервисы:
Код: 
/etc/init.d/fail2ban restart
 и
Код: 
service iptables restart
cp /etc/asterisk /etasterisk/asterisk.bak

Установка закончена.

среда, 4 апреля 2012 г.

воскресенье, 12 февраля 2012 г.

Home Server. Часть 7. Установка и настройка Bittorent-клиента.


При создании использовал материалы сайтов:
  1. Собираем rTorrent из исходников 2
  2. Установка и настройка rTorrent в Debian
  3. rutorrent
  4. на всякий случай
Задача:
Без всяких иксов настроить автоматическую работу битторент клиента для раздач и скачивания :)

воскресенье, 29 января 2012 г.

Home Server. Часть необязательная. Подключение к Beeline. VPN по L2TP.

Собственно задачка - подключиться к провайдеру по L2TP без устаревшего роутера, резавшего скорость.
Честно говоря долго не выдумывал :)

Home Server. Часть 6. Файловый сервис Samba.

Пришла очередь настроить сервис Samba для хранения файлов на нашем сервере.
Хранить будем на созданном ранее "зеркале".


воскресенье, 22 января 2012 г.

Home Server. Часть 4. Настройка NTP сервера для локальной сети.

Собственно, установка демона сводится к установке следующих пакетов: ntp (пакет включающий самого демона), ntpdate (утилита для ручной синхронизации времени - устарела), ntp-doc (документация по пакету), в некоторых дистрибутивах нужно будет установить так же ntp-utils (утилиты для диагностики), в некоторых они включены в пакет ntp.

Приступим.

Home Server. Часть 3. Настройка Internet Systems Consortium DHCP Server для локальной сети.

Для начала определимся с параметрами сети и дополнительными опциями, которые будет передавать DHCP-сервер:

сеть: 192.168.93.0/24 (маска 255.255.255.0);
пул динамически назначаемых адресов: 192.168.93.10 - 192.168.93.15;
шлюз: 192.168.93.1;
домен: ex;
DNS-сервер: 192.168.93.1;
NTP сервер**: 192.168.93.1.


** О настройке NTP сервера читать часть 4.

Приступим.

Home Server. Часть 2. Установка кэшируещего DNS в среде chroot.

Вводная информация:
192.168.93.1 - адрес сервера в локальной сети
srv93             - имя сервера
ДНС серверы:
213.234.192.7; 195.14.50.1; 8.8.8.8

Приступим...

суббота, 21 января 2012 г.

Home Server. Часть 1. Установка ОС. SSH.

Переделываем по новому :)

Приобрел комплектующие для домашнего сервера.
Решил поставить стабильный Debian.
Сервак будет выполнять роль шлюза, ну заниматься закачкой и тп вещами.
Краткий список хотелок (выполненные зачеркнуты):
1. Шлюз-маршрутизатор-файерволл
2. Доступ к серверу по SSH без пароля, по ключам, доступ для root отключен
3. OpenVPN сервер для доступа в домашнюю сеть извне.
4. Кеширующий DNS
5. DHCP для внутренней сети
6. Samba для файлового сервера.
7. Торрент-клиент и качалка
8. Одна-две виртуалки, винда и например Ubuntu. (VmWare Server2 или ESXi)
9. Надо подумать насчет ftp и postfix-a... ftp разве что только для внутренней сети.
10. fail2ban для защиты от шибко умных китайцев-корейцев.



вторник, 15 ноября 2011 г.

Разные полезные команды

ls -lah --group-directories-first

выводит группируя директории в начале списка


cat /etc/fstab | grep -v '^#' | sed '/^$/d'
вывод файлов без коментариев

вторник, 8 ноября 2011 г.

Массовое переименование файлов

 find /path -name '*' -exec rename 'y/A-Z/a-z/' {} \;

Переименовывает все файлы и папки внутри указанной /path

четверг, 4 ноября 2010 г.

Linux date

Наберите команду date, чтобы посмотреть текущие дату и время. Если необходимо изменить их, воспользуйтесь следующим форматом команды:
date MMDDhhmmCCYY.ss
MM — месяц, DD — день месяца, hh — часы, mm — минуты, CCYY — 4 цифры года, ss — секунды
Например:
date 100615352006.30
Эта команда установит текущие дату и время на 06 октября 2006 года, 15:35:30.
Обратите внимание: дату и время может изменять только root-пользователь.


Установка NTP сервера для Linux и Windows клиентов:
http://www.k-max.name/linux/ntp-server-na-linux/

среда, 6 октября 2010 г.

Gentoo руссификация консоли

nano /etc/locale.gen
  • en_US.UTF-8 UTF-8
    ru_RU.UTF-8 UTF-8 
locale-gen
nano /etc/conf.d/consolefont
  • consolefont="UniCyr_8x16" 
nano /etc/conf.d/keymaps
  • keymap="ruwin_ct_sh-UTF-8"
    windowkeys="YES"
    
nano /etc/env.d/02locale
  • LANG="ru_RU.utf-8"
    LC_ALL="" 
    ##Чтобы системные сообщения выводились на английском. 
    
    LC_MESSAGES="en_US.utf-8" 
env-update && source /etc/profile /etc/init.d/consolefont restart && /etc/init.d/keymaps restart


И еще один вариант.

Формат файла crontab

В Wikipedia можно вкратце посмотреть о формате с примерами.

Строка может быть трёх типов: комментарий (начинается с #), задание переменной среды (SHELL,MAILTO,PATH,LOGNAME,HOME) или команда для cron. Строки не могут смешиваться, то есть нельзя писать комментарий в строке с командой.
С первым типом всё понятно - комментарий он и есть комментарий.
Второй тип - задание переменной выглядит как "имя_переменной = величина". За подробностями о переменных обращайтесь в справку.
Ну и третий тип, самый интересный для нас, выглядит как шесть полей разделённых пробельными символами (пробелы и/или знаки табуляции). Первые пять полей задают время для команды, шестой - имя программы:
(минуты:0-59) (часы:0-23) (дни месяца:0-31) (месяц:0-12) (день недели:0-6, 0-воскресенье) (программа_с_параметрами)
Каждое из первых пяти полей может быть задано следующим образом:
  • Звёздочка (*) - обозначает весь диапазон (от первого до последнего)
  • Диапазон чисел, от и до. Например "5-7" будет означать 5,6 и 7
  • Списки. Это числа (или диапазоны) разделенные запятыми. Например: "1,5,10,11" или "1-11,19-23".
  • Звёздочка или диапазон с шагом. Используется для пропусков в диапазонах. Шаг указывается после косой черты. Например "2-10/2" будет значить "2,4,6,8,10", а выражение "*/2" в поле "часы" будет означать "каждые два часа.
Последнее поле (шестое) определяет команду для запуска.
Примеры (взяты из Wikipedia):

# как обычно, с символа '#' начинаются комментарии
# в качестве командного интерпрететора использовать /bin/sh
SHELL=/bin/sh
# результаты работы отправлять по этому адресу
MAILTO=paul@example.org
# добавить в PATH
PATH=$PATH:$HOME/bin

#### Здесь начинаются задания
# выполнять каждый день в 0 часов 5 минут, результат складывать в log/daily
5 0 * * * $HOME/bin/daily.job >> $HOME/log/daily 2>&1
# выполнять 1 числа каждого месяца
15 14 1 * * $HOME/bin/monthly
# каждый рабочий день в 22:00
0 22 * * 1-5 echo «Пора домой» | mail -s «Уже 22:00» john

23 0-23/2 * * * echo «Выполняется в 0:23, 2:23, 4:23 и т. д.»
5 4 * * sun echo «Выполняется в 4:05 в воскресенье»
0 0 1 1 * echo «С новым годом!»
15 10,13 * * 1,4 echo «Каждый понедельник и четверг в 10:15 и 13:15»

Как добавить задачу в crontab?

Формат команды:

crontab { -l | -r | -e }

где:
-l - выводит текущих crontab файл на стандартный вывод.
-r - удаляет текущий crontab файл.
-e - используется для редактирования текущего crontab используя редактор, заданный переменной окружения VISUAL или EDITOR. Таким образом, вводим crontab -e, добавляем нужную строку с командой и нажимаем "Ctrl-D".

Настройки окружения

Надоело все время с нуля настраивать оболочку под себя.
Вот здесь выкладываю свои настройки.

.bashrc
Для root'а:

# ~/.bashrc: executed by bash(1) for non-login shells.

# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
#PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022

#PS1="\[\033[1;31m\]\h:\[\033[1;33m\](\w)\[\033[0m\]\[\033[0m\]"

lightblue='\e[1;34m'
lightgreen='\e[1;32m'
lightred='\e[1;31m'

###PS1='\[\033[01;32m\]\u\[\033[01;34m\]-\[\033[01;31m\]\h\[\033[00;34m\]{\[\033[01;34m\]\w\[\033[00;34m\]}\[\033[01;32m\]:\[\033[00m\]'
PS1="\[\033[1;30m\]\t-\[\033[1;31m\]\h:\[\033[1;33m\](\w)\[\033[0m\]\[\033[0m\]"

clear
###echo -e "${lightred}";figlet -c "DEBIAN";
echo -e "${lightgreen}Ядро: \t${lightgreen}" `uname -smr`
echo -e "${lightgreen}ОС: \t ${lightgreen}Debian  GNU/Linux ${NC}" `cat /etc/debian_version`

export LESS_TERMCAP_mb=$'\033[01;31m'
export LESS_TERMCAP_md=$'\033[01;31m'
export LESS_TERMCAP_me=$'\033[0m'
export LESS_TERMCAP_se=$'\033[0m'
export LESS_TERMCAP_so=$'\033[01;44;33m'
export LESS_TERMCAP_ue=$'\033[0m'
export LESS_TERMCAP_us=$'\033[01;32m'

# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto --group-directories-first'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
alias la='ls $LS_OPTIONS -lah'
alias l='ls $LS_OPTIONS -CF'

#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'


alias dir='dir --color=auto'
alias vdir='vdir --color=auto'

alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

if [ -f /usr/bin/grc ]; then
  alias cvs="grc --colour=auto cvs"
  alias diff="grc --colour=auto diff"
  alias esperanto="grc --colour=auto esperanto"
  alias gcc="grc --colour=auto gcc"


#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'


alias dir='dir --color=auto'
alias vdir='vdir --color=auto'

alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

if [ -f /usr/bin/grc ]; then
  alias cvs="grc --colour=auto cvs"
  alias diff="grc --colour=auto diff"
  alias esperanto="grc --colour=auto esperanto"
  alias gcc="grc --colour=auto gcc"
  alias irclog="grc --colour=auto irclog"
  alias ldap="grc --colour=auto ldap"
  alias log="grc --colour=auto log"
  alias netstat="grc --colour=auto netstat"
  alias ping="grc --colour=auto ping"
  alias proftpd="grc --colour=auto proftpd"
  alias traceroute="grc --colour=auto traceroute"
  alias wdiff="grc --colour=auto wdiff"
fi

if [ -f /etc/bash_completion ]; then
 . /etc/bash_completion
fi

extract () {
  if [ -f $1 ] ; then
    case $1 in
      *.tar.bz2)   tar xvjf $1    ;;
      *.tar.gz)    tar xvzf $1    ;;
      *.tar.xz)    tar xvJf $1    ;;
      *.bz2)       bunzip2 $1     ;;
      *.rar)       unrar x $1     ;;
      *.gz)        gunzip $1      ;;
      *.tar)       tar xvf $1     ;;
      *.tbz2)      tar xvjf $1    ;;
      *.tgz)       tar xvzf $1    ;;
      *.zip)       unzip $1       ;;
      *.Z)         uncompress $1  ;;
      *.7z)        7z x $1        ;;
      *.xz)        unxz $1        ;;
      *.exe)       cabextract $1  ;;
      *)           echo "\`$1': неизвестный метод сжатия файла" ;;
    esac
  else
    echo "\`$1' нет такого файла"
  fi
}



Для пользователя:
PS1="\[\033[1;30m\]\t-\[\033[1;32m\]\h:\[\033[1;33m\](\w)\[\033[0m\]\[\033[0m\]"
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias dir='dir --color=auto'
    alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
#alias ll='ls -l'
#alias la='ls -A'
#alias l='ls -CF'
alias ls='ls $LS_OPTIONS'export LS_OPTIONS='--color=auto --group-directories-first'

alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
alias la='ls $LS_OPTIONS -lah'
alias l='ls $LS_OPTIONS -CF'

Screen (/etc/screenrc):
# -вместо "ctrl+a" назначена клавиша <`> (обычно она под esc и над tab),
# так что вместо двух клавиш надо жать одну. Если надо
# набрать <`>, что довольно редко требуется, то надо нажать её два раза подряд.
# -внизу терминала зеленым на чёрном статусная строка показывающая
# активные сессии и часы. Переключение между ними: `1, `2, `3 и т.п., или
# `n (next), `p (previous)
# - для CERN/Lxplus добавление в конец этого файла строк
#    # annoying RedHat/SLC backspace problem
#    bindkey ^? stuff ^H
#  решает проблему с
# - `d => detach session; screen -ls => list of detached session;
#  screen -r => reattach session.
#------------------------------------------------------------------------------
# .screenrc file based on http://www.dotfiles.com/files/3/463_screenrc.txt
#------------------------------------------------------------------------------
# SCREEN SETTINGS
#------------------------------------------------------------------------------
 escape ``                             # use ` instesd of Cntr-A
 vbell on                               # default: off
 vbell_msg "   -- Ring, Ring!! --   "   # default: "Wuff,Wuff!!"
 autodetach on                          # default: on
 startup_message off                    # default: on
 crlf off                               # default: off
 defscrollback 1024                     # default: 100
 silencewait 15                 # default: 30
 msgwait 15
 pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended."
# change the hardstatus settings to give an window list at the bottom of the
 # screen, with the time and date and with the current window highlighted
 # caption always "%{=}%?%{b}%H %L=%{+b}%?%{y}%-Lw%47L>%?%{g}%n*%f %t %?%{y}%+Lw%?%{b}%-31=%c %l %Y-%m-%d"
hardstatus alwayslastline
#hardstatus string '%{= mK}%-Lw%{= KW}%50>%n%f* %t%{= mK}%+Lw%< %{= kG}%-=%D %d %M %Y %c:%s%{-}'
 hardstatus string '%{= kG} %{G}%H %{g}[%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}]%{D} %d/%m %c %{g}'
#------------------------------------------------------------------------------
# TERMINAL SETTINGS
#------------------------------------------------------------------------------
 #the vt100 description does not mention "dl". *sigh*
 termcapinfo  vt100 dl=5\E[M
 termcap  vt100* ms:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC
 terminfo vt100* ms:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC
 termcap  xterm hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l
 terminfo xterm hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l
 termcapinfo xterm Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l
 termcapinfo xterm* OL=100
 termcapinfo xterm 'VR=\E[?5h:VN=\E[?5l'
 termcapinfo xterm 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~'
 termcapinfo xterm 'kh=\EOH:kI=\E[2~:kD=\E[3~:kH=\EOF:kP=\E[5~:kN=\E[6~'
 termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
 termcapinfo xterm 'vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l'
 termcapinfo xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337'
 termcapinfo xterm* be
 termcapinfo linux C8
#------------------------------------------------------------------------------
# SCREEN KEYBINDINGS
#------------------------------------------------------------------------------
# Remove some stupid / dangerous key bindings
 bind k
 bind ^k
 bind .
 bind ^\
 bind \\
 bind ^h
 bind h
 bind 'K' kill
 bind 'I' login on
 bind 'O' login off
 bind '}' history
 register [ "\033:se noai\015a"
 register ] "\033:se ai\015a"
 bind ^] paste [.]
 bind = resize =
 bind + resize +3
 bind - resize -3
 bind  ) select 10
 bind  ! select 11
 bind  @ select 12
 bind \# select 13
 bind \$ select 14
 bind  % select 15
 bind \^ select 16
 bind  & select 17
 bind  * select 18
 bind  ( select 19
 logfile ~/logs/screen_%Y-%m-%d_%0c
 bindkey -k F1 prev
 bindkey -k F2 next

Nano - apхив с шаблонами,
мой /etc/nanorc:
## Sample initialization file for GNU nano.
##
## Please note that you must have configured nano with --enable-nanorc
## for this file to be read!  Also note that this file should not be in
## DOS or Mac format, and that characters specially interpreted by the
## shell should not be escaped here.
##
## To make sure a value is disabled, use "unset
##
## For the options that take parameters, the default value is given.
## Other options are unset by default.
##
## Quotes inside string parameters don't have to be escaped with
## backslashes.  The last double quote in the string will be treated as
## its end.  For example, for the "brackets" option, ""')>]}" will match
## ", ', ), >, ], and }.
## Use auto-indentation.
# set autoindent
## Backup files to filename~.
# set backup
## The directory to put unique backup files in.
# set backupdir ""
## Do backwards searches by default.
# set backwards
## Use bold text instead of reverse video text.
# set boldtext
## The characters treated as closing brackets when justifying
## paragraphs.  They cannot contain blank characters.  Only closing
## punctuation, optionally followed by closing brackets, can end
## sentences.
##
# set brackets ""')>]}"
## Do case sensitive searches by default.
# set casesensitive
## Constantly display the cursor position in the statusbar.  Note that
## this overrides "quickblank".
# set const
## Use cut to end of line by default.
# set cut
## Set the line length for wrapping text and justifying paragraphs.
## If fill is 0 or less, the line length will be the screen width less
## this number.
##
# set fill -8
## Enable ~/.nano_history for saving and reading search/replace strings.
# set historylog
## The opening and closing brackets that can be found by bracket
## searches.  They cannot contain blank characters.  The former set must
## come before the latter set, and both must be in the same order.
##
# set matchbrackets "(<[{)>]}"
## Use the blank line below the titlebar as extra editing space.
# set morespace
## Enable mouse support, if available for your system.  When enabled,
## mouse clicks can be used to place the cursor, set the mark (with a
## double click), and execute shortcuts.  The mouse will work in the X
## Window System, and on the console when gpm is running.
##
# set mouse

## Allow multiple file buffers (inserting a file will put it into a
## separate buffer).  You must have configured with --enable-multibuffer
## for this to work.
##
# set multibuffer
## Don't convert files from DOS/Mac format.
# set noconvert
## Don't follow symlinks when writing files.
# set nofollow
## Don't display the helpful shortcut lists at the bottom of the screen.
# set nohelp
## Don't add newlines to the ends of files.
# set nonewlines
## Don't wrap text at all.
# set nowrap
## Set operating directory.  nano will not read or write files outside
## this directory and its subdirectories.  Also, the current directory
## is changed to here, so any files are inserted from this dir.  A blank
## string means the operating directory feature is turned off.
##
# set operatingdir ""
## Preserve the XON and XOFF keys (^Q and ^S).
# set preserve
## The characters treated as closing punctuation when justifying
## paragraphs.  They cannot contain blank characters.  Only closing
## punctuation, optionally followed by closing brackets, can end
## sentences.
##
# set punct "!.?"
## Do quick statusbar blanking.  Statusbar messages will disappear after
## 1 keystroke instead of 26.  Note that "const" overrides this.
##
# set quickblank
## The email-quote string, used to justify email-quoted paragraphs.
## This is an extended regular expression if your system supports them,
## otherwise a literal string.  Default:
# set quotestr "^([     ]*[#:>\|}])+"
## if you have extended regular expression support, otherwise:
# set quotestr "> "
## Fix Backspace/Delete confusion problem.
# set rebinddelete
## Fix numeric keypad key confusion problem.
# set rebindkeypad
## Do extended regular expression searches by default.
# set regexp
## Make the Home key smarter.  When Home is pressed anywhere but at the
## very beginning of non-whitespace characters on a line, the cursor
## will jump to that beginning (either forwards or backwards).  If the
## cursor is already at that position, it will jump to the true
## beginning of the line.
# set smarthome
## Use smooth scrolling as the default.
# set smooth
## Use this spelling checker instead of the internal one.  This option
## does not properly have a default value.
##
# set speller "aspell -x -c"
## Allow nano to be suspended.
# set suspend
## Use this tab size instead of the default; it must be greater than 0.
# set tabsize 8
## Convert typed tabs to spaces.
# set tabstospaces
## Save automatically on exit, don't prompt.
# set tempfile
## Disallow file modification; why would you want this in an rcfile? ;)
# set view
## The two single-column characters used to display the first characters
## of tabs and spaces.  187 in ISO 8859-1 (0000BB in Unicode) and 183 in
## ISO-8859-1 (0000B7 in Unicode) seem to be good values for these.
# set whitespace "  "
## Detect word boundaries more accurately by treating punctuation
## characters as part of a word.
# set wordbounds


## Default - makes ## as comment
 include "/usr/share/nano/default.nanorc"
## Emacs
 include "/usr/share/nano/dotemacs.nanorc"
## C++
 include "/usr/share/nano/c.nanorc"
## C
 include "/usr/share/nano/c-file.nanorc"
## Pov-Ray
 include "/usr/share/nano/pov.nanorc"
## HTML
#there is better one in xml.nanorc
# include "/usr/share/nano/html.nanorc"
## TeX
 include "/usr/share/nano/tex.nanorc"
## Quoted emails (under e.g. mutt)
 include "/usr/share/nano/mutt.nanorc"
## Patch files
 include "/usr/share/nano/patch.nanorc"
## Manpages
 include "/usr/share/nano/man.nanorc"
## Groff
 include "/usr/share/nano/groff.nanorc"
## Perl
 include "/usr/share/nano/perl.nanorc"
## Python
 include "/usr/share/nano/python.nanorc"
## Ruby
 include "/usr/share/nano/ruby.nanorc"
## Java
 include "/usr/share/nano/java.nanorc"
## Assembler
 include "/usr/share/nano/asm.nanorc"
## Bourne shell scripts
 include "/usr/share/nano/sh.nanorc"
## Gentoo ebuilds and such
 include "/usr/share/nano/gentoo.nanorc"
## PHP something missing in there...
#include "/usr/share/nano/php.nanorc"
## PHP
include "/usr/share/nano/php2.nanorc"
## Xorg config
include "/usr/share/nano/xorg.nanorc"
## XML
include "/usr/share/nano/xml.nanorc"
## URLS
include "/usr/share/nano/urls.nanorc"
## CSS
include "/usr/share/nano/css.nanorc"
## Conky
include "/usr/share/nano/conky.nanorc"
## .cf
include "/usr/share/nano/maincf.nanorc"
## *rc - catches more files for now
#include "/usr/share/nano/rcfiles.nanorc"
## *rc
include "/usr/share/nano/rcfiles-new.nanorc"
## profile
include "/usr/share/nano/profile.nanorc"
## java script
include "/usr/share/nano/js.nanorc"
## configs
include "/usr/share/nano/configfiles.nanorc"
## Xstuff
include "/usr/share/nano/xdefaults.nanorc"
## configs
include "/usr/share/nano/config.nanorc"
## configs
include "/usr/share/nano/config2.nanorc"
## configs
include "/usr/share/nano/config3.nanorc"
## configs
include "/usr/share/nano/tab.nanorc"
## configs
include "/usr/share/nano/passwd.nanorc"
include "/usr/share/nano/desc.nanorc"
## Delphi
include "/usr/share/nano/delphi.nanorc"
# ChangeLog - colors everything in blue
#include "/usr/share/nano/changelog.nanorc"
## ChangeLog            (C)ryszardzonk
include "/usr/share/nano/changelogs.nanorc"
## video metadata info  (C)ryszardzonk
include "/usr/share/nano/info.nanorc"
## configs in /etc      (C)ryszardzonk
include "/usr/share/nano/etc-stuff.nanorc"
## logs in /var/log     (C)ryszardzonk
include "/usr/share/nano/log-stuff.nanorc"
## nanorc syntax
include "/usr/share/nano/nanorc.nanorc"
## *.po files           (C)ryszardzonk
include "/usr/share/nano/po.nanorc"
## Apache 2
include "/usr/share/nano/apache2.nanorc"
## Apache 2 Virtual Host
include "/usr/share/nano/vhost.nanorc"
## /etc/init.d/*        custom gentoo.nanorc
include "/usr/share/nano/initscript.nanorc"
## Named                (C)ryszardzonk
include "/usr/share/nano/named.nanorc"
## File Types           (C)ryszardzonk
include "/usr/share/nano/mimetype.nanorc"
## /etc/initng/         custom sh.nanorc
include "/usr/share/nano/initng.nanorc"
## /etc/xml         custom xml.nanorc
include "/usr/share/nano/etcxml.nanorc"
## sh.nanorc syntax for custom files
include "/usr/share/nano/shlike.nanorc"
## c.nanorc syntax for custom files
include "/usr/share/nano/clike.nanorc"
## EKG History view     (C)ryszardzonk
include "/usr/share/nano/ekghistory.nanorc"
## others               (C)ryszardzonk
include "/usr/share/nano/others.nanorc"
## others               (C)ryszardzonk + LinuxHelp Wiki
include "/usr/share/nano/makefile.nanorc"
## postegreSQL
## postegreSQL
include "/usr/share/nano/postgresql.nanorc"
## Debian Sources (off by default)
#include "/usr/share/nano/sources_list.nanorc"
## SoftCam.Key mgcamd
include "/usr/share/nano/softcam.nanorc"
## Paludis http://gentoo-wiki.com/TIP_Nano_Context_Highlighting
include "/usr/share/nano/paludis.nanorc"
## HAVP config          (C)ryszardzonk
include "/usr/share/nano/havp.nanorc"
## Privoxy              (C)ryszardzonk
include "/usr/share/nano/privoxy.nanorc"
## Asterisk syntax highlighting
include "/usr/share/nano/asterisk.nanorc"

понедельник, 26 июля 2010 г.

Трафик компьютера в сети

tcpdump -i eth0 port www and host

LiveCD Debian на flash-диске

Устанавливаем программы:
apt-get install live-helper qemu


Выполняем команды:
lh_clean --binary
lh_config -b usb-hdd -p gnome
# lh_config --apt aptitude --binary-images --hostname live-machine --username sergey
lh_config --bootappend-live "locale=ru_RU.UTF-8"
lh_config --checksums disabled
lh_config --interactive shell
# lh_config --apt aptitude --binary-images --hostname live-machine --username sergey -b usb-hdd -p gnome --bootappend-live "locale=ru_RU.UTF-8" --checksums disabled  --interactive shell

lh_build



Ожидаем возврата в командную строку и устанавливаем в шелл нужные нам пакеты, например:
apt-get install mc gparted ssh dialog xdialog

Затем выходим:
logout

Проверяем образ с помощью виртуальной машины:
qemu -hda binary.img

Записываем на флешку:
dd if=binary.img of=/dev/sdb