May 22
  1. setup vmware tools on your guest OS
  2. on the Host OS, go into the .vmx file for your virtual server and add or edit:

           tools.syncTime = “TRUE”
           time.synchronize.continue = “TRUE”

written by MG \\ tags: ,

May 19

By default, Iptables log message to a /var/log/messages file. However you can change this location. I will show you how to create a new logfile called /var/log/iptables.log. Changing or using a new file allows you to create better statistics and/or allows you to analyze the attacks.

Procedure to log the iptables messages to a different log file

Open your /etc/syslog.conf file:
# vi /etc/syslog.conf
Append following line
kern.warning /var/log/iptables.log

Save and close the file.

Restart the syslogd (Debian / Ubuntu Linux):

# /etc/init.d/sysklogd restart

On the other hand, use following command to restart syslogd under Red Hat/Cent OS/Fedora Core Linux:

# /etc/init.d/syslog restart

Continue reading »

written by MG \\ tags: , ,

May 19

Plesk disables the ‘root’ account when Plesk is installed. To get root privileges please login with the ‘admin’ username. The password is the same as the admin’s password in Plesk.

You can find it in /etc/psa/.psa.shadow.

written by MG \\ tags: ,

May 14

First you must create your VPN connection in Windows (XP, 2000 or later) using the standard wizard thingy Windows provides. Let’s say your connection is named “My vpn”.

I assumed that my intranet is giving me an address always starting with “192.168.100”  and I want to add route to 10.10.10.0/24 to my VPN gateway.

Now let’s start our script in a .bat file:

@rasdial /disconnect
@rasdial “My vpn” “MyUser” “MyPassword”
@setlocal
@for /f “tokens=1-2 delims=:” %%i in (‘ipconfig ^| find “IP Address” ^| find “192.168.100”‘) do set GETIP=%%j
@route add 10.10.10.0 mask 255.255.255.0 %GetIp%
@endlocal

After you’re done creating the .bat file, simply create a shortcut to it and put it on your desktop. This way you can doubleclick it, connect and start surfing your Intranet

written by MG \\ tags: ,

May 09
  1. Logged in as root, check which timezone your machine is currently using by executing `date`. You’ll see something like Mon 17 Jan 2005 13:19:11 PM PST, PST in this case is the current timezone.
  2. Change to the directory /usr/share/zoneinfo here you will find a list of time zone regions. Choose the most appropriate region, if you live in Romania this directory is the “Europe” directory.
  3. If you wish, backup the previous timezone configuration by copying it to a different location. Such as
    mv /etc/localtime  /etc/localtime-old
  4. Copy file with your zone to /etc/localtime .

written by MG \\ tags: , ,

May 07

Securely delete a file called /tmp/login.txt:

shred -u /tmp/login.txt

You can add a final overwrite with zeros to hide shredding:

shred -u -x /tmp/login.txt

 Where,

  • -u : Remove file after overwriting
  • -x : Add a zero to hide shredding
  • -n NUM : Overwrite NUM times instead of the default 25

 

Shred a multiple files

Let us say you have 100 subdirectories and just wanted to get rid of all files:

 find -t f . -exec shred -u '{}' \;

Run shred on entire partition

shred -n 30 -vz /dev/hdb2

written by MG \\ tags: , , , ,

May 07

#!/bin/bash
HOME_BASE=”/home/”  #set your home base directory
SHELL=”/bin/bash”  #set shell for users

#checking if you are root
if [ $(id -u) -eq 0 ]; then

read -p “Username:” USER
read -s -p “Password:” PASSWORD

egrep -w “^$USER” /etc/passwd >/dev/null
if [ $? -eq 0 ]; then
    echo -e “\n$USER exists!\n”
    exit 1
else
    PASS=$(perl -e ‘print crypt($ARGV[0], “password”)’ $PASSWORD)
    useradd -p ${PASS} -s $SHELL -m -d ${HOME_BASE}${USER} ${USER}
    [ $? -eq 0 ] && echo -e “\nUser has been added to system!\n” || echo -e “\nFailed to add a user!\n”
fi

else
    echo -e “\nOnly root may add a user to the system\n”
    exit 2
fi

save it like script.sh and run it with: ./script.sh

written by MG \\ tags: , , , ,