web analytics

Author Archive

Tailing a log file over http with netcat – nc

Written by config on . Posted in Linux, Various

Advertisement

Use this one to watch log files updates in real time on remote server using netcat and a browser.

tail -f /var/log/syslog | nc -l 1234

You can also use it to monitor any frequently updated file on remote system.

Mirror websites with lftp

Written by config on . Posted in Linux, Ubuntu

There are lots of methods to mirror websites, you could use tons of Gui tools or just use Curl, wget or httrack. But as usual with linux there is a simpler and/or “better” method – lftp. It works great for mirroring Apache directory listings.

Try this next time you want to mirror a website:

lftp -e "mirror -c" http://greatdomain.com/somedir/

oh and if there is “command not found” after you try it then:

for Debian based systems ( like ubuntu or debian itself )

sudo apt-get install lftp 

for Rpm based ( like Centos or Fedora )

yum install lftp

for Mac OSX you could use MacPorts – http://www.macports.org

iStat Menus 2.0 beta for Snow Leopard

Written by config on . Posted in Mac OSX

Great news for all iStat Menus fans, someone posted their 2.0 beta release for Snow Leopard Online.
Here is the link, enjoy:
http://drop.io/ps2akxf9155/asset/istat-menus-installer-zip
Program seems to be stable and working great on Snow Leopard Retail with 32 bit Kernel

update:
Here is direct link to developers site:
http://islayer.com/files/istatmenus2/istatmenus_build111.zip

this one works too but its the same build 111 despite 112 in the given file name:
http://islayer.com/files/istatmenus2/istatmenus_build112.zip

enjoy and try to change the build number in the url in the next couple of days 😉

update 2
Another link in case you cannot download it from the links above ( someone took his time and uploaded this to rapidshare ):
http://rapidshare.com/files/273844550/iStat_Menus_Installer.zip

update 3 ( hope its final 🙂 )
This is another link from islayer / bjango for the latest build of istat menus 2.0 beta for Snow Leopard 10.6:
http://islayer.com/apps/istatmenus/getupdate/

Right now it redirects to build 114 of iStat Menus 2.0, hopefully after the beta – same link will redirect to final.

Final update
iSlayer / Bjango finally release iStat Menus 2.0, here is the link to download:
http://www.islayer.com/apps/istatmenus/download/

Mac OS X 10.6 Snow Leopard 10A432 Gold Master RTM

Written by config on . Posted in Mac OSX

Seems like build 10A432 is the Gold Master of Mac OS X 10.6 Snow Leopard from Apple. This build will be soon released to manufacturers and probably will leak on the torrent trackers and sites. Several sources confirmed this rumor to popular mac rumor websites such as macrumors.com.
Mac OS X 10.6 Snow Leopard will be released on September and will be cost 29$ to upgrade for all Mac OS X 10. Leopard users.
This will be the first Apple operating system running 64 bit kernel.

Plesk for Linux – Fixing .htaccess pcfg_openfile error – permission fix

Written by config on . Posted in Linux, Ubuntu

Problem with directory / files permissions after installing some software on your Plesk Linux server ( Nagios for example known to cause this in certain scenarios ).

From /var/www/vhosts/domain.com/statistics/logs/error_log :

[critical] [client 192.168.0.13] (13)Permission
denied: /var/www/vhosts/domain.com/httpdocs/.htaccess pcfg_openfile:
unable to check htaccess file, ensure it is readable

You will see Forbidden Error in your browser.

If you check the mentioned location you will notice that .htaccess file is probably not even there. Creating it and giving it the correct permissions won’t help of course.

In our case permissions set wrong on the httpdocs / httpsdocs directory itself.
Try this to fix:

cd /var/www/vhosts/domain.com/
chmod 755 httpdocs
chmod 755 httpsdocs

You don’t have to set the permissions to 755 as 751 for example will work as well. Play with the permissions on httpdocs to find the suitable solution.

Plesk for Linux – Disabling mod_security rules for specific directory

Written by config on . Posted in Linux, Ubuntu

If you are working with Plesk Control Panel ( Linux version ) and mod security – you probably encountered some problems with specific scripts. Sometimes mod security block certain functions of the script because it thinks it is malicious code.

For example this warning taken from Apache log:

Warning. Match of "rx ^apache.*perl" against "REQUEST_HEADERS:User-Agent" required. [file "/etc/httpd/conf.d/modsecurity/modsecurity_crs_35_bad_robots.conf"] [line "27"] [id "990011"]

Lets say you want to leave mod_security as it is without removing it or disabling on the server, what you want to do is to disable this specific rule (“990011”) for the specific directory in the domain and let your scripts work as it should.
Here is a quick solution.

Create a file called vhost.conf in /var/www/vhosts/domain.com/conf
containing the following:

<Directory /var/www/vhosts/domain.com/httpdocs> SecRuleRemoveByID 990011 </Directory>

Then run this in terminal:

/usr/local/psa/admin/bin/websrvmng -u --vhost-name=domain.com
service httpd restart

This is specific to Redhat/Centos.
If you cannot find websrvmng in the mentioned path you can try:

updatedb
locate websrvmng

Also pay attention that if you use Debian and Ubuntu or their derivatives, you cannot use the service command and your apache is not httpd.
Try to use

/etc/init.d/apache2 restart

Batch adding multiple ip addresses to Windows server with netsh

Written by config on . Posted in Windows

Ever wanted to add 200 ip addresses to Windows Server with one command instead of manually configure it on the interface? Netsh will help you to save time.
You can use this quick batch command in cmd:

FOR /L %I IN (2,1,254) DO netsh interface ip add address "Local Area Connection" 10.0.0.%I 255.255.255.0

This example will add ip addresses from 10.0.0.2 to 10.0.0.254 with 1 step each time.
You can play with this example and change the place of %I to say add ip addresses from 10.0.1.1 to 10.0.200.1 and so on.
Do not forget to change the name of the interface ("Local Area Connection") to the exact name of the interface you would like to use.

Grub2, problem booting after kernel update

Written by config on . Posted in Linux, Ubuntu

If you are using grub2 ( arch linux or ubuntu 9.10 karmic koala ) you might notice some problems after kernel updates.

Symptoms – System won’t boot and you will get error similar to this:

Error – you need to load the linux kernel first.

Quick solution would be to boot from Arch / Ubuntu CD and go to recovery, mount your boot partition and get root shell ( You usually got all this in Ubuntu recovery menus, in Arch you might wanna use the shell 😉 . Go to /boot/grub and edit device.map ( what probably went wrong is that your hdd definition changed in this file and its currently trying to boot from wrong drive ). In my case changing /dev/sda to /dev/sdb  solved the problem. Do not forget to run update-grub2 to re create grub.cfg and reboot. Your system should boot as usual 🙂

Ubuntu 9.10 Karmic Koala Alpha – Ctrl+c in ssh terminal

Written by config on . Posted in Linux, Ubuntu

Seems like Ubuntu dev folks decided to change some functionality of the Ctrl-c shortcut so now it is copy function instead of break.

Anyway there is a bug open here: https://bugs.launchpad.net/ubuntu/+bug/402973

My install is ( lsb_release -a ):

Description:    Ubuntu karmic (development branch)
Release:        9.10

uname -a ( date and time stripped )

Linux psy-srv 2.6.31-3-generic-pae #19-Ubuntu SMP i686 GNU/Linux

Its Alpha 3 of Ubuntu Karmic Koala Server release.

Report the annonying bug !

How to open CLI to VMware ESXi. How to Clone Virtual Machines.

Written by config on . Posted in Linux

ESXi Commands

You can access the CLI by switching to terminal 1 using Alt-F1.
Now type “unsupported”, This is not echoed so you won’t see anything. If you get it right, you will get a prompt asking for the root pasword.

( This might not work in ESXi 4.0 as VMWare is trying to limit ESXi for their own corporate reasons )

That drops you at a shell prompt. (ash is our shell).
Hint: editor = vi

Now you can you modify /etc/inetd.conf and uncomment the ssh line so that you can ssh into it unless you are planning always being at the console.
Reboot (init 6)

Cloning Virtual machines in ESXi

vmkfs tools -i /vmfs/volumes/datastore/YourVM/YourVM.vmdk /vmfs/volumes/datastore/NewVM/newvm.vmdk
vim-cmd vmsvc/getallvms
vim-cmd vmsvc/power.reset xx

check out these ( with vim-cmd vmsvc/command ):

power.off
power.on
power.reboot
power.reset
power.shutdown
power.suspend

esxtop = is your top tool