By default, Sendmail will reject or bounce any incoming email addressed to users who doesn’t exist as real users or as aliases in the system. If you wish to setup Sendmail to accept all incoming email and redirect it to a recycle bin, you may follow the steps below: –

1. Backup your /etc/mail/sendmail.mc and /etc/mail/sendmail.cf

2. Add the following line at the end of this /etc/mail/sendmail.mc file: –
define(`LUSER_RELAY', `local:nosuchuser')dnl

3. Then, you must run the m4 as below: –
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

4. Add the following line in /etc/aliases file: –
nosuchuser: /dev/null

5. Finally, run the newaliases as below: –
newaliases

If you found these helpful, please contribute to help:

Yesterday, I bumped into this website system76 and found out that they are giving out free ‘powered by Ubuntu’ stickers.

Show your Ubuntu pride!!! Get FREE strip of four ‘powered by Ubuntu’ stickers from this link below: –

http://system76.com/index.php/cPath/53_64

Hurry up…before they are out of stock. I am going to send them a snail mail, 😀

To list open program listening port as well as what program is running and the connection, run the following command: –

lsof -i :22

Output of the command: –

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
sshd 1468 root 3u IPv4 1626 TCP *:ssh (LISTEN)
sshd 1900 root 4u IPv4 487285 TCP 192.168.1.1:ssh->192.168.1.2:2986 (ESTABLISHED)

To list all open program listening port, run the following command: –

lsof | grep LISTEN

Output of the command: –

sshd 2071 root 3u IPv6 6511 TCP *:ssh (LISTEN)
sendmail 2111 root 4u IPv4 6671 TCP localhost.localdomain:smtp (LISTEN)

While reading on some blogger’s blog, found this cool tips and tricks, it is pretty interesting. Thumbs up to geek00L :)

It is very useful for copying a large file. This command below will show you the copy progress and it will not see it with a cp command.

rsync --progress -v SRC DST

Below is a first example: –

[root@localhost root]# rsync --progress -v someimage.img.gz /tmp
someimage.img.gz
63780138 100% 53.23MB/s 0:00:01
wrote 63788015 bytes read 36 bytes 42525367.33 bytes/sec
total size is 63780138 speedup is 1.00

If you would like more stats, below is a second example: –

[root@localhost root]# rsync --progress --stats -v someimage.img.gz /tmp
someimage.img.gz
63780138 100% 77.74MB/s 0:00:00
rsync[1579] (server receiver) heap statistics:
arena: 135168 (bytes from sbrk)
ordblks: 1 (chunks not in use)
smblks: 0
hblks: 0 (chunks from mmap)
hblkhd: 0 (bytes from mmap)
usmblks: 0
fsmblks: 0
uordblks: 41624 (bytes used)
fordblks: 93544 (bytes free)
keepcost: 93544 (bytes in releasable chunk)
rsync[1577] (sender) heap statistics:
arena: 135168 (bytes from sbrk)
ordblks: 2 (chunks not in use)
smblks: 2
hblks: 0 (chunks from mmap)
hblkhd: 0 (bytes from mmap)
usmblks: 0
fsmblks: 80
uordblks: 37520 (bytes used)
fordblks: 97648 (bytes free)
keepcost: 93552 (bytes in releasable chunk)

Number of files: 1
Number of files transferred: 1
Total file size: 63780138 bytes
Total transferred file size: 63780138 bytes
Literal data: 63780138 bytes
Matched data: 0 bytes
File list size: 41
Total bytes written: 63788015
Total bytes read: 36

wrote 63788015 bytes read 36 bytes 42525367.33 bytes/sec
total size is 63780138 speedup is 1.00

Yesterday, I learned this tips and tricks from my colleague Danesh (or Danny). Thank you. His blog The Danesh Project

You can duplicate a current SSH session without login again…this is awesome and fast, :)

You need to add the following 2 lines below into your /etc/ssh/ssh_config file: –

ControlMaster auto
ControlPath ~/.ssh/socket-%r@%h:%p

You need to login into a remote SSH server for the first time, the SSH session will create a socket file at ~/.ssh folder indicating a login name, host and port.

ssh root@remotehost

Below is the SSH session socket file created: –

socket-root@remotehost:22

After that, you can duplicate the SSH session by just executing a same SSH command you did for the first login and this time there is no password prompt. You will login into the remote host directly.

This tips and tricks only works on OpenSSH 4.0 above. I had tried it on RHEL 3 (not working), RHEL 4 (not working) and CentOS 5 (working).