You are on page 1of 11

Homework No.

3
COURSE CODE: CAP423

COURSE NAME: Network Operating


System - I

DOA: 28th March DOS: 9April.


Part-A
Ques1:-Discuss RPM advantages disadvantages and RPM command line.
Ans1:- Advantages of RPM:-
 Include straightforward program installation and uninstallation, automatic installation,
ease of updating programs originally installed with RPM, and availability of versions
for most distributions of Linux.
 For the end-users, RPM provides many features that make maintaining a system far
easier than it has ever been previously. In the UNIX world, it has been (and still is)
customary to use .tar.gz files for installing software; a method in which it is easy to
lose customizations of configuration files.
 From a developer's viewpoint, it allows you to take source code for new software and
package it into source and binary form for end users. This process is simple, and
involves a single file and optional patches that you create.
Disadvantages of rpm:-

 Lack of backward compatibility or inadequate documentation for certain programs,


and a relatively steep learning curve.
 Dependancies can be hard to resolve.
 RPMs depend, and won't install unless required RPMs are already installed. apt-get
fixes this.Not optimized for your system.
 RPM is criticized for inconsistency in package names and content, which makes
automatic dependency handling difficult. The RPM packages created for a particular
Linux distribution may not work with another distribution due to missing dependency.
This dependency problem is termed as 'dependency hell'.

RPM COMMAND LINE:- The rpm command is fairly simple to use, once you understand
the various switches and arguments. Installing ,upgrading ,deleting rpm package in command
line The command structure looks like this:
rpm [ACTION/OPTION] FILENAME.rpm

 rpm {-i|--install} [install-options] PACKAGE_FILE ...

 rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...


 rpm {-F|--freshen} [install-options] PACKAGE_FILE ...

The general form of an rpm install command is

rpm {-i|--install} [install-options] PACKAGE_FILE ...

This installs a new package.

 rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...

This upgrades or installs the package currently installed to a newer version. This is the same
as install, except all other version(s) of the package are removed after the new package is
installed.

 rpm {-F|--freshen} [install-options] PACKAGE_FILE ...

This will upgrade packages, but only if an earlier version currently exists. The
PACKAGE_FILE may be specified as an ftp or http URL, in which case the package will be
downloaded before being installed.

Ques2. Write down the various steps to install package in TAR format
Ans2:- In short you need 3 commands:
Code:

./configure

make

make install

for installation:-Assuming that tar file name is xyz.tar.gz .First, you need to untar file using
tar command.
Code:

tar -zxvf xyz.tar.gz

 Change directory (so that you can compile):


Code:

cd xyz

 Run configure command:


Code:

./configure

 Compile software
Code:
make

 Install software
Code:

make install

.
QUES3:- Categorize various Common Shell Commands?
 ANS3:LS :- list files/directories in a directory, comparable to dir in windows/dos.
ls -al : shows all files (including ones that start with a period), directories, and details
attributes for each file.

cd : change directory · · cd /usr/local/apache : go to /usr/local/apache/ directory


cd ~ : go to your home directory
cd - : go to the last directory you were in
cd .. : go up a directory cat : print file contents to the screen

chmod: changes file access permissions


The set of 3 go in this order from left to right:
USER - GROUP - EVERONE

0 = --- Â No permission
1 = --X Â Execute only
2 = -W- Â Write only
3 = -WX Â Write and execute
4 = R-- Â Read only
5 = R-X Â Read and execute
6 = RW- Â Read and write
7 = RWX Â Read, write and execute
 ps: ps is short for process status, which is similar to the top command. It's used to
show currently running processes and their PID.
A process ID is a unique number that identifies a process, with that you can kill or
terminate a running program on your server (see kill command).

 ps U username : shows processes for a certain user


ps aux : shows all system processes
ps aux --forest : shows all system processes like the above but organizes in a
hierarchy that's very useful!

touch : create an empty file

file : attempts to guess what type of file a file is by looking at it's content.
file * : prints out a list of all files/directories in a directory

du : shows disk usage.


cp : copy a file
cp filename filename.backup : copies filename to filename.backup
mv : Move a file command
mv oldfilename newfilename : Move a file or directory from oldfilename to newfilename

rm : delete a file
rm filename.txt : deletes filename.txt, will more than likely ask if you really want to delete it
rm -f filename.txt : deletes filename.txt, will not ask for confirmation before deleting.
rm -rf tmp/ : recursively deletes the directory tmp, and all files in it, including subdirectories.

TAR: Creating and Extracting .tar.gz and .tar files


tar -zxvf file.tar.gz : Extracts the file
tar -xvf file.tar : Extracts the file
tar -cf archive.tar contents/ : Takes everything from contents/ and puts it into archive.tar
gzip -d filename.gz : Decompress the file, extract it

ZIP Files:Â Extracting .zip files shell command


unzip file.zip
chown: changes file ownership permissions
The set of 2 go in this order from left to right:
user group.
Ques4:- Give the series of commands to perform following operation:

Create a hierarchy of directories:


/home/user/hw1/hw2/hw3/hw4
Then create a file ‘assignment’ in above hierarchy.
Now change the permissions of ‘assignment’ such that only the creator of that file may
perform all operations on it.
After that, create a soft link of assignment file in /home/user/hw1/hw2 with ‘filesoft’
name.
And in the end create backup of /home/user/hw1/hw2 in /home/user/hw1 with
‘assign.tar’ name.
Ans4:-pwd
/home/user
mkdir –p /home/user/hw1/hw2/hw3/hw4

Touch /home/user/hw1/hw2/hw3/hw4/assignment

Chmod 776 assignment

Ln –s assignment /home/user/hw1/hw2/filesoft

Tar –cvf /home/user/hw1/assign.tar /home/user/hw1/hw2

Part-B
5. Differentiate between Super User Vs. Normal Users.?
Ans5 Superuser, or root, is a special user account used for system administration. In Linux
and Unix like computer operating systems, root is the conventional name of the user who has
all rights or permissions (to all files and programs) in all modes (single- or multi-user).

2.The root user can do many things an ordinary user cannot, such as changing the ownership
of files and binding to ports numbered below 1024. The etymology of the term may be that
root is the only user account with permission to modify the root directory of a Unix system.

3.Under Linux (and other Unixish oses) you use command called su. It is used is used to
become another user during a login session or to login as super user. If Invoked without a
username, su defaults to becoming the super user. It is highly recommend that you use
argument - to su command. It is used to provide an environment similar to what the user root
would expect had the user logged in directly. Type su command as follows:
$ su -
NORMAL USER:-Root is the superuser or administrator account that has complete control
over everything in the machine. Often used as a verb: to root a box is to gain administrative
(i.e. full) control over the system and own it. Key point: The term can be used as a verb. To
"root" machine is to break in and obtain root privileges, and their own the machine2.in
particular a user is prevented from performing special tasks,such as the following ,unless that
user has administrative privileges.:-

1.Global maintenance ,personalization and upgrade of the system.


2.Global installation of applications,devices,and their drivers.
3.Perodic backup of data.
4.user account management.
2.It is the administrator work that leaves normal users free to Carry out their day to day tasks.

6. Give introduction to Apache server. Write the various steps to Install and Start
Apache server?
Ans6 INTRODUCTION:-The Apache HTTP Server, commonly software notable for
playing a key role in the initial growth of the World Wide Web. Apache is developed and
maintained by an open community of developers under the auspices of the Apache Software
FoundationApache supports a variety of features, many implemented as compiled modules
which extend the core functionality. These can range from server-side programming language
support to authentication schemes. using free scripts such as AWStats/W3Perl or
Visitors.Virtual hosting allows one Apache installation to serve many different actual
websites. For example, one machine with one Apache installation could simultaneously serve
www.example.com, www.test.com, test47.test-server.test.com, etc.
Installing Apache:-
 You will have a binary file called httpd in the src directory. A binary distribution of
Apache will supply this file.

 The next step is to install the program and configure it. Apache is designed to be
configured and run from the same set of directories where it is compiled. If you want
to run it from somewhere else, make a directory and copy the conf, logs and icons
directories into it. In either case you should read the security tips describing how to
set the permissions on the server root directory.
 The next step is to edit the configuration files for the server. This consists of setting
up various directives in up to three central configuration files. By default, these files
are located in the conf directory and are called srm.conf, access.conf and httpd.conf.
 To help you get started there are same files in the conf directory of the distribution,
called srm.conf-dist, access.conf-dist and httpd.conf-dist. Copy or rename these files
to the names without the -dist. Then edit each of the files. Read the comments in each
file carefully. Failure to setup these files correctly could lead to your server not
working or being insecure. You should also have an additional file in the conf
directory called mime.types. This file usually does not need editing.
 First edit httpd.conf. This sets up general attributes about the server: the port number,
the user it runs as, etc. Next edit the srm.conf file; this sets up the root of the
document tree, special functions like server-parsed HTML or internal imagemap
parsing, etc. Finally, edit the access.conf file to at least set the base cases of access.

Type the following command for starting apache :-


# yum install httpd
Now, start the Apache/httpd

# chkconfig httpd on

# /etc/init.d/httpd start
 Type the following command
# up2date httpd
Start the Apache/httpd
# chkconfig httpd on
# /etc/init.d/httpd start
 Use apt-get command:
# apt-get install apache2
# /etc/init.d/apache2 start
 Verify that port 80 is open
# netstat -tulpn | grep :80

Ques7: How we can start and Test FTP server?

Ans7:-Start and testing of ftp server:-Now that you have the DNS and the Web Server up
and running, you probably want to know how to upload your pages remotely to the web
server. Well first of all, you need an FTP server to connect to; second, you need an FTP client
to talk to the FTP server.

If FTP server was installed during Linux installation, you should have it listed in the services
list as proftpd (wu-ftpd in red hat). You can set it to start automatically at boot time or you
can start it whenever you need it.
To start the service manually:

[root@server2 root]# service proftpd start

To restart the service:

[root@server2 root]# service proftpd restart

To stop the service:

[root@server2 root]# service proftpd stop

Once the server is running, your can connect to it with a client, it should respond. The
following figure is an FTP client. All you need is the username and the password to connect
to the server.

 For the host name you can use the domain name or the IP address, when your user
name and password are verified, you will be dropped in your home directory You can
browse to the correct directory /var/www/html, and if you have the correct
permission, you should be able to write and delete files in the html directory.

 Connecting like this is the default configuration, known as per user; which means that
basically any account in the system can login and by default will have permission in
the user's home directory.

Another option is set up an anonymous FTP server. This means that anyone, anywhere can
access the server; but due to security risks, I don't think you have to run an anonymous
server. If you do, make sure anonymous users have access to certain areas only.

Type the following command to start :-


# chkconfig vsftpd on
Type the following command:
# service vsftpd start
# service vsftpd stop
# service vsftpd restart

Open FTP port


Open /etc/sysconfig/iptables file, enter:
# vi /etc/sysconfig/iptables

Test ftp server


Type the following command:
$ ftp localhost
$ ftp ftp.server.com
$ ftp 202.54.1.1

8. How we can configure FTP server so that anonymous user can be able to upload files.
Ans8:-Step 1: Set up a new partition:-

The first danger to be considered when setting up anonymous FTP uploads is the possibility of
people filling up your drive.cert advises that the upload directory be on a dedicated drive; I think a
dedicated partition will suffice just as well. Either way, this will ensure that the important system
partitions will not be filled.

Step 2: Add the FTP user:-

Your FreeBSD system may already contain an entry in the password file for the ftp daemon. Recent
versions of FreeBSD include such an entry. If so, you can skip this step.
You'll need to create a user that anonymous FTP uploads and downloads will execute as. If you
chose to allow anonymous FTP when you first installed FreeBSD, you'll already have it; otherwise,
you'll need to create it:-
ftp:*:14:14:ftp:0:0:Mr. Anonymous FTP:/home/ftp:/nonexistent man hier indicates that the ftp home
directory should be /var/spool/ftp. This location can be acheived via symlinks which would allow
the physical directory to exist elsewhere. For example, if you set the home directory via vipw to be
/var/spool/ftp, you could put the actual files in /ftp/home (or whatever locationyou choose). Then
you would create a symbolic link with this sequence of commands:

cd /var/spool
ln -s /path/to/real/files ftp
Step 3: Set up the directory structure

Now we set up the directories people will see when FTP'ing in. Create the directory you set as ftp's's
home directory; here we're using /home/ftp. Inside that directory, create the following directories:

 etc
 pub
 incoming

Here are the commands to set up those directories in the ftp user's home directory.
# cd ~ftp
# mkdir pub
# mkdir incoming
# mkdir etc

Step 4: Set up /etc/fstab and recompile the kernel

To keep people from being able to delete other people's uploaded files, we'll need SUIDDIR
(explained in more detail below). We have to do two things to mount a file system SUIDDIR.
First, let's edit /etc/fstab.

Step 5: Setting permissions

When your system comes back up, do this:


chown -R root:wheel /home/ftp

cd /home/ftp

chmod 755 etc pub

chown nobody incoming

chmod 5777 incoming

The directories should now look like this:


drwxr-xr-x 4 root wheel 512 Nov 10 00:42 .

drwxr-xr-x 14 root wheel 512 Oct 20 14:58 ..

drwxr-xr-x 2 root wheel 512 Nov 10 00:44 etc

drwsrwxrwt 2 nobody wheel 512 Nov 10 00:45 incoming

drwxr-xr-x 2 root wheel 512 Nov 25 00:44 pub


Step 6: Edit /etc/login.conf

One extremely crucial thing I haven't discussed before about anonymous FTP uploads: it is
imperative that the anonymous user not be allowed to download files from /incoming. Otherwise,
your site will be used as a warez drop. And it will be found. Warez kiddies have scripts scanning
thousands of IPs looking for FTP sites, and then checking if they can upload and download
anonymously when they find one. If your site allows this, it will be announced on IRC when it is
discovered and your bandwidth will skyrocket until you figure out what's going on and fix it.

Step 7: Restart ftpd

Now all we have to do is restart ftpd with logging enabled. The line in /etc/inetd.conf .

Step 8: Test it to make sure it's right!

Be sure to test it out from a remote site; upload a file and make sure you can't download or delete it.
If you don't verify everything is correct, your server will most likely become the target of warez
kiddies.

You might also like