Montag, 30. November 2009

xsetroot -solid black

rpm --checksig; rpm -K

dhcpd.conf: shared-network {subnet {group { host }}}}

ex: %d ---delete all lines in a file

ex: 23,.m$ --move lines from 23 to the current line to the end of the file

pinfo

man -aw ls

man -d ls

when you get segmentation fault in yum: rm -f /var/lib/rpm/__db*; rpm --rebuilddb

xorg.conf is missing: Xorg -configure :1

ex: := prints the total number of lines; :.= prints the line number of the current line.

ex: 1,10# --display lines 1 to 10 and their respective numbers; se nu; se nonu

for i in {0..110};do echo line $i;done

Freitag, 20. November 2009

Things to take with when going out:

Contact Phone numbers, address and map, keys or whatever is required to get in
Warm jacket
Rescuecd, rescueusb
Laptop with tftpd, dhcpd
3g modem
Cable cat5 cross
cable com-to-usb
Screwdriver
RSA keys
presents
more business cards than usual
phone friends to tell you will be around

chkconfig nscd on; nscd -i hosts; ipconfig /flushdns

for i in {1..19}; do echo $i; done

PS1="\u@\h:\w\$"

Mittwoch, 18. November 2009

query rpm with the specified m5sum: rpm --fileid neededmd5sum

output and error redirection: myprogram 1>messages.out 2>messages.err ; myprogram &>both or myprogram >&both which is the same

check the openssl on local port 995: openssl s_client -connect localhost:995

view changes to default configuration: dovecot -n; postfix -n

escape characters: ^] for telnet; ^A for GNU Screen; ^B for tmux

rpm --nomd5 --nopgp

list package requerements: rpm -qR bash

list only documentation files of a package: rpm -qd bash

list only configuration files of a package: rpm -qc bash

remove package: rpm -e glibc-devel

force installation: rpm -i foo.rpm --nodeps

freshen file (do not install if such package is not installed on the system): rpm -F *.rpm. however it does not resolve dependencies

install foreign package: alien -i package.rpm

simulate package installation: apt-get -s; rpm --test

download, but do not install: apt-get -d

list all installed packages, or in the example only bash: dpkg -l bash; rpm -qa bash

list files in a package: dpkg -L pkg_name

gzip -dc tarball.tar.gz|tar -xv ---option -c of gzip says not to delete the old file

Dienstag, 10. November 2009

selinux: setsebool -P allow_httpd_anon_write=1 ..

SHARING FILES
If you want to share files with multiple domains (Apache, FTP, rsync,
Samba), you can set a file context of public_content_t and public_con-
tent_rw_t. These context allow any of the above domains to read the
content. If you want a particular domain to write to the public_con-
tent_rw_t domain, you must set the appropriate boolean.
allow_DOMAIN_anon_write. So for httpd you would execute:

setsebool -P allow_httpd_anon_write=1

Mittwoch, 4. November 2009

awk 'END {print NR }' /etc/group ---shows the number of the last line in the file

# awk 'END {print NR }' /etc/group
80
# wc /etc/group
80 80 1150 /etc/group

awk -F: '{if ($4 && $4!=$1) print $1}' /etc/group

bash: enable -a ---shows enables built-in commands; enable -n cd ---turns off built-in cd

nt: ipconfig /displaydns |more ; ipconfig /flushdns

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services|Dnscache\Parameters
DWORD:MaxCacheEntryTtlLimit
Value:14400 ---this is in seconds. 14400 is 4 hours.

hostapd.conf ..

/etc/hostapd.conf:
interface=ath0
bridge=br0
driver=madwifi //generic linux driver is wext
debug=0
ssid=my-net
macaddr_acl=0
auth_algs=3
wpa=1
wpa_psk_file==eth/hostapd_wpa_psk
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP


/etc/hostapd_wpa_psk:
00:00:00:00:00:00 password_for_any_client //all zeros direct to accept all MAC addresses.
11:22:33:44:55:66 waylongpassword
10:20:30:40:50:60 another_password_for_another_client


/etc/wpa_supplicant.conf:
network={
ssid="my-net"
psk="waylongpassword" //it takes time to compute it each time. To save that time use wpa_password to encrypt passphrase, and then copy result into place
pairwise=CCMP //much stronger than RC4 that is default WEP
group=CCMP
ky_mgmt=WPA-PSK

wpa_supplicant -iath0 -c/etc/wpa_supplicant.conf -Dmadwifi -w
to make it permanent on debian and call wpa_supplicant automatically:
/etc/network/interfaces:
auto ath0
iface ath0 inet dhcp
pre-up wpa_supplacant -iath0 -Dmadwifi -Bw -c/etc/wpa_supplicant/wpa_supplicant.conf
post-down killall -q wpa_supplicant

ifcfg-eth: ..

DEVICE=eth
ONBOOT=yes
BOOTPROTO=dhcp
HWADDR=11.22.33.44.55.66
DHCP_HOSTNAME=sergey
TYPE=wireless
PEERDNS=yes
MODE=managed
RATE=auto

dhclient.conf: send-hostname "sergey"

send-hostname "sergey"

Dienstag, 3. November 2009

slaptest

openssl rsa -in slapd-key -pubout>slapd-key.out

awk -F: '{print $1}' /etc/passwd ---the same as cut -f1 -d: /etc/passwd

arptables, ebtables (for ethernet), iptables (for ip), squid (http)

wireless bridge configuration: /etc/network/interfaces ..

auto lo
iface lo inet loopback

auto br0
iface br0 inet static
address 192.168.1.0
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
bridge_ports ath0 eth0
post-down wlanconfig ath0 destroy
pre-up wlanconfig ath9 create wlandev wifi0 wlanmode ap
pre-up iwconfig ath0 essid "alrac-net" channel 01 rate auto
pre-up ifconfig ath0 up
pre-up sleep 3

ls -d .* ---list only hidden files

Montag, 2. November 2009

ls -L ---show i on the linked file, rather than the symbolic link itself

ls -1 ---show only 1 file per line

ls -S ---sort by size

ls -Q ---quote names (GNU extension);

sed: sed '1 i this is first line' file ---adds line 'this is the first line' to the beginning; sed '$ a this is last line' file

mysql postinstall: set password for root@localhost=password('secret'); delete form mysql.user where user=''; delete from mysql.db where user=''..

Grant select on *.*to sergey@localhost identified by'secret';
OR
grant all on db1.*to serega@localhost identified by 'great_secret';

mysql: select user,host from mysql.user;

mysql: mysqladmin -u root shutdown

slapd.conf: loglevel 296 --- -1 all loging information, 0 - no logging i, 1-trace function calls; 2 -packet handling debugging i; 4- heavy trace deb..

8 - connection management
32 -search filter processing
64 - configuration file processing
128 - access control list processing
256 - statistics for connection, operations, and results
512 - statistics for results returned to clients
1024 - communication with shell backends
2048 - print entry debug information

All i is loggedusing the LOG_LEVEL4 syslog facility.
Add the following to /etc/rsyslog.conf and killall -HUP syslogd
local4.debug /var/log/slapd.log

postfix: postconf -e "mynetworks = 192.168.1.0/24, 127.0.0.1/8"

host -t mx mail.ru

postfix: postconf -e "relayhost = mailhub.example.com" -- the changes take force immediately

mutt: set folder="imaps://username@example.com" set spoolfile="imaps://username@example.com/INBOX" If you don’t feel like typing in your password every time you can also put it there: set imap_pass="mypassword" Also, my favorite line which disables that annoying Mutt prompt that asks if you want to move the read mail messages: set mbox="!"

ssh: Host is anything and hostname is the real name

Host Short_Name
HostName some_host.com
User domain\username
Protocol 2
UseRsh no
IdentityFile ~/.ssh/KEY