Kurinchi Blogger Scribbles …


Archive for August, 2009

Aug 13
2009

Mount, Read, Write, Access USB Flash Drive in Ubuntu

Last updated: August 10th, 2009

How to access USB Flash Drive?

To know the drives and their partition you need to execute
# fdisk -l

Another option is to list the last 5 entries from /dev to know what devices got attached
$ ls -ltr /dev | tail

And another option is to use the lsusb command.

USB Flash drive will normally be listed down as /dev/sdb1
(more…)

Aug 12
2009

su vs. sudo

Last updated: August 11th, 2009

The help pages state …

su – run a shell with substitute user and group id’s
sudo – execute a command as another user (or root)

When ‘sudo‘ is used with a command, the command gets executed with privileges set for the user and the group she belongs to. If a password is required and if it is given initially, the session will be valid depending on the time set for each session and the user needn’t have to type the password within that duration. /etc/sudoers is the location where permission settings for sudoers are being set.
(more…)

Aug 11
2009

CakePHP – Bake Process

Last updated: August 10th, 2009

CakePHP Steps involved in Baking Scripts:

i) Setup cakephp by ensuring that there is no warning message in the index page after initial installation. (for this you need to change salt value in /app/config/core.php, enable /app/config/database.php)

ii) Create a database and a user for the database. After this apply the database configuration parameters to /app/config/database.php

If you are running the bake for the first time, it will ask you to create database configuration for the first time.

iii) Ensure that the path or the environment variable is set with access to PHP, MySQL executables

c:/> PATH or $ echo $PATH
(more…)

Aug 10
2009

Configuring postfix to send mail via satellite system

Last updated: August 6th, 2009

Step 1: $ sudo apt-get install postfix

Postfix configuration screen throws you with the following options to choose from
i) No changes (no changes to configuration settings)
ii) Internet site (Mail sent and received using SMTP)
iii) Internet with smarthost (Mail sent to another machine called smarthost)
iV) Satellite system (All mail sent to another machine for delivery)
v) Local only (No network based mail system. Only applied to this local machine)
(more…)

Aug 09
2009

Session Poisoning, Cookie Poisoning

Last updated: August 4th, 2009

Session poisoning or Session Pollution is a term used to refer to security exploit when an invalidated input is assigned to session variables which then gets carried over to other pages opening the supposed to be secured pages to outside world.

It can also refer to a state when more than one application shares the same session variable which when modified without necessary validation causes a race condition.

There is a possibility for an attack or a session hijack when the external agent gets control over the session variable used by victim on the server. Both the agent and the victim needs to have access on the same server for such attacks to take place.

When the same scenario happens on the cookie variables, it is called cookie poisoning.

Precaution to avoid such hijacks are to validate each condition if a cookie or a session is shared or if values are assigned to session or cookies. In such cases, it is also advisable to use a secured transaction path to avoid such attacks.

Aug 08
2009

How to hide Apache version, Modules loaded, PHP Version?

Last updated: August 4th, 2009

It is often advisable not to disclose information than is necessary when web request are made to Apache server.

By default, Apache displays the version of the server, modules loaded in the server and the version of PHP if PHP is configured with Apache.

In httpd.conf file, set the following directives.

ServerSignature Off
ServerTokens ProductOnly

By default, ServerSignature is set to Off and ServerTokens is set to Full in most Linux distros.

Aug 07
2009

How to find the version of Apache?

Last updated: August 1st, 2009

In ubuntu, it is

$ apache2 -v

In CentOS, it is

$ httpd -v

To find out where apache2 or httpd program is installed you can do the
$ whereis apache2 or,
$ locate httpd

Aug 06
2009

How to burn ISO image from Ubuntu Command Line?

Last updated: August 4th, 2009

First list down the CD/DVD devices connected to your machine and find the device name. Some of the tools that comes handy in an Ubuntu machine are ‘wodim’, ‘genisoimage’

Wodim stands for Write Data to Optical Disk Media. If you don’t have the software installed in your Ubuntu release do an apt-get

$ apt-get install wodim

To know more about wodim and its parameter definition try man on wodim

To list the CD/DVD devices on the machine, issue

$ wodim –devices

wodim: Overview of accessible drives (2 found) :
————————————————————————-
0 dev=’/dev/scd0′ rwrw– : ‘HL-DT-ST’ ‘CD-RW GCE-8481B’
1 dev=’/dev/scd1′ rwrw– : ‘HL-DT-ST’ ‘DVD-ROM GDR8161B’

Our read-write CD device is in /dev/scd0. So our command for burning the .iso image

$ wodim dev=/dev/scd0 driveropts=burnfree -v -data ubuntu8desktop.iso

To burn audio files

$ wodim dev=/dev/scd0 driveropts=burnfree -v -audio one.wav two.wav three.wav

Further read
i) ubuntu guide http://ubuntuguide.org/wiki/Ubuntu:Feisty/CDDVDBurning

ii) ubuntu site https://help.ubuntu.com/community/CdDvd/Burning

Aug 05
2009

Ubuntu Hardy Heron, CakePHP Setting in Virtual Host Environment

Last updated: July 30th, 2009

If you are to setup CakePHP in a virtual hosting environment, we need to ensure that the DocumentRoot is setup correctly. Based on the experience I have had I thought to list down the virtual host setting and cakephp .htaccess setting files.

root@myserver:/etc/apache2/conf.d# cat vhosts.conf
NameVirtualHost 192.168.1.100:80

<VirtualHost 192.168.1.100:80>
ServerName cakeapp
DocumentRoot /var/www/cakeapp
</VirtualHost>

(Note that there is no ending forward slash after /var/www/cakeapp. If there had been one, it might cause a problem if the /var/www/cakeapp/app/config/routes.php is not configured correctly indicating a never ending loop in resolving domain name)

root@myserver:/etc/apache2/conf.d# cat /var/www/cakeapp/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>

Aug 04
2009

Ubuntu, Apache: Virtual Hosting

Last updated: August 4th, 2009

Virtual Hosting in Ubuntu Hardy Heron: Case Example

Consider the case of two domain names mysite1 and site2 to be served on IP Address 192.168.1.100 (port 80)

Before proceeding let us look at how resolv.conf and hosts file are set up …

$ cat /etc/resolv.conf
search kurinchilion.com
nameserver 192.168.1.100

$ cat /etc/hosts
127.0.0.1 localhost
192.168.1.100 myserver.kurinchilion.com myserver

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

(more…)


Valid HTML 4.01 Strict  Valid HTML 4.01 Strict