Kurinchi Blogger Scribbles …


Archive for the ‘LINUX’ Category

Mar 25
2010

Setting up Zend Framework – for Beginners

Last updated: March 23rd, 2010

Download the latest version of Zend framework from
http://framework.zend.com/download/latest

At the time of writing it was 1.10.2 available at Zend 1.10.2

$ pwd
/tmp

$ wget http://framework.zend.com/releases/ZendFramework-1.10.2/ZendFramework-1.10.2.tar.gz
(more…)

Mar 24
2010

Linux: Securing Apache

Last updated: March 24th, 2010

Run the below command to check what user and group apache is running as, by typing
$ ps auwfx | grep apache2
root 28937 0.0 0.1 3004 756 pts/0 S+ 12:35 0:00 | \_ grep apache2
root 25235 0.0 2.5 37744 12992 ? Ss Mar18 0:06 /usr/sbin/apache2 -k start
www-data 27102 0.0 1.3 38252 6972 ? S Mar21 0:00 \_ /usr/sbin/apache2 -k start
(more…)

Mar 23
2010

Shell Scripting: Linux variables

Last updated: March 22nd, 2010

Linux variables have the prefix $. Variables that will be useful in shell scripting are listed below.

$$ Process ID number of the shell in execution
$? Variable indicating Exit status (from the last command that got executed)
$* Entire argument string in the command line (excluding script name)
$# Number of arguments in the command line (not counting the shell script name)

To access arguments passed to a script, following variables are used.

$0 Name of the program (with entire path)
$1 First argument passed in the command line
$2 Second argument passed in the command line
$n Nth argument passed in the command line

To move or shift to a specified argument in the list of arguments, “shift” command is used. For example, to shift 1 argument just type “shift” or “shift 1” and to shift to the third argument in the list type “shift 2“.
(more…)

Mar 22
2010

Linux: Path settings

Last updated: March 22nd, 2010

$PATH is the environment variable related to Linux Path settings.

To add a directory to the path, type
$ export PATH=$PATH:/tmp/myshells

The above change is in effect only in the shell from where it is being called

To set the PATH for a specific user, type the below 2 lines in the user’s .bash_profile file ($HOME/.bash_profile).

PATH=$PATH:/tmp/myshells
export PATH

To set the PATH for ALL users except the root user, type the following line in /etc/profile
export PATH=$PATH:/tmp/myshells

Root user is not affected by any setting changes under /etc/profile. To set the path for the root user, we need to modify the root users’ .bash_profile (/root/.bash_profile)

Mar 21
2010

Shell Scripting: Saving Shell scripts

Last updated: March 20th, 2010

For example, if we have shell script named “myshellscript.sh” (with execute permission) we can make it run in the current working directory with the commands

$ sh myshellscript.sh (or)
$ ./myshellscript.sh

If the shell scripts are stored in an executable path, it will save us from typing extra keystrokes. To find the paths that are setup, type

$ echo $PATH
/usr/bin: /usr/local/bin

(more…)

Mar 20
2010

Shell Scripting: How to execute Shell Scripts?

Last updated: March 20th, 2010

Shell scripts are written to execute a set of commands and to group them. The scripts will have the following special line

#!/bin/bash

This is an indication that the shell script is used in bash shell and that it should be called for command execution.

To know the path of the bash shell, type
$ cat /etc/shells
(more…)

Mar 19
2010

Shell Scripting: What is Shell?

Last updated: March 19th, 2010

Shell is an environment around the Kernel providing user interaction. It accepts user commands and convert them to binary code. It is not part of the kernel but uses the kernel to execute the commands.

Commonly available shells
- BASH (Bourne Again Shell)
- CSH (C Shell)
- KSH (Korn Shell)

All these shells do the same job and the differences come in the form of syntax that these shells use to execute commands and the built-in functions that comes along with it.

You can find the shell that is in execution by typing
$ echo $SHELL

To find all the available shells in the system, type
$ cat /etc/shells

Mar 18
2010

Linux: Password creation

Last updated: March 18th, 2010

To create a password file and to add users to it, use the command
$ htpasswd -cm /secured/.mypass username1

To add users to the already existing password file, use the command
$ htpasswd -m /secured/.mypass username2

When additional users are added to the password file, ensure that you don’t use the “-c” option.

Read Password protect directories here

Mar 16
2010

Linux: alias, unalias

Last updated: March 17th, 2010

Alias command comes handy when we are in need to make long and frequently used command string short.

To list the current set of aliases simply type
$ alias

To display the set alias for a specified alias name, type
$ alias alias-shortstring
Example:
$ alias ls

To set an alias you use the format
$ alias shortstring = “linux command string”
(more…)

Mar 09
2010

Linux: Port configuration for multiple network interfaces on the same server

Last updated: March 17th, 2010

Edit ports.conf file and configure the port number for the different IP’s configured for network interfaces

Listen 192.168.1.100:8001
Listen 192.168.1.200:8002


Valid HTML 4.01 Strict  Valid HTML 4.01 Strict