Linux

Linux related. Random bits to remember.


Amavisd-new – release items from MySQL quarantine

A crude way to release e-mails from amavisd-new quarantine.
As amavisd-release works well for file based quarantines, but sometimes just a plain telnet is all You’ve got.
First find email id from logs. Something like ChRQj9iij3-V is probably ok. Then more data can be found from MySQL, where msgs is a table in standard amavisd-new MySQL schema.… Read the rest


Rebuilding failed drive in linux md raid

A drive in an Linux md raid array is failed and replaced. As md raid will not rebuild your array by itself something needs to be done. Using mdadm, it goes like this: mdadm - -add /dev/mdX /dev/sdaY where /dev/mdX is the array that has a failed member, and /dev/sdaX is a partition that needs to be added. /dev/sda needs to be partitioned before though. Then it is only a matter of time to see Your arrays being syncronized. watch -n1 'cat /proc/mdstat' That array can be in use during that syncronization process.

Data Copy Over SSH 2

Need to transer a whole disk image to another computer over SSH? Just: dd if=/dev/sda | ssh user@host "dd of=/directory/imagefile" or with compression: dd if=/dev/sda | bzip2 |ssh user@host "dd of=/directory/imagefile" or with compression on the receiving side: dd if=/dev/sda | ssh user@host "bzip2 | dd of=/directory/imagefile" This example can be expanded easily as: cat filename |ssh user@host "dd of=/directory/filename" also works quite fine.

KDE autologin

KDE autologin with KDE 3.5 can be done either manually or by KDE Control Center. In control center: KDE Control Center -> System Administration -> Login Manager -> Convenience Click administrator mode below and enter root password. After that 'Enable Auto-Login' is not grayed out any more. Manually: Edit kdmrc. kdmrc can be found as locate kdmrc if slocate is installed and database is up to date. In Gentoo and KDE 3.5 it is in /usr/kde/3.5/share/config/kdm/kdmrc

SSH Port Forwarding

It is actually really simple and well documented. You have a host You want to connect to, but it is behind a linux (anything that has ssh server running on should do) box. What You need to run is something like this ssh -L 3387:192.168.0.10:3389 -l user -N ssh_box on Your local client machine. 3387 - local port to use 192.168.0.10 - remote server where that service is running You need to connect to 3389 - the TCP port that remote service is running on user - ssh username of course ssh_box - ssh server Your service is behind of.

SSH Keepalive

Isn't it frustrating when You start up a SSH session and it times out. Usually at the worst possible moment. Using screen is good, but it comes to ones mind always after that dreadful timeout. OpenSSH supports a thng called keepalive - a keepalive packet is sent after a predetermined interval of inactivity so SSH sessions should not time out. Keepalive can be set on server side or client side. Client side is usually better because then all possible connections are kept alive. Client side: edit /etc/ssh/ssh_config and enable