Tag: linux
Disable local email delivery on hosted domains
by z3n on Sep.04, 2010, under Linux Happyness
Problem:
There’s some domains on a server that users a external server to process the emails (eg. google servers, aspmx.l.google.com) those emails are all fine when sent from outside the box but when sent from the box they fail to reach the destination or get delivered to a local user.
Solution:
define(`MAIL_HUB', `example.com.')dnl define(`LOCAL_RELAY', `example.com.')dnl
For sendmail, this will make the domain’s emails to be delivered to the ip address assigned at the domain’s MX record.
Note:
This seemed promising for me at first look, but it will redirect ALL local domains to this MX record, ruining everything. Nothing new when dealing with sendmail, anyway when i find a better solution for this i will update this post again.
Source:
How to find disk UUID
by z3n on Jul.05, 2010, under Linux Happyness, Tips & Hints
Problem:
I wanted to change the default mounts at /etc/fstab, but i couldn’t find the disks UUID.
Solution:
blkid /dev/DEVNAME
How to figure out how many sectors a disk has on linux
by z3n on Jul.05, 2010, under Linux Happyness
Problem:
How to find out the absolute count of sectors on a disk at linux?
Solution:
hdparm /dev/YOURDEV
How to clone a disk on linux
by z3n on Jul.05, 2010, under Linux Happyness
Problem:
How to do a 1:1 copy of a disk on linux?
Solution:
dd bs=4k if=/dev/SOURCE of=/dev/DESTINATION conv=noerror,sync
Make sure you know which one is the source and destination in order to avoid catastrophic fail.
Source:
How to scroll on a bash screen
by z3n on May.25, 2010, under Notes, Tips & Hints
Problem:
It’s so cool to have many screens at bash, but i never figured out how to scroll up on them, somehow i never looked after as well.
Solution:
CTRL + A -> ESC -> PAGE UP / PAGE DOWN
Source:
Find dependencies of a rpm with yum
by z3n on May.08, 2010, under Coding, Linux Happyness, Tips & Hints
Problem:
While installing virtualbox on my server i found out that it had a hell of deps, which i can’t seem to find.
Solution:
Search around i found out that yum is able to find and install deps off a rpm, like this:
yum localinstall --nogpgcheck VirtualBox-2.1.2_41885_fedora9-1.i386.rpm
umount note
by z3n on Apr.20, 2010, under Linux Happyness, Tips & Hints
I had to umount a drive but it wasn’t working, not even with -f (force) option.
So i looked man pages and found out about lazy option (-l) which solved the issue;
umount -l /path/to/mount/point
Port Scan on Linux
by z3n on Jan.11, 2010, under Uncategorized
Problem:
How to do a port scan on a specific ip/hostname on linux?
Solution:
nc -z <ip> <port-range>
eg.: nc -z 127.0.0.1 1-1024
Source:
ssh timeout fix
by z3n on Dec.25, 2009, under Linux Happyness
Problem:
When using regular linux ssh it keeps timeouting or simply freezes when no inputs/outputs happen.
Solution:
Usually ssh has a TCP keep alive switch which you can enable to avoid this, although depending on your router and other network odds this might not help, also you may need to send keep alives in a shorter time than what’s the default of ssh. So, in order to have this working you need to edit /etc/ssh/ssh_config adding this to Host *, assuming you want to have this settings globally for every host.
ServerAliveInterval 60
ServerAliveCountMax 99999999999999
Why so many 9’s? There’s no way to do a endless keep alive, if you put 0 it will just drop the connection after the first keep alive, -1 is invalid, so we go high…….
(just) Find in files (bash)
by z3n on Dec.09, 2009, under Linux Happyness, Tips & Hints
Problem:
Need to search for a string in many files and return the filenames.
Solution:
find -depth -name *.file_extension | xargs grep -sl “string“