Networking In vmware guest Linux… best practice

At times when you need to assign a fixed static ip for your guest Linux on Vmware,

Open VMware and the guest OS
Point to the bottom right corner and click on Network Adapter (NAT)
Choose settings> and follow as in the pic below:
click on the picture to enlarge it.
vmware networking

Now goto linux command prompt and configure your network to be static.
Restart your linux network.
You should be all set now. There were some instances when you needed to restart your VMware in case it does not work.
For info on setting up a network in linux with a static Ip, look for my other post.


Send email from command line using gmail and ssmtp

This is a very good tool i use to email me of any notifications on my centos box. Plus i use it to send emails when i am working on command line.

If you havent already installed the EPEL i386 Repo, then do
# rpm -Uvh

# yum remove sendmail (optional)
# yum install ssmtp

Now, configure the ssmtp.conf file:
# vi /etc/ssmtp/ssmtp.conf
AuthPass=(your – password)

# service sendmail stop ( if not removed above)
# chkconfig sendmail off (if not removed above)
# mkdir /root/.backup
# mv /usr/sbin/sendmail /root/.backup/
# whereis ssmtp
ssmtp: /usr/sbin/ssmtp /etc/ssmtp /usr/share/man/man8/ssmtp.8.gz
# ln -s /usr/sbin/ssmtp /usr/sbin/sendmail
# echo “This is a test email” | mail -s “Test”
This will send an email to …..
You can use this on a script,cron and any log messages now to make the centos box email you the issues…. comment on any help needed.

run automatic backup on usb as soon as it’s plugged in

[root@saurap /]# cat /proc/scsi/usb-storage/*
Host scsi27: usb-storage
Vendor: Sony
Product: Storage Media
Serial Number: 2A07060549833
Protocol: Transparent SCSI
Transport: Bulk

[root@saurap saurap]# vi /etc/udev/rules.d/pendrive.rules
#BUS=”usb”, SYSFS{serial}=”2A07060549833″, SYMLINK=”Storage\ Media”, RUN+=”/home/saurap/”
SUBSYSTEMS==”usb”, ATTRS{serial}==”2A07060549833″, SYMLINK+=”Storage”, RUN+=”/home/saurap/”

Then create the script for backup as

mount /dev/sdb1 /media/PEN
sleep 3
rsync -zvr /home/saurap/Desktop/mine/ /media/PEN/backup