Connect Tech Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Wednesday, 9 September 2009

How To Add a Welcome Message for SSH Users

Posted on 07:05 by Unknown
Here is a very easy tip on how to add a welcome message for your SSH users

If you want that when users connect to your SSH server, they see a banner welcome message after connecting. Then you need to turn on the banner configuration of SSHd in its config file and then create a banner file.

Step 1:

Create a banner file that contains text you want people to see when connecting to your SSH server.

Create and open the banner file:

[root@amit]# vim /home/username/banner

put your message inside it

*****************************************************************
*This is a private SSH Server. You are not supposed to be here. *
*Your information has
been logged and a report has been emailed *
*to the admin
concerning your unauthorized attempts. *
*****************************************************************

then save & quit by using :wq!

Step 2:

Edit /etc/ssh/sshd_config to set a default banner path.

[root@amit]# vi /etc/ssh/sshd_config

then add the following to the config file:

Banner /path/to/banner

Save the file and quit: :wq

Step 3:

Restart the sshd server.

[root@amit] # /etc/init.d/sshd restart

Step 4:

Try SSH to your server and check Welcome banner on login


From the desk of Amit Maheshwari


Read More
Posted in | No comments

Monday, 7 September 2009

How to connect mssql with php using FEDORA

Posted on 21:51 by Unknown

Connecting to MSSQL datbase with php from Fedora or any other Linux flovour is a pretty much easy.

In Linux Freetds Package provide libraries to connect to the MSSQL database, which can be installed with a yum command:

# yum install php-mssql

the above command asks to install MSSQL extension for PHP, but yum will take care of all the dependencies including Freetds.

Once installed you can use a low level tool like tsql which comes with Freetds to check you setup, but before that edit the Freetds config file (/etc/freetds.conf):

[root@amit]# vim /etc/freetds.conf

[MSSQL]
host = 192.168.1.1
port = 1433
tds version = 8.0

above is a simple configuration that I use to connect to SQL2005/2000 databases. The braces contain a name (any name you like) to refer to the connection from Linux, and host is the IP of the MSSQL Server, port is the port MSSQL is listening on and the tds version is the TDS Protocol Version to use when connecting with database. Now regarding the port, MAKE SURE that you are connecting to the correct MSSQL port. OK, Lets check with tsql now:

# tsql -S MSSQL -U user -P pass

that should give u a prompt like “1>”

Now check whether PHP can connect:

# php -r 'echo mssql_connect("MSSQL","user","pass");'

From the desk of Amit Maheshwari



Read More
Posted in | No comments

Tuesday, 1 September 2009

How to Prevent Yum update of some selected packages in Redhat/Fedora

Posted on 21:57 by Unknown

It is very Simple to exclude some selected packages not to update while using yum update command

All you need to do is add an exclude line to the end of your [main] section in /etc/yum.conf .

Your /etc/yum.conf should look something like this:

[main]
cachedir=/var/cache/yum
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3
exclude= hal bash*

This will prevent upgrades of the hal package as well as bash package while using yum update cmd. The list of apps in the exclude should be space sepeated. Shell wildcards ( * ? ) can also be included.

From the desk of Amit Maheshwari



Read More
Posted in | No comments

Saturday, 22 August 2009

How do I password-protect my website using .htaccess?

Posted on 10:25 by Unknown
Htaccess can be used to password-protect directories on your web sites.
You can do this Password Protection very easily by using below steps
Step 1. Change to the directory that you wish to protect

In the following example we wish to protect a directory called pvt in our htdocs directory.
[root@amit ]# cd /usr/local/apache2/htdocs/
[root@amit.htdocs] # mkdir pvt

Step 2. Create a file named .htaccess
Use your favourite editor to create a file called .htaccess . In the below example we will use vim.
[root@amit.htdocs] # vim .htaccess
Add foloowing lines in .htaccess file
AuthUserFile /usr/local/apache2/conf/.htpasswd #### path of .htpasswd file
AuthName "My Private Password Protect Directory" ### title for the username/password input box.
AuthType Basic
Require valid-user amit #### vaild user name

Step 3. Create the .htpasswd file by adding users
[root@amit.htdocs] # htpasswd -c /usr/local/apache2/conf/.htpasswd amit
New password:
Re-type new password:
Adding password for user amit

This creates a file .htpasswd containing the username amit. Then it will be prompted for a password for amit, which will be stored in the .htpasswd file
So, to create a new users and change the password for existing users, switch to the directory that contain .htpasswd, run this commad # htpasswd -c .htpasswd username

Step 4. Set the permissions on your .htaccess and .htpasswd file
Now use chmod command to chage permission of .htaccess & .htpasswd to make it world-readable

[root@amit.htdocs] # chmod 644 /usr/local/apache2/htdocs/pvt/.htaccess
[root@amit.htdocs] # chmod 644 /usr/local/apache2/conf/.htpasswd

Now you done everything !!!!
Now, anytime you attempt to view your password protected directory (pvt ), any file within it, or recursively any subdirectory of it, you will be prompted for a username and password,
From the desk of Amit Maheshwari
Read More
Posted in | No comments

Wednesday, 19 August 2009

Using_mysqldump_Backup_&_Restore_MySQL_Database

Posted on 04:57 by Unknown
Using mysqldump, you can backup a local database and restore it on a remote database at the same time, using a single command.
An examples on how to use mysqldump to backup and restore


To backup:      # mysqldump -u root -p(root_password) (database_name) > filename.sql

To restore: # mysql -u root -p (root_password) (database_name) <>

from the desk of Amit Maheshwari
Read More
Posted in | No comments

Thursday, 25 June 2009

How to install Jre in Fedora Linux

Posted on 06:09 by Unknown
Hi ,

First check latest version of JAVA RUN TIME ENVIRONMENT at http://www.java.com/en/download/linux_manual.jsp


Then download Linux (Self-Extracting File) it looks like this
jre-6u14-linux-i586.bin (version may be change)


now login as a root

[root@amit]# mkdir /usr/java ### Create java directory under /usr

then mv jre-6u14-linux-i586.bin file to /usr/java/ by following command

[root@amit]# mv jre-6u14-linux-i586.bin /usr/java


Now make it executable by using following command

[root@amit /usr/java]# chmod u+x jre-6u14-linux-i586.bin

now simply execute it :

[root@amit /usr/java]# ./jre-6u14-linux-i586.bin


NOTE : it require some packages to be pre-installed like
compat-libstdc++
, gcc, compat-libstdc++


After successfully installation make it compatible with FIREFOX by using :


[root@amit /usr/java]# ln -s /usr/java/jre1.6.0_14/plugin/i386/ns7/libjavaplugin_oji.so /root/.mozilla/plugins/

Now restart your Firefox web Browser and Enjoy.....

By Amit Maheshwari
Read More
Posted in | No comments

Tuesday, 5 May 2009

How to Identifying types of Partitions in Linux

Posted on 13:55 by Unknown

Each partition on a hard disk is independent of the other partitions. For example, you can divide a hard disk into two partitions to install two different operating systems. An operating system will use its own partition to store data, independent of any other partition on a hard disk.  

The various types of partitions in Linux are: 
 
· Primary partitions 
· Logical and extended partitions 
· Swap partitions 

Each type of partition is assigned a numeric code. This code is automatically generated and has a fixed value. For example, the numerical code of the swap partition is 0x82. 

Primary Partitions 
 
When a partition is created on a hard disk for the first time, it is called the primary partition. A hard disk can have a maximum of four primary partitions. From the primary partitions present on the hard disk, only one partition can be subdivided into logical partitions. The partition with the logical partitions is called the extended partition. You can subdivide an extended partition into a maximum of 63 subsections. 
 
The MBR stores the information about all the primary partitions, such as the size of the Partitions in terms of sectors, blocks, and cylinders, and the offset from the zeroth cylinder.

Logical and Extended Partitions :

A hard disk can be divided into a maximum of four primary partitions. Therefore, you can only install four operating systems on a computer. If you want to install more than four operating systems, divide the extended partition into logical partitions.  
 
A logical partition is similar to a primary partition. Each logical partition consists of a pointer that contains the address of the next logical partition. All the logical partitions of a hard disk need to be contiguous. 
 
The first sector of an extended partition contains a block of partition descriptor, which contains the information about all the logical partitions. Linux imposes a limit on the number of types of partitions on a hard disk and on the number of logical partitions on the hard disk.  

For example, the maximum number of partitions is 63 on an IDE disk and 15 on a SCSI disk.

Swap Partitions :

A process that runs on a system is allocated certain blocks of the RAM, which are known as pages. Linux identifies the pages that a process can access, and stores those pages in the RAM. When the number of processes that run on a computer increases, the kernel releases the space on the RAM. To do this, the kernel writes the inactive pages back to the hard disk. The storage area of the hard disk where the inactive pages are written back is known as the swap space.  
 
You can specify a swap space as a swap partition, swap file, or a combination of a swap partition and a swap file. A swap partition is a separate division of a hard disk used for storing the pages that are written back from the RAM. A swap file is an ordinary file and is used by an operating system to store the inactive pages from the memory

Created by Amit Maheshwari

Read More
Posted in | No comments

Sunday, 3 May 2009

Understanding Booting Process in LINUX

Posted on 09:09 by Unknown

 Understanding Booting Process in LINUX

The Booting process is the first process that is executed when you start a Linux system. 
This process is executed in the following steps: 
 
1. The processor searches for the Basic Input/Output System (BIOS) program in the 
memory and executes it. BIOS is a program that provides the lowest level interface to 
the devices, such as the hard disk, monitor, and mouse, of the system.  
 
2. BIOS runs the Power-On Self Test (POST) program, which checks the system 
hardware by verifying the hardware configuration information. The program does this 
to ensure that all the required hardware devices are present and functioning properly.  
 
3. BIOS checks the system memory for errors and searches for a bootable device. The 
bootable device may either be the hard disk or other bootable devices, such as a CD-
ROM or a diskette drive. The sequence in which BIOS searches for the various 
devices for the boot record is called the booting sequence
You can specify the booting sequence by editing the booting sequence information in the 
BIOS setup program. To enter the BIOS setup program, you need to press the or 
key on the first boot up screen. The boot sequence can be specified as CD-
ROM, C, A, where C represents the hard drive and A represents the diskette drive. In the 
preceding boot sequence, BIOS will first search the CD-ROM for the boot record, then 
search the hard drive and in the end search the diskette. The following list describes the 
sequence in which the boot loader is invoked and loaded: 
 
4. BIOS checks the bootable device for the presence of the Master Boot Record (MBR), 
which is the first sector of the bootable device. The MBR is 512 bytes in size and 
consists of a boot loader and a partition table. The boot loader contains instructions in 
the form of machine code for booting the system. The partition table contains 
information about the various partitions of the storage devices, such as the size of the 
various partitions and the names of the partitions.  
 
5. BIOS locates and invokes the boot loader by passing the control of the system to the 
Initial Program Loader (IPL), also called the first stage of the boot loader, which is 
present in the MBR.  
 
6. IPL loads the boot loader in the system memory.  

The boot loader takes the control of the system from the IPL when it is loaded into the 

memory of the system.

GRUB Configuration File 
 
The GRUB configuration file specifies the various commands that are used to set the 
global preferences of the system. The global preferences are the parameters that are not 
specific to any operating system and are applicable to the entire menu interface of GRUB. 
These preferences are followed by the commands specific to each operating system listed 
on the menu interface.  
 
The default location of grub.conf in the filesystem is /boot/grub/grub.conf. A sample 
grub.conf file of a system having RHEL5 is shown below: 

 
default=0 
timeout=5 
splashimage=(hd0,0)/grub/splash.xpm.gz 
hiddenmenu 
title Red Hat Enterprise Linux ES (2.6.18-5.EL5) 
  root (hd0,0) 
  kernel /vmlinuz-2.6.9-5.EL ro root=LABEL=/ rhgb quiet 
  initrd /initrd-2.6.18-5.EL5.img 
 
A sample grub.conf file of a system having RHEL5 and Windows XP operating systems 
is shown below:
 

default=0 
timeout=5 
splashimage=(hd0,0)/grub/splash.xpm.gz 
hiddenmenu 
title Red Hat Enterprise Linux ES (2.6.18-5.EL5) 
  root (hd0,0) 
  kernel /vmlinuz-2.6.18-5.EL5  ro root=LABEL=/ rhgb quiet 
  initrd /initrd-2.6.18-5.EL5.img 
title Windows  
rootnoverify (hd0,0) 
chainloader +1 

In the preceding grub.conf file the various configuration directives are: 
 
· default: Specifies default operating system to load 
· timeout: Specifies the time interval, in seconds, GRUB waits for user to select an 
operating system from GRUB menu 
· splashimage: Specifies the absolute path of the image shown by GRUB on screen at bootup 
· hiddenmenu: Specifies GRUB to hide the menu until user presses a key 
· title: Specifies the OS name shown in GRUB menu  
· root: Specifies the partition where grub is installed 
· kernel: Specifies the absolute path of the kernel file to load and label of root partition 
· initrd: Specifies the absolute path of the initial RAM disk

· rootnoverify: Specifies the root partition to be used by GRUB but does not mount the partition 
· chainloader: Specifies GRUB to load the file as a chain loader 

Created By Amit Maheshwari 

Read More
Posted in booting Process, linux, redhat | No comments

Sunday, 15 March 2009

Basic Linux & Unix commands

Posted on 15:16 by Unknown

adduser ::-- Add a new user
arch ::-- Print machine architecture
awk ::-- Find and Replace text within file(s)
bc ::-- An arbitrary precision calculator language
cal ::--Display a calendar
cat ::--Concatenate files and print on the standard output
chdir ::--Change working directory
chgrp ::--Change the group ownership of files
chkconfig ::--Tool for maintaining the /etc/rc[0-6].d directory hierarchy
chmod ::--Change the access permissions of files and directories
chown ::--Change the user and group ownership of files
chroot ::--Change root directory
cksum ::--Print CRC checksum and byte counts
clear ::--Clear terminal screen
cmp ::--Compare two files
comm ::--Compare two sorted files line by line
cp ::--Copy one or more files to another location
cron ::--Daemon to execute scheduled commands
crontab ::--Schedule a command to run at a later time
csplit ::--Split a file into context-determined pieces
cut ::--Divide a file into several parts
date ::--Display or change the date & time
dc ::--Desk Calculator
dd ::--Data Dump - Convert and copy a file
df ::--Display free disk space
diff ::-- Display the differences between two files
diff3 ::--Show differences among three files
dir ::--Briefly list directory contents
dircolors ::-- Colour setup for `ls'
dirname ::--Convert a full pathname to just a path
du ::--Estimate file space usage
echo ::-- Display message on screen
ed ::-- A line-oriented text editor (edlin)
egrep ::--Search file(s) for lines that match an extended expression
eject ::--Eject CD-ROM
env ::-- Display, set, or remove environment variables
expand ::-- Convert tabs to spaces
expr ::-- Evaluate expressions
factor ::-- Print prime factors
false ::-- Do nothing, unsuccessfully
fdformat ::-- Low-level format a floppy disk
fdisk ::-- Partition table manipulator for Linux
fgrep ::-- Search file(s) for lines that match a fixed string
find ::-- Search for files that meet a desired criteria
fmt ::-- Reformat paragraph text
fold ::-- Wrap text to fit a specified width
format ::-- Format disks or tapes
free ::-- Display memory usage
fsck ::-- Filesystem consistency check and repair
gawk ::-- Find and Replace text within file(s)
grep ::-- Search file(s) for lines that match a given pattern
groups ::-- Print group names a user is in
gzip ::-- Compress or decompress named file(s)
head ::-- Output the first part of file(s)
hostname ::-- Print or set system name
id ::-- Print user and group id's
info ::-- Help info
install ::-- Copy files and set attributes
join ::-- Join lines on a common field
kill ::-- Stop a process from running
less ::-- Display output one screen at a time
ln ::-- Make links between files
locate ::-- Find files
logname ::-- Print current login name
lpc ::-- Line printer control program
lpr ::-- Off line print
lprm ::-- Remove jobs from the print queue
ls ::-- List information about file(s)
man ::-- Help manual
mkdir ::-- Create new folder(s)
mkfifo ::-- Make FIFOs (named pipes)
mknod ::-- Make block or character special files
more ::-- Display output one screen at a time
mount ::-- Mount a file system
mv ::-- Move or rename files or directories
nice ::-- Set the priority of a command or job
nl ::-- Number lines and write files
nohup ::-- Run a command immune to hangups
passwd ::-- Modify a user password
paste ::-- Merge lines of files
pathchk ::-- Check file name portability
pr ::-- Convert text files for printing
Printcap ::-- Printer capability database
printenv ::-- Print environment variables
printf ::-- Format and print data
ps ::-- Process status
pwd ::-- Print Working Directory
quota ::-- Display disk usage and limits
quotacheck ::-- Scan a file system for disk usage
quotactl ::-- Set disk quotas
ram ::-- ram disk device
rcp ::-- Copy files between two machines
rm ::-- Remove files
rmdir Remove folder(s)
rpm ::-- Remote Package Manager
rsync ::-- Remote file copy (Synchronize file trees)
screen ::-- Terminal window manager
sdiff ::-- Merge two files interactively
sed ::-- Stream Editor
select ::-- Accept keyboard input
seq ::-- Print numeric sequences
shutdown ::-- Shutdown or restart linux
sleep ::-- Delay for a specified time
sort ::-- Sort text files
split ::-- Split a file into fixed-size pieces
su ::-- Substitute user identity
sum ::-- Print a checksum for a file
symlink ::-- Make a new name for a file
sync ::-- Synchronize data on disk with memory
tac ::-- Concatenate and write files in reverse
tail ::-- Output the last part of files
tar ::-- Tape Archiver
tee ::-- Redirect output to multiple files
test ::-- Evaluate a conditional expression
time ::-- Measure Program Resource Use
touch ::-- Change file timestamps
top ::-- List processes running on the system
traceroute ::-- Trace Route to Host
tr ::-- Translate, squeeze, and/or delete characters
true ::-- Do nothing, successfully
tsort ::-- Topological sort
tty ::-- Print filename of terminal on stdin
umount ::-- Unmount a device
uname ::-- Print system information
unexpand ::-- Convert spaces to tabs
uniq ::-- Uniquify files
units ::-- Convert units from one scale to another
unshar ::-- Unpack shell archive scripts
useradd ::-- Create new user account
usermod ::-- Modify user account
users ::-- List users currently logged in
uuencode ::-- Encode a binary file
uudecode ::-- Decode a file created by uuencode
vdir ::-- Verbosely list directory contents (`ls -l -b')
watch ::-- Execute/display a program periodically
wc ::-- Print byte, word, and line counts
whereis ::-- Report all known instances of a command
which ::-- Locate a program file in the user's path
who ::-- Print all usernames currently logged in
whoami ::-- Print the current user name
xargs ::-- Execute utility, passing constructed argument list(s)
yes ::-- Print a string until interrupted
Read More
Posted in | No comments
Newer Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • How to schedule a PHP script in task scheduler
    Quiet often there is a need to execute/run  php  script on some time interval at server side. And that php scripts should run automatically ...
  • HTTP Error 403.19 – Forbidden The configured user for this application pool does not have sufficient privileges to run CGI applications.
    If you get the error “HTTP Error 403.19 – Forbidden The configured user for this application pool does not have sufficient privileges to...
  • Roles and Features showing an error HRESULT: 0x800F0818 in Server Manager of windows server 2008 R2
    When you open Server Manager both Roles and Features display Error and you are unable to add any role or features. When you select the det...
  • Error - "Failed to retrieve data for this request (Microsoft.SqlServer.Management.sdk.sfc)"
    ErrError    - In Microsoft SQL Management Studio 2008, you receive the following error message when you try to expand the Databases:      ...
  • How to configure IIS 7 to redirect non-www domain to www domain?
    One of few legacy leftovers that was never dropped over the years is the common use of www domain prefix. It is not a problem per se for us...
  • Back up all MS SQL databases at once
    This article will discuss how to backup all MS SQL databases with one script. A separate file will be created for each database. Log into ...
  • The media family on device is incorrectly formed. SQL Server cannot process this media family Error: 3241
    When you try to restore a backup of the database you get the following error: The media family on device ” is incorrectly formed. SQL Server...
  • How to check Malware injection in Code
    To check Malware injection in your script/Code you can use a Web based Google Tool called “Webmasters Tools” You can find it here Google We...
  • An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
    If you are facing the following error while accessing the website: Error Summary HTTP Error 500.24 - Internal Server Error An ASP.NET settin...
  • Stopping Unneeded Services In Windows Server 2008
    By  default Windows 2008 starts with a number of services that actually do not need to be running. Many of these services can impact perfo...

Categories

  • booting Process
  • linux
  • redhat

Blog Archive

  • ►  2013 (68)
    • ►  July (1)
    • ►  May (2)
    • ►  April (11)
    • ►  March (54)
  • ►  2012 (44)
    • ►  September (20)
    • ►  August (1)
    • ►  July (4)
    • ►  June (12)
    • ►  May (2)
    • ►  March (4)
    • ►  February (1)
  • ►  2011 (1)
    • ►  February (1)
  • ▼  2009 (9)
    • ▼  September (3)
      • How To Add a Welcome Message for SSH Users
      • How to connect mssql with php using FEDORA
      • How to Prevent Yum update of some selected package...
    • ►  August (2)
      • How do I password-protect my website using .htaccess?
      • Using_mysqldump_Backup_&_Restore_MySQL_Database
    • ►  June (1)
      • How to install Jre in Fedora Linux
    • ►  May (2)
      • How to Identifying types of Partitions in Linux
      • Understanding Booting Process in LINUX
    • ►  March (1)
      • Basic Linux & Unix commands
Powered by Blogger.

About Me

Unknown
View my complete profile