Working with Boot Loader

Wednesday, May 13, 2009
Your Ad Here
Let us know, how we can configure our boot loader.In linux the file is
/boot/grub/grub.conf. You will find a soft link of this file in /etc directory.
The boot loader file specifies the computer where the system files exist in our system so that the computer can boot perfectly. The grub.conf understands Microsoft’s boot loader file also. If we have multiboot system, we can configure the linux boot loader file, /boot/grub/grub.conf to set the default operating system and how long the computer can wait before booting the system with the default operating system.
Let us have a look at the screen shot below for /boot/grub/grub.conf file.

According to the above example, there is only one operating system loaded – the Red Hat Enterprise Linux, see the title section here. You are open to change the contents of the title . The default=0 tells the system to boot using the OS referred by the first title. The timeout=5 defines that the system will wait for 5 seconds before booting with the default Operating system. The splashimage is nothing but the image you see in the boot loader screen. Here, considering you have a dual booting system, you may choose which Operating System will be loaded. The hiddenmenu does what its name implies – it hides the menu. The root (hd0,0) indicates where the system will find the root of the booting related files. In Red Hat linux, the name of the directory is /boot. The hd0,0 section could be different in accordance with the partition information in your hard disk. Here hd0,0 indicates the first partition in the first hard disk. The next two lines defines the kernel and initrd image file name.Let us check another grub.conf file below –
# grub.conf generated by anaconda
#
#boot=/dev/hda
default=0
timeout=10
splashimage=(hd0,1)/grub/splash.xpm.gz
title Red Hat Linux (2.4.18-14)
root (hd0,1)
kernel /vmlinuz-2.4.18-14 ro root=LABEL=/
initrd /initrd-2.4.18-14.img
title DOS
rootnoverify (hd0,0)
chainloader +1
# end of file
According to the above file the computer’s default operating system is Red Hat Linux. You
know, why !!. If you want to set DOS as the default, what we can do is just change the
value for ‘default’. Replace 0 with 1.
At this point if you reboot the computer you will see at the top Red Hat Linux exists though the DOS has been selected. If you interchange the title directives, you will see at the top DOS exists and it has also been selected.
Here is the modified /boot/grub/grub.conf file....
# grub.conf generated by anaconda
#
#boot=/dev/hda
default=0
timeout=20
splashimage=(hd0,1)/grub/splash.xpm.gz
title DOS
rootnoverify (hd0,0)
chainloader +1
title Red Hat Linux (2.4.18-14)
root (hd0,1)
kernel /vmlinuz-2.4.18-14 ro root=LABEL=/
initrd /initrd-2.4.18-14.img
# end of file
Please note that, there is no need to run any command to make the change effective.

Labels: , , , , , , , , , , ,

 
posted by Gautam at 11:30 PM, | 0 comments

FTP SERVER

Monday, May 4, 2009
Your Ad Here
Setting up FTP server is a standard method for sharing files over the internet.
Two FTP server packages are provided with Linux RedHat 8 distribution, - the Washington
University FTPD (WUFTPD) and the Very Secure FTPD (VSFTPD).
Among the two, VSFTPD is considered to be better for high-volume FTP servers.
Access to the FTP server relies on a login process in the particular FTP server. Users with
their accounts on the system most likely have access to the greater part of the file system
after been authenticated comparing to ‘Anonymous’ user.
We will only concentrate to the VSFTPD configuration.
Setting up VSFTPD:
Start the VSFTPD FTP Server: Redhat 8
First of all check whether WUFTPD is running or not. To stop WUFTPD you must modify
the /etc/xinetd.d/wu-ftpd file. Replace the seeting
disable = no with disable = yes.
Edit the /etc/xinetd.d/vsftpd file by replacing the setting
disable = yes with disable = no
Restart the xinetd server by running the following command –
service xinetd restart or
/etc/init.d/xinetd restart
At this point, by default, anonymous users are given ‘read-only’ access to files and
subdirectories in /var/ftp.
Authenticated local users get access to their respective home directories.
With RHEL 3 or RHEL 4 starting ftp service is really simple. All you have to do is
exetcute the following command - service vsftpd restart .
To Start the ftp service in booting time, execute chkconfig vsftpd on
The vsftp ftp service configuration file is vsftpd.conf In case of Redhat 8, you will find
this file in /etc/ folder. In RHEL 3/4 you will find the file in /etc/vsftpd/ directory.
The vsftpd.conf file:
Configuration for the anonymous users:
By default, the anonymous users have read-only access to /var/ftp directory. The
default location for anonymous users can be changed by keeping the following directive in
the vsftpd.conf file – anon_root=/var/new .
Please be noted, whenever you modify the vsftpd.conf file, you need to restart the ftp service.
The anonymous_enable=YES option in vsftpd.conf file lets the anonymous users to access
the /var/ftp directory. It is the default setting.
If you want to disable anonymous access modify the
anonymous_enable=YES to anonymous_enable=NO
We can allow anonymous users to upload files using –
anon_upload_enable=YES option, provided that the directory or directories, where the
filess will be uploaded, are exist with write permission. For the security reason it is
always better to create a directory in /var/ftp with 777 permission – where the
anonymous users will upload their files.
Create a directory, say, public
mkdir /var/ftp/public
Set the permission
chmod 777 –R /var/ftp/public
We must keep in mind, ownership will be granted to ftp user for the files uploaded by
anonymous users. So, it is understandable, anonymous users get read-only access to the uploaded files.
If you want to allow the anonymous users to rename or delete the files in
/var/ftp/public directory, place the following option in the vsftpd.conf file –
anon_other_write_enable=YES
If you want to allow the anonymous users to create their own directory in the
/var/ftp/public directory, place the following option in the vsftpd.conf file –
anon_mkdir_write_enable=YES
If you want to configure the FTP server so that a particular user, say Linuxuser, will be
granted the ownership of the files uploaded by the anonymous users, place the following
options in the vsftpd.conf file –
chown_uploads=YES
chown_username=Linuxuser
Do not forget to restart ftp service –
service vsftpd restart

Labels: , , , , , , ,

 
posted by Gautam at 10:43 PM, | 0 comments

SCHEDULING TASKS:

Saturday, May 2, 2009
Your Ad Here
Using the ‘at’ utility. The at facilty is designed to run jobs at specific times. Submitted jobs are spooled to /var/spool/at directory.
The daemon name is atd. Access Control Files:
/etc/at.allow - Contains list of users who are granted to submit ‘at’ jobs.
/etc/at.deny - Contains list of users who have ‘No’ permission to submit ‘at’ jobs.
Let us see how can we use the ‘at’ facility. For Example, we need to copy the contents of /home directory in compressed form to /tmp/backup directory.
To do this, we can run the following commands –
at 12:00
cd /home
mkdir /tmp/home
mkdir /tmp/backup
cp –Rf * /tmp/home
cd /tmp/home
tar czvf backup.tar.gz *
cp backup.tar.gz /tmp/backup
+d
We can also run a single command to make this happen – this command will do the same task above.
echo “cd /home; mkdir /tmp/home; mkdir /tmp/backup; cp –Rf * /tmp/home; cd
/tmp/home; tar czvf backup.tar.gz *; cp backup.tar.gz /tmp/backup” | at 12:00
Example for specifying times for at jobs:
at now The job will run immediately
at now + 2 minutes The job will run 2 minutes from the current time.
at next hour The job will run after 1 hour from the current time.
at next month The job will run after 1 month from the current time.
at next year The job will run after 1 year from the current time.
at next fri The job will run on next Friday
at 16:00 today The job will run today at 16 hours.
at 16:00 tomorrow The job will run tomorrow at 16 hours
at 16:00 May 31 2004 The job will run on May 31s t , 2004 at 16 hours
I think, the most efficient way to use the at facility with –f option.
• f option can be used to use contents of a file to executed as ‘at’ command.
For Example, if we use the following command –
at –f /home/newback now + 10 hours
The system will see the contents of the /home/newback file and use them as ‘at’ command

Labels: , , , , , , , ,

 
posted by Gautam at 2:31 AM, | 0 comments

COMPRESSION UTILITY

Wednesday, April 29, 2009
Your Ad Here
To compress all files in the current directory –
tar czvf myfile.tar.gz *
To de-compress or extract
tar xzvf myfile.tar.gz
To compress a file with zip utility -
gzip –v file_name (File_name will be zipped with .gz extension)
gunzip file_name.gz (Decompresses a zipped file)
gunzip –c file_name.gz (Decompresses a zipped file while keeping the original .gz file)
bzip2 –v file_name (Newer compression utility. Creates a zipped file with bz2 extension)
bunzip2 file_name.bz2 (Decompress .bz2 file)
tar cjvf myfile.tar.bz2 * (All files will be zipped with bz2 extension)
Use the following command a have low level formatted floppy disk –
fdformat /dev/fd0 H1440
We can save a zipped file in floppy disk (with low level format) without mounting the
floppy disk using this following command –
tar czvf /dev/fd0

Labels: , , , , , , , , ,

 
posted by Gautam at 11:34 PM, | 0 comments

Linux command

Wednesday, April 8, 2009
Your Ad Here
Some Important Commands:
Before we start, we must commit not to delete files except those, that are created by us.
Lets go…..
Log in as root
pwd is used to display full path name of the current directory.
cd command changes the current directory to a specified directory.
Example – cd /usr/bin
~ sign specifies full path for your home directory
mkdir is used to create a directory. Example – mkdir new (will create directory in the current directory) mkdir /home/new (will create directory under /home)
mkdir –p /all/{tom,dic,harry}/{old,new}
The above command will create tom, dic and harry directories in /all and also creates old and new directory in each tome, dic and harry directory.
ls is used to display list of files and directory.
ls –l displays a detail list of files and directories, indicating directory/file, file acess
permission, link ,file, directory, owner, group owner, size in bytes,creation date and time
and name of directory/ file. In the first field, “-“ indicates “file”, “d” indicates directory”.
ll will also gives the same result as ls –l.
ls –la or ll -a list all files including the hidden files.
ls –R –l recursive listing of files, includes contents of the specified/current directory and all the subdirectories.
ls –r –l displays files and directory in reverse order.
ls –s –l list files, sorts by file size.
cp command is used to copy file. Example – cp file1 file2 (here file1 is source file and
file2 is the destination).
cp /etc/* . (copy all files from the /etc directory into the current position)
cp –r file_name destination_directory (Copy file to destination and preserve
permission, ownership and time stamps)
cp –r /etc/* /home/user1 copy all files and directories, including subdirectories in
/home/user1directory.
rm * delets all files from the current directory. Here the system will ask your
confirmation. Only files will be deleted.
rm –f * deletes all files from the current directory forcefully. The system will not ask your confirmation before deleting files.
rm –Rf * this command removes all files and subdirectories
cat command is used to display contents of a file. Example – cat file1
cat > file2 command allows you to create file, named as file2, and it gives you an interface to add contents to this file. However after adding contents we can save the file using +d command.
cat file1 file2 > file3:it create a file, named file3, with the contents of file1 and file2
cat file1 > file2 (here, the contents of file2 will be overwritten by the contents of file1)
cat file1 >> file2 (here, the contents of file1 will be appended to the contents of file2)
touch command can be used to create file/files with no contents. Example -
touch file_name1 file_name2 file_name3
echo command is used display any string
rmdir deletes directory. Example rmdir /home/new. This command will remove /home/new directory if it is empty.
rm deletes file. Example rm file1
date command displays current date & time
clear will clear the console screen.
df –h displays partition(s) and space used in partitions
w OR who is used to view who are logged on to this server
useradd or adduser is used to create user object.Example: useradd user_name
passwd - a user can change his password using this command
passwd user_name :If root user wants to change the password for any user
Here are some important passwd commands: -
passwd –d user-name (will empty password for that user)
passwd –l user-name (will lock the user account)
passwd –u user-name (will unlock the user account

Labels: , ,

 
posted by Gautam at 1:38 AM, | 1 comments