Limiting access iptables

This is a Script that I use to deploy and script iptables. Sample handles ssh and mysql it’s easy to extend. #!/bin/bash # # iptables example configuration script # # Flush all current rules from iptables # iptables -F # # Allow SSH connections on tcp port 22 # This is essential when working on…

Starting vnc on Display 0 ( local display ) from a remote ssh session

i.e. You wnet home need your desktop have ssh no vnc !! Here is the easy solution.. Install x11vnc. $ DISPLAY=localhost:0 x11vnc & connect to the display using vnc et voila ! BTW Teamviewer also USED TO WORK but no longer in ver 8 so thanks VNC for not being obsolete.. nJoy 🙂  

Monitoring a bottleneck with strace

If let’s say Mysql is slow at performing a task you can check what is the bottleneck using strace to attach to the process. <span style="color: #00ff00;">$ ps -ef|grep -i mysql</span> Identify the process id then <span style="color: #00ff00;">$ strace -cp &lt;pid&gt;</span> Leave it 10 seconds or a minute then ^C. That will tell you where…

Start Teamviewer from an ssh session remotely

So you remote deskptop rebooted and teamviewer did not run on startup as it does not do in Linux for some strange reason: Connect with ssh ( putty) Then run DISPLAY=`localhost`:0 teamviewer& Njoy 🙂 !

Enable VMWare time sync from command line

Virtual machines and NTP do not go easily well together. Machines paused for extended periods tend to loose the ntp sync since the difference grows too much.   Also from VMware Docs the following info might be clarificatory: Do not configure the virtual machine to synchronize to its own (virtual) hardware clock, not even as…

One Liner to test php sending mail from a bash script

To check if your php installation can successfully send emails from a bash script try this :  php -r ‘var_dump(mail(“david.saliba@testemail.com”, “test subject”, “test body”));’ Thanks Gareth ! nJoy 🙂 !

How to add a disk to LVM

Suppose the Disk is /dev/sdb, the second scsi disk, fdisk /dev/sdb create as many partitions as you need using command n Label them with command t as 8e for making it Linux LVM Write and Exit with the command w. Format the partitions you require using mkfs command mkfs -t ext3 -c /dev/sdb1 LVM commands…