Tuesday, January 29, 2008

Find Other Web Sites Hosted on a Web Server

Came across a amazing site

YouGetSignal.com - Find Other Web Sites Hosted on a Web Server

Blogged with Flock

CHROOT command

The chroot command changes the 'root' to another location. This command is used to create a sandbox for the users. Once a new root is declared via chroot, any reference that a user makes to '/' will resolve to the new directory.

This is a very good idea to restrict users working under the real root filesystem.

Eg:- chroot /home/sushanth

This command changes the root of my server to /home/sushanth.

This means

vi /test

will cause test file to open under /home/sushanth

Blogged with Flock

To determine if a new PCI or USB hardware has been added in the system

If my goal is to see if a PCI or USB piece of hardware has been detected, you may be able to use the following commands

lspci and lsusb commands

Cheers !

Blogged with Flock

Monday, January 28, 2008

Password protecting webpages

Our task is to control the access the particular website.

1. cd /etc/httpd/conf

2. vi httpd.conf

3. Change the line that says
AllowOverride None
to
AllowOverride AuthConfig

4. While doing the above changes on the httpd.conf file be sure not to change the first ocurance change the second ocurrance.

5. Before doing any changes take a backup of httpd.conf file

6. You should now identify the folders under your webserver you would like to protect.

7. On a Linux server the actual directory path would be
/var/www/html/test
So on the web browser it would be
http://www.test.com/test

8. Once you identify which directory you will have to protect then inside that directory create one file .htaccess

9. vi .htaccess
AuthName "Login to the website"
AuthType Basic
AuthUserFile /var/www/html/test/.htpasswd
Require user sushanth

10. Note that AuthName requires quotes and whatever is in the quotes will be displayed on the login window.

11. Also be sure to include the user login names of the people who want to access the web site, next to the Require user line. In the above example is added my name.

12. Now create .htpasswd file in the same folder, in my case under test.

13. cd /var/www/html/test

14. htpasswd -cmb .htpasswd sushanth test123

15. Note that you must use your own name and password (replace sushanth and test123) and that the option cmb does the following: First it forces Creating of a new .htpasswd file. Since this is your first time adding a user it is necessary. Next the m option forces encryption and b allows you to include the user name and password immediately. In my case I created a new .htpasswd file, then added the user sushanth and her password test123.

16. Restart the apache services

17. test the website
www.test.com/test

18. There may come a time when you need to delete users from the access. You can do this easily enough by again editing the .htaccess file and running a command to delete the user from the .htpasswd file.

19. First, edit the .htaccess file and remove the user you do not wish to allow access to and save the file.

20. Second, delete the user from the .htpasswd file by typing this command at the prompt: htpasswd D sushanth
The option D is for delete. It should prompt you that user sushanth was deleted.

Sunday, January 13, 2008

Redirecting Website Using Apache Web Server

There are many methods to redirect a website or a webpage to another domain.

I have explained 2 options.

1. Use Apache Module (mod_rewrite)

In the Httpd.conf file

RewriteEngine On
RewriteRule /.* http://www.newdomain.com/

2. Use Apache Module (mod_alias)

In the Httpd.conf file

^Redirect domain
Redirect / http://www.newdomain.com/

^Redirect page
Redirect /webpage.html http://www.newdomain.com/new_webpage.html/

Error: Unable To Eject, Last Error: Invalid Argument

Error: Unable To Eject, Last Error: Invalid Argument

When we get this error, this means some user is accessing the CD-Rom.

Type the following command

#fuser /dev/cdrom

This command will tell the administrator, the processes that have a open file or are otherwise accessing.

#fuser -uik /dev/cdrom

This command will show the Process ID and the use who owns it. This helps the administrator the interactively kill the process so as to eject the CD-ROM.

Creating A Boot Disk For RedHat Linux

"mkbootdisk" command in order to use this you only need to know the kernel version of the operating system to write to the floppy.
You can get the kernel version of the operating system by using "uname -r"

To create a boot disk for the Linux operating system

#mkbootdisk 2.4.20-80

or

#mkbootdisk 'uname -r'

The mkbootdisk command collects info from /etc/fstab and /boot/grub/grub.conf.

In order to work out the root filesystem any required kernel command line arguments and the drivers which will be needed to generate the ramdisk image.

One useful but this command is not widely used

#mkbootdisk --iso option, which make the bootable for CD-ROM image.