This blog post deals with VPNC (http://www.unix-ag.uni-kl.de/~massar/vpnc/) : an alternative to Cisco’s linux version client.  If you happy with cisco’s client and were able to install it successfully then you can skip the rest of the blog. 

Most of the information can be found at original sources http://wiki.centos.org/AdditionalResources/Repositories/RPMForge  and http://wiki.centos.org/HowTos/vpnc 

Only issue you might face is installing yum prorities using yum. That is broken in CentOS 5.3 (atleast til I tried). So here are the steps involved. 

1) Install Yum Prorities

Install prorities using rpm instead of yum.

wget http://mirror.centos.org/centos-5/5.3/os/i386/CentOS/yum-priorities-1.1.16-13.el5.centos.noarch.rpm    
rpm -ivh yum-priorities-1.1.16-13.el5.centos.noarch.rpm
                     
2) Check if plugin is enabled (see http://wiki.centos.org/AdditionalResources/Repositories/RPMForge for details)

nano /etc/yum/pluginconf.d/priorities.conf

3) Update Proirities for repo files

nano /etc/yum.repos.d/CentOS-Base.repo

4) Install rpm forge

wget http://apt.sw.be/redhat/el5/en/x86_64/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
rpm -i rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

5) Update prority for rpmforge repo file

nano /etc/yum.repos.d/rpmforge.repo

6) Update yum to start using priorirites and rpmforge as source.

yum check-update

7) install VPNC

yum -y install vpnc

Now vpnc is installed.  Follow http://wiki.centos.org/HowTos/vpnc to know how to use it.

Advertisements

Task:   Need to write a unix/linux shell script which moves Files from One Folder to Another Folder once a day (Say at midnight). Also set permissions for newly moved files accordingly.

Step 1:   Write a Shell Script to do moving and set permissions

#!/bin/sh
mv /home/a/* /home/b/
chown nobody:nobody /home/b/*

Here I want to move files from “/home/a/”  to “/home/b”  and set permissions to nobody so that PHP running on Apache can do work on them.  I saved the script as “/home/myscript.sh”

Step 2:   Make the script an Executable

$ chmod +x myscript.sh

Step 3:   Run at mid night  every day by adding to Cron Job

a)  Edit Current Cronjob

$ crontab -e

Then  add your script entry there (works same as VI editor.. use i to go to edit mode). I am actually setting at 11.59 PM..

59 23 * * * /home/myscript.sh

b) Save cron job by exiting (using Shift+zz)

c)  Check to see cron job is set

$ crontab -l

That’s It!

Problem : How to access my files on Linux Box from my Windows XP pc. But I dont anyone else access those.

Step 1: On Linux Box

a) Install Samba Server (If not installed)

Start Package Manager by going to Applications -> Add/Remove programs

Choose “Servers” and make sure “Windows File Server” is checked. If not check and Click Apply. It will download and install samba and dependencies.

b) Configure Samba

Launch Samba Configuration screen

System ->  Adminstration -> Server Settings -> Samba

Then that screen

Preferences -> Server Settings

In ‘Basic’ , Section choose a unique name for your share

In ‘Security’ Section  choose  ‘User’ and make sure ‘Encrypt Password’ is’Yes’ and ‘Guest Account’ is ‘No Guest Account’. There are usualy default options already selected

Then  ‘Preferences’ -> Samba Users

Here select your linux system user name and choose a username for windows ( I chose same name as linux user but its upto you… say you choose linux user is ‘bob’ and name given for windows user name  is ‘David’ and password is say ‘ Hillary’….. this passwor NEED NOT be your linux password or any other password you use on windows…its just a password for this share for David……)

c) Now add a ShareIn Samba Server Configuration Screen ,  Select ‘Add Share’ and Choose directory you want to access from windows…. and give a some description…….

Then  in Access Tab, select “Only allow access” to ‘David’

d) Now Start Samba Server

Launch Services Configuration by selecting

System–> Administration –> ServerSettings -> Services

In lefthand side, make sure to check ‘smb”… it would start the smb and other required services

e)  Change Firewall Setting to allow Samba to be accessed

Launch firewall settings by selecting

Sytem -> Administation -> Security Level and Firewall

Then in trusted Services, Select ‘Samba’ and click Ok

Step 2: On Windows Box

Now access you share using VNC name……   \\yourlinuxboxname or IP\  it prompts you for userid password…..   use ‘David’ and ‘Hillary’……  thats it!