You are on page 1of 51

ftp

CIT 0563

Manual Lab Operating System


Administration 2
Contents
Lab 1: Install SuSE and partition.............................................................................................................. 4
1.1 Install SuSe .............................................................................................................................. 4
1.2 Partition disk ........................................................................................................................... 6
1.3 Setup the partition using the requirement that given on 2 .................................................... 6
1.4 Configure the SLES installation ............................................................................................... 9
Lab 2: Manage file permission .............................................................................................................. 10
2.1 Understand file permission ......................................................................................................... 10
2.2 Change file permissions with chmod .......................................................................................... 10
Exercise ............................................................................................................................................. 11
2.3 Change file ownership with chown and chgrp............................................................................ 11
2.4 Modify default access permissions ............................................................................................. 13
2.5 Configure special file permissions............................................................................................... 13
2.6 Practical Lab ................................................................................................................................ 14
2.7 Answer ........................................................................................................................................ 14
Lab 3: Manage users and groups .......................................................................................................... 16
3.1 Basics about users and groups .................................................................................................... 16
3.2 Manage user account.................................................................................................................. 16
3.3 Manage group ............................................................................................................................. 16
3.4 Practical lab ................................................................................................................................. 17
3.5 Answers ....................................................................................................................................... 17
3.6 Practical Lab2 .............................................................................................................................. 19
Lab 4: Setting up IP address .................................................................................................................. 20
4.1 IP address setup .......................................................................................................................... 20
4.2 Practical lab ................................................................................................................................. 21
Lab 5: Setting up DHCP server .............................................................................................................. 22
5.1 Step to setup dhcp server ........................................................................................................... 22
5.2 Practical lab ................................................................................................................................. 22
Lab 6: Setting up DNS server ................................................................................................................. 24
6.1 DNS terminology ......................................................................................................................... 24
6.2 Step to setup DNS server using command line ........................................................................... 25
6.3 Practical lab ................................................................................................................................. 25
Lab 7: Setting up Apache server .............................................................. Error! Bookmark not defined.
Lab 8: Setting up NFS server and NFS client ............................................ Error! Bookmark not defined.
Lab 9: Setting email server ....................................................................... Error! Bookmark not defined.
Lab 10: Setting up FTP server and client .................................................. Error! Bookmark not defined.
Lab 11: Setting LDAP server and client ................................................................................................. 46
Lab 12: Apply tar for incremental or full backup .................................................................................. 47
Lab 13: Apply acl with setfacl................................................................................................................ 48
Lab 14: Apply disk quota management ................................................................................................ 49
Lab 15: Configure log file in syslog.conf................................................................................................ 50
Lab 1: Install SuSE and partition

1.1 Install SuSe

Use in VMWare or VirtualBox platform.

1. Boot from the installation media

2. Select the system language -> English (US)

Tick agree
3. Select installation mode -> new installation

4. Set the clock and time zone


1.2 Partition disk

1. Requirement for partition disk


a. Server 1
i. 2 GB for /
ii. 2 GB for swap
iii. 4 GB for extra partition
b. Server 2
i. 2 GB for /
ii. 2 GB for swap
iii. 4 GB for extra partition

2. The basics of hard drive partitioning

a. Partition divide the available space of hard drive into the smaller portions
b. Every hard disk has a partition table space for 4 entries and correspond to a primary and
extended partition
c. Only 1 extended partition entry is allowed
d. Primary partition consists of a continuous range of cylinders assigned to a particular file
system (limited for 4 partition per hard disk)
e. Extended partition consists of a continuous range of cylinders but it can subdivided into
logical partition.
f. Logical partitions do not require entries in the main partition table

1.3 Setup the partition using the requirement that given on 2

1. Tick to create custom partition setup base on the requirement given

2. Tick the custom partitioning (for experts). Click Next


3. Ticks create option to do partitioning. Choose primary partitions. Do the following
a. For /
i. Filesystem: Reiser
ii. Mount point : /
iii. Size : 2 GB

b. For swap
i. Filesystem: swap
ii. Mount point : swap
iii. Size : 2GB
4. The partition installation is complete

5. In software selection, untick GNOME and tick the KDE environment


1.4 Configure the SLES installation

1. Set the hostname


a. For server 1 : server1
b. For server 2 : server2

2. Set the root password


a. For server 1 : toor
b. For server 2 : toor

3. Configure the network -> next

4. Configure network interfaces -> next

5. Test the internet connection -> no, skip this test

6. Novell customer centerconfiguratiom and online -> run update and next

7. Configure network services -> next ( must have the CA management information or LDAP server)

8. Manage users -> select authentication -> local -> next

9. Add local users -> next ( no key-in the users, it will add user at Lab 2) -> until finish

10. Do every steps for setup server 2


Lab 2: Manage file permission

2.1 Understand file permission

1. Use ls –l command to display the contents of current directory with the assigned permissions for
each file or subdirectory

2. The type of file


a. - : normal file
b. d : directory
c. l : link

3. Three permissions characters to a file or directory


a. Read (r) – allow the file to be read or the contents of a directory to be listed
b. Write (w) – allow the file to be modified. It allows files to be created or deleted within a
directory
c. Execute (x) – allow a file to be executed. It allows to change into a directory

4. Three permissions numeric to a file or directory


a. Read – 4
b. Write – 2
c. Execute – 1

5. The permissions characters represent (“ rwxrwxrwx”)


a. Character 1 to 3 : represent the permissions of the file owner
b. Character 4 to 6 : represent the permissions of the owning group
c. Character 7 to 9 : represent the permissions of all other users

2.2 Change file permissions with chmod

1. Use chmodcommand to add (+) or remove (-) the permissions

2. Both the owner and root can use this command

a. Owner – u
b. Group –g
c. Others – o
d. All – a

Example Result
chmodu+x The owner give permission for execute
chmod g=rw All group members can read and write
chmod u=rwx The owner can read, write and execute or give all permission

3. Suppose file named myfile.txt has 764 permission.


owner group others
rwx rw- r--
4+2+1 4+2+0 4+0+0

Exercise
Create a file name as netsec.txt and change the default permission of the file to certain condition which
is owner get all permission, groups can be read and write and others can execute only.

Root # vi netsec.txt

:wq

Root # 11

By default setting file will create 644 permission

Root # chmod 764 netsec.txt

2.3 Change file ownership with chown and chgrp

1. root can change the user and group affiliate of file by using command chown
example: chownnew_user.new_group file

2. to change the group affiliation using chgrp command


example: chgrp .new_group file

3. create file name called as hello.text under user root. Then, change the ownership from root to
jwong for hello.text using chown command.

answer:
root > vi hello.txt
:wq
Root >ls –al hello.txt or ll
Root >chown jwong.lab10 hello.txt

4. change the group for file hello.txt

root>ll hello.txt
root>chgrp lab10 hello.txt
2.4 Modify default access permissions

1. by default setting, file create with access 666 and directories with 777.

2. To modify the setting use umask command with 3 numeric digit such as 022

owner directories files


Default permission rwxrwxrwx rw- rw- rw-
7 7 7 6 6 6
umask --- -w- -w- --- -w- -w-
0 2 2 0 2 2
result rwx r-x r-x rw- r—r—
7 5 5 6 4 4

3. Create file name as example1 and create directory called as exampledir1 with umask 000. Then,
create file name as example2 and create directory called as exampledir2 with umask 022.

Root > touch example1


Root >mkdir exampledir1
Root >umask 000
Root > touch example2
Root >mkdir exampledir2
Root >umask 022

2.5 Configure special file permissions

1. Sticky bit use on folders in order to avoid the deletion of a folder and its content by other users

2. Example: create a project (A folder) where people will try to dump files for sharing but they
should not delete the files created by other users.

chmod 1757 /opt/dump


3. Three attributes used for special circumstances
Letter Number Names Files directories
t 1 Sticky bit Not applicable Users can only delete
files when they are the
owner or when they are
root or owner of
directory
s 2 SGID (set GID) When a program is Files created in this
run, this sets the directory belong to the
group ID of the group to which the
process to that of directory belongs and
the group of the not to the primary group
file of the user.
New directories crated
in this directory inherits
the SGID
s 4 SUID (set UID) Sets the user ID of Not applicable
the process to that
of the owner of file
when the program
is run

2.6 Practical Lab

1. Create a directory called /home/projecta to be shared

2. Owner of this directory is "root"


a. The directory is also belonging to the group “1ab10“
b. The group “lab10" and the owner have full access to this directory, no access at all for other
users
c. Only the owners can delete their own files
d. All files created in /home/projecta will belong to the group "lab10" regardless of the users'
primary GID

2.7 Answer

root> cd /home

root>mkdirprojecta
root>ll

root>chgrp lab10 projecta

root>chmod 770 projecta

root>chmod 1770 projecta

root>chmod 2770 projecta


Lab 3: Manage users and groups

3.1 Basics about users and groups

1. Users handles internally as numbers


2. The number which user receives called as UID
3. User root – UID 0
4. Each group allocated a number internally called as GID
5. Root group – GID 0
6. Types of group – normal groups, group by the system and root group

3.2 Manage user account

1. Useradd use for create new users


a. –m : generate the new user’s home directory
b. –c: use for comment especially full name of users
c. –u : specifies the UID
d. –g : specifies the GID
e. –p : create password
f. –e : set expiration date for account
2. Userdel use for delete existing account user
3. Usermod use to modify setting
4. Passwd use to change the password of user

3.3 Manage group

1. Groupadd use for create new group


2. Groupdel use for delete group
3. Groupmod use for modify the settings
4. Gpasswd use for create password for group
3.4 Practical lab

1. Create a new group called as “lab10”

a) GID = 2000

b) create on server 1 and server 2

2. Add the following users

a) Name = Ian Rush, username = irush, UID = 2010

b) Name = James Wong, username = jwong, UID = 2011

c) Name = Abdul Rahman, username = arahman, UID = 2012

i. the primary group for all new users is “lab10” and the secondary group is
“users”
ii. include the new users full names in the /etc /passwd file
iii. the user’s home directories located under /home
iv. do not create the home directories on server 2
v. the password for each user is “suse”

3.5 Answers

Server 1

 groupadd –g 2000 lab10

server 2

 groupadd –g 2000 lab10

2000 here is refer to the group ID


created above
Server 1

 useradd –m –g 2000 –G 100 –c “Ian Rush” –u 2011 irush


 useradd –m –g 2000 –G 100 –c “Abdul Rahman” –u 2012 arahman
 useradd –m –g 2000 –G 100 –c “James Wong” -u 2013 jwong
 passwdirush
 suse
 passwdarahman
 suse
 passwdjwong
 suse

Server 2

 useradd –g 2000 –G 100 –c “Ian Rush” –u 2011 irush


 useradd –g 2000 –G 100 –c “Abdul Rahman” –u 2012 arahman
 useradd –g 2000 –G 100 –c “James Wong” -u 2013 jwong
 passwdirush
 suse
 passwdarahman
 suse
 passwdjwong
 suse

3.6To display the registered users/group

Users information in /etc/passwd


1. Using cat command (will display detail properties of all users):
cat /etc/passwd

2. Using grep command


grep 2000 /etc/group
----> lab10:2000 (as result: display group name owned by the id)

3. Using id command:
id -g -n asharir
---> sem4ns3 (As result: display group own by the user)

Users encrypted password in /etc/shadow


1. tail /etc/shadow

example result from tail /etc/shadow:

[root@RHEL5 ~]# tail /etc/shadow


inge:$1$yWMSimOV$YsYvcVKqByFVYLKnU3ncd0:14054:0:99999:7:::
ann:!!:14054:0:99999:7:::
frederik:!!:14054:0:99999:7:::
steven:!!:14054:0:99999:7:::
pascale:!!:14054:0:99999:7:::
geert:!!:14054:0:99999:7:::
wim:!!:14054:0:99999:7:::
sandra:!!:14054:0:99999:7:::
annelies:!!:14054:0:99999:7:::
laura:$1$Tvby1Kpa$lL.WzgobujUS3LClIRmdv1:14054:0:99999:7:::

3.7 Practical Lab2

1. Change the full name of James Wong to James

Root >usermod –c “James” jwong

New names login name

2. Change the login name for siti to become ct

Root >usermod –l ctsiti


Lab 4: Setting up IP address

4.1 IP address setup

1. To display the IP address using ip address show command.

2. 3 interfaces:
a. Lo – the loopback device which available on every linux system
b. Eth0 – first Ethernet adapter of the computer
c. Sit0 – special virtual device which can be used to encapsulate IPv4 packets into IPv6 packets

3. To display information about the address by using ip link show command

4. The list possible attributes


a. Up – device is on
b. Loopback – device is loopback device
c. Broadcast – device can send packets to all hosts sharing the same network
d. Pointopoint – device is only connected to one other device which is all packets sent to and
receive from other device
e. Multicast – device can send packets to a group of other systems at the same time
f. Promisc – device listen to all packet on the network not only to those sent to the device’s
hardware address use for network monitoring

5. To display information about additional statistics information about the devices by using ip –s
link show eth0

6. To assign ip address using ip address add 10.0.0.2/24 brd + dev eth0 command

7. To delete ip address using ip address delete 10.0.0.2 dev eth0 command

8. To enable a network device using ip link set deveth0 up command

9. To view the routing table using ip route show command

10. To set a route to the locally connected network using ip route add 10.0.0.0/24 dev eth0
command

11. To set a route to a different network using ip route add 192.168.l.0/24 via 10.0.0.100 (gateway)
command
12. To delete entry from routing table use ip route delete 192.168.1.0/24 dev eth0
4.2 Practical lab

1. Setup IP address on server1 192.168.1.1/24

Server 1 # ip address add 192.168.1.1/24 brd + dev eth0

2. Display IP address on server1

Server1 # ifconfig

3. Display the link of IP address

Server1 # ip address show

4. Display the IP route

Server1 # ip route show


Lab 5: Setting up DHCP server

5.1 Step to setup dhcp server

1. Install the packages need to install the dhcp server


a. dhcp
b. dhcpclient
c. dhcp-server
2. Edit the dhcpd.conf configuration file
3. Check the IP address for dhcp server
4. Start the services
5. Try gain the IP address using dhcp client
6. Edit the configuration file if have a problem
7. Restart the services

5.2 Practical lab

1. Setup the dhcp server with IP address 192.168.211.1/24 (depends on the IP address given in
VMWare).

a. Add ip address in the machine:


ip add 192.168.211.1/24 brd + dev eth0
(option to delete/removeip address: ip add del 192.168.211.1/24 brd + dev eth0)
b. yast2 –idhcp
c. yast2 –idhcp-client
d. yast2 –idhcp-server
e. cd /etc
f. ll
g. cpdhcpd.confdhcpd.conf.ori
h. ifconfig
i. vi dhcpd.conf
edit slightly different configuration
subnet 192.168.211.0 netmask 255.255.255.0 {
range 192.168.211.210 192.168.211.254;
}
:wq
j. rcdhcpd status
k. rcdhcpd start
l. edit /etc/sysconfig/dhcpd
DHCP interface = “eth0” ->> or -> DHCP interface = “id-ur mac add number”
m. rcdhcpd restart
n. edit /etc/dhcpd.conf
host fantasia
hardware Ethernet xx:xx:xx:xx; (base on the MAC address)
fixed-address 192.168.211.1;

2. Setup the client to get the IP address from the dhcp server by using Windows XP.

If error happened, check vmware network


a. Go to windows xp setting.
b. Ipconfig /release
-Makesure u choosed bridge. (fromvmware
c. Ipconfig /renew
network setting)
d. Must get the IP address from the DHCP server
-In virtual box go to ‘device’ tab > network
adapter.

Select internal network-> ok

-promiscuous mode –select Allow VM.

Get back to windows the you will see the


network in windows retrieve ip from
dhcp server
Lab 6: Setting up DNS server

DNS (Domain Name Server) need to resolve the domain names and hostnames into IP address.

6.1 DNS terminology

zone The domain name space is divided into regions

DNS server A server that maintains the name and IP information


for a domain.

 A primary DNS server for master zone


 A secondary server for slave zone or slave
server without any zones for caching

Master zone DNS server Includes all hosts from network and DNS server
master zone stores up-to-date records for all the hosts
in the domain

Slave domain DNS server Copy of the master zone and obtain its zone data with
zone transfer operations from its master server. It
responds authoritatively for the zone as long as valid
zone.

Forwarder DNS server should send queries it cannot answer

Record Information about name and IP address.


a) NS record Records tells name server in charge
b) MX record Mail exchange – to contact for direct mail across the
internet
c) SOA record Start of authority – first record in zone file use to
synchronize data between multiple computer

6.2 Step to setup DNS server


Go to Yast> Software
1. Install the packages :- bind, bind-chroot, bind-devel, bind-doc >Software Management
> in search box: find the
2. Edit named.conf configuration file
vinamed.conf packages> install
3. Key in resolve information
4. Key in lookup information
5. Start services
6. If have problem, edit the lookup and resolve configuration and restart the services

6.3 Practical lab

Setup the DNS server with certain requirement

a. IP address 192.168.0.100/24ip address add 192.168.0.100/24 brd + dev eth0


b. Dns name : gmi.net
c. Hostname : alex

Do the following steps to install DNS server

a. yast2 –i bind
b. yast2 –i bind-chroot
c. yast2 –i bind-devel
d. yast2 –i bind-doc
e. cd
f. cd /etc/
g. vi named.conf
h. :set number
 Line 127
 Esc y8 -> to copy
 p -> to paste
 then edit with following information
or

:set number

at line 136

type it

zone “gmi.net” in { To create file for


reversed lookup
type master;
configuration
file “gmi.net.zone”;

zone “0.168.192.in-addr.arpa” in { To create for


forward lookup
type master;
configuration
file “192.168.0.zone”;

:wq -> save and quit from the filename named.conf

i. cd /var/lib/named
j. ll Copy file 127.0.0.zone to file 192.168.0.zone
k. cp 127.0.0.zone 192.168.0.zone
Copy file localhost.zoneto file
l. cplocalhost.zonegmi.net.zone
Edit m. ll gmi.net.zone
configuration file n. vi gmi.net.zone
192.168.0.zone
(forward IN SOA gmi.net root.gmi.net
lookup)&gmi.net.
IN NS alex.gmi.net
zone (reversed
lookup) alex IN A 192.168.0.100

:wq

o. vi 192.168.0.zone
IN SOA gmi.net. root.gmi.net.
IN NS alex.gmi.net.

100 IN PTR alex.gmi.net.

:wq
p. vi /etc/resolv.conf To resolve or translate the
search gmi.net ipaddres to domain name
nameserver 192.168.0.100 gmi.net
:wq

To check whether the info


q. yast2 lanOR
configuration (ip/domain name)
yast> device -> NIC > next >edit
which using command line
static
above able to mapped (start
192.168.0.100 from step h to step p).
Hostname > modify
Hostname = alex If the info not exist (cause by
Domain name = gmi.net several problem in NIC itself),
manually key in the info as
>next
display in step q.
> finish
r. cd .. Here, manually check the info
s. rcnamed start for NIC setup (tcp/ip properties)
Start DNS service
t. cd /etc
u. vi named.conf
v. rcnamed restart
If error exists, get back
w. nslookup alex.gmi.net
to step n& step o and
x. nslookup 192.168.0.100
save the configuration.

The restart the services

(reverse lookup)Will display info


(forward lookup) Will display with the ip that mapped with
info with the ip that mapped domain alex.gmi.net + ip add
with domain alex.gmi.net + ip which is 192.168.0.100
add which is 192.168.0.100
P/s: if not map with ip
P/s: if not map with ip 192.168.0.100  error  start
192.168.0.100  error  start over from step n till finish
over from step n till finish
Lab 7: Setting up Apache server

7.1 Steps to setup web server

1. Install packages at server1:- apache2, apache2-doc, apache2-example-pages


2. At server1
a. Key in IP address for two network card with name eth01 and eth02
b. Edit configuration /etc/hosts
c. Start the services
3. At server2
a. Add two user system
b. Edit configuration file /etc/hosts
c. Check using Mozilla whether can get access the website

7.2 Practical lab


Preparation: U need have 4 ip add (server1, server 2, geeko and cicak)

1. On server 1 – (apache server /webserver)


a. ip address add 192.168.111. 1/24 brd + dev eth0 Assign ip address for server 1
b. Yast2 –i apache2
c. Yast2 –i apache2-doc If assign ip using
d. Yast2 –i apache2-example-pages ip add command
e. yast2 http-server -> enter -> (continue press next button until finish ) is not working,
f. Yast2 lan -> edit -> advanced -> additional address -> add you may assign
i. Alias name: eth01 192.168.111.201/24 ip add manually.
ii. Alias name: eth02 192.168.111.202/24
Yast2> enter
g. Edit /etc/hosts
Edit in /etc/hosts. >network
192.168.111.201 www.geeko.org card>choose
192.168.111.202 www.cicak.com Register/assignip add for server staticip add ->
h. rcapache2 status geeko and cicak (add ip start from then add ip
i. rcapache2 start the last line)
j. cd /srv/www/htdocs
Save file
k. cp index.html cicak

2. On server 2 (client)
a. ip address add 192.168.111.2/24 brd + dev eth0 Assign ip address for server 2
b. Useradd –m –g 100 –u 1001 geeko
c. Useradd –m –g 100 –u 1002 cicak
d. Edit /etc/hosts If assign ip using ip add command is not
working, you may assign ip add manually.

Yast2 enter > network card>choose


staticip add -> then add ip
192.168.111.201 www.geeko.org
192.168.111.202 www.cicak.com

If ping result is unreachable, check ip


e. Ping 192.168.111.201
add for both server 1 and server 2
f. Ping 192.168.111.202
ifconfig.
g. Browse the website Both server 1 and server 2 must have ip
add (192.168.111.1 and 192.168.111.2
www.geeko.org each). If there is no ip, repeat step 1a
and 2a
orwww.cicak.com
Lab 8: Setting up NFS (Network File System) server and NFS client

Network File System (also known as NFS) is a protocol developed by Sun Microsystems. It allows a user
on a computer to access files that are sent across a network – similar to the way one accesses local
storage. It is most common in systems with a similar composition to the UNIX system; however, it is also
readily available for other systems, such as Mac OS, OpenVMS, Microsoft Windows, Novell NetWare,
and IBM AS/400

In other words: in NFS, file sharing can be done between linux operating system. While file sharing is
SAMBA canhappened between linux operating system and other operating system (with supporting
tools).

8.1 Steps to setup NFS (Nework File System ) server

1. Determine directory to “export”


2. Edit /etc/exports configuration files
a. Directory
b. Subnet
c. Parameter
3. Start services for NFS server
4. Ensure NFS server starts

8.2 Steps to setup NFS client

1. Edit /etc/fstab configuration file


2. Create mountpoints
a. NFS server IP
b. Directory from NFS server
c. Mountpoint
d. Parameters
e. File system
3. Mount the edited /etc/fstab
8.3 Practical lab

Objective for this lab:


1. To assign server 1 as nfs server and create file to be shared with client
2. To assign server 2 as nfs client and recognize the host that has been assign as nfs server
(through ip address)
3. To connect nfs client with nfs server and make sure that client able to access file shared by nfs
server.

On server 1

Create a group names lab20 with GID 6000 and create user base on the requirements below:-

Full names Login name UID


Nabilahhuda abil 6001
Wong Mei Quan wong 6002
Sridevi sri 6003
i. the primary group for all new users is “lab20” and the secondary group is
“users”
ii. include the new users full names in the /etc /passwd file
iii. the user’s home directories located under /home
iv. the password for each user is “arbe”

Create two directory under /mnt that are student and trainer. Both directories must have all permission
for the owner, all permission for group and read write permission for others. The IP address for server 1
is 192.168.111.128/24 and server 1 becomes the NFS server.

Configure the exports which student and trainer directory.

a. Directory – student and trainer


b. Subnet – 192.168.111.0/24
c. Parameter – read write, synchronous, root_squash

On server 2

Create a group names lab20with GID 6000 and create user base on the requirements below:-

Full names Login name UID


Nabilahhuda abil 6001
Wong Mei Quan wong 6002
Sridevi sri 6003
i. the primary group for all new users is “lab20” and the secondary group is
“users”
ii. do not create the home directories on server 2
iii. the password for each user is “arbe”

Create two directory under /mnt that are stu and train. The IP address for server 2 is
192.168.111.129/24 and server 2 becomes the NFS client.

Configure the imports (/etc/fstab) which stu and train directory.

a. Map IP address for NFS server


b. Map information the link student and trainer (NFS server) into stu and train (NFS client) with the
complete filesystem types and parameters

On server 1

1. yast2 nfs_server
2. yast2 nfs
3. ifconfig
4. ip address add 192.168.111.128/24 brd + dev eth0
5. groupadd –g 6000 lab20
6. useradd –m –g 6000 –G 100 –c “Nabilahhuda” –u 6001 abil
7. passwdabil
8. aber
9. useradd –m –g 6000 –G 100 –c “Wong Mei Quan” –u 6002 wong
10. passwdwong
11. aber
12. useradd –m –g 6000 –G 100 –c “Sridevi” –u 6003 sri
13. passwdsri
14. aber Create directory mnt
Currently none content exist in directory /mnt
15. cd /mnt
direct
16. ll
17. mkdir student Change mode user trainer (775):
18. mkdir trainer u=rwx,g=rwx,o=rx

19. chmod 775 trainer


20. vi trainer1
(press Esc shift+: wq!) ---to save configuration
21. chmod 775 student
22. vi student1
(press Esc shift+: wq!) ---to save configuration
23. vi /etc/exports ---create the NFS deamon
/mnt/student 192.168.111.0/24(rw,sync,root_squash)
/mnt/trainer 192.168.111.0/24(rw,sync,no_root_squash)
(press Esc shift+: wq!) ---to save configuration
Now, u will see list of object student,student1,trainer and
24. cd /mnt trainer 1 with differ permission
25. ll

26. rcnfsserver start --to start nfs server


27. rcnfsserver status --to check status nfs server
28. showmount –e --verify with showmount command that you have successfully shared data
folder
This will list /student and /trainer you allow to share (export).
Or u may type: showmount –e 192.168.111.128 , which
29. rcSuSEfirewall2 stop 192.168.111.128 is the server’s ip add.
30. rcnfsserver restart
31. insserv /etc/init.d/nfsserver --To boot up services automatically whenever the system
reboot

On server2

1. yast2 nfs To define ip add for server2


2. ifconfig
3. ip address add 192.168.111.129/24 brd + dev eth0
4. groupadd –g 6000 lab20
5. useradd –g 6000 –G 100 –c “Nabilahhuda” –u 6001 abil
6. passwdabil
7. aber
8. useradd –g 6000 –G 100 –c “Wong Mei Quan” –u 6002 wong
9. passwdwong
10. aber
11. useradd –g 6000 –G 100 –c “Sridevi” –u 6003 sri
12. passwdsri
13. aber
14. cd /mnt
Related with step 14, here u make directory stu under mnt directory
15. ll
16. mkdirstu
Fstab is file system table: it provides status file system information
17. mkdir train
18. vi /etc/fstab
192.168.111.128 server1
192.168.111.128:/mnt/student /mnt/stu nfs rw,noexec,sync
192.168.111.128:/mnt/trainer /mnt/train nfs rw,noexec,sync
19. showmount –a
mountclntudp_create: RPC: Program not registered --if this problem exists:
with other operating system (with supporting tools):
Insert ip address: showmount –a 192.168.222.128
Showmount –a (to import folder from the
stated IP addres: server1)
If after enter above it shown: Already connected to server
All mount points on 192.168.111.128 192.168.111.128 but cannot display
Solution: the data
mount –o soft 192.168.111.128:/mnt/student /mnt/stu
mount –o soft 192.168.111.128:/mnt/student /mnt/stu Mount –o = manually mounted
server1 data (192.168.111.128).

showmount –a 192.168.111.128 -to verify mounted files From /mnt/student (server 1) to


/mnt/stu (server2-client)
result:
Next line
All mount points on 192.168.111.128:
192.168.111.0/24: /mnt/student From /mnt/student (server 1) to
192.168.111.0/24: /mnt/trainer /mnt/stu (server2-client)

192.168.111.129:192.168..111.0/24
Here it shown that all files already detected from server1
(192.168.111.128) to server2(client).
20. mount -to mount server 1 to server 2
result: will display files that already mounted
(detected) from server 1
(Here will shown how many usage provided for both mount
21. df –h -- to display disk usage point (/mnt/student and/mnt/trainer))
22. showmount –e 192.168.111.128

This will list all files n folder shared in nfs


daemon (/export in nfs server)  in another
word, nfs client able to view shared files in nfs
server (ip add nfs server: 192.168.111.128)

Here can verify files shared from server 1 same


as what can be access by client (server 2)
8.4 Practical lab2 (Network File System-NFS)

On Server1

a. Create a new partition and mount it at /jobs

- Size is 1.5GB

- Filesystem is ext3

- Partition to be mounted automatically at boot

b. Create a directory called /jobs/projecta to be shared


- Owner of this directory is "root"

- The directory is also belonging to the group "projecta"

- The group "projecta" and the owner have full access to this directory, no access at all for
other users

- Only the owners can delete their own files

- All files created in /jobs/projecta will belong to the group "projecta" regardless of the users'
primary GID

d. Setup the NFS server to export the directories /home and /jobs/projecta

- Workstations from the subnet 192.168.1.0/24 to access /home and /jobs/projecta

- Allow read/write access for both directories

- No access for root

- The NFS server to be automatically started during a reboot

On Server2

e. Setup Server2 to mount the the shared directories automatically from Server1 during boot

- The directories /home and /jobs/projecta from Server1 are to be mounted to /home and
/jobs/projecta respectively

- Read and write buffer size is 8KB

*8KB = 8192 bytes


- Binaries or shell scripts are not allowed to be executed
Lab 9: Setting samba Server

9.1 Steps to set samba server

1. determine directory to share


2. edit /etc/samba/smb.conf
a. workgroup
b. sharename
c. comment
d. subnet
e. path
f. various read write parameters
g. masks
3. add user to the samba server
4. test the system in smb.conf configuration file
5. start samba services
6. make the samba server start at bootup

9.2 Steps to setup samba client

1. use the samba client to do the lookup and connect to the samba server
2. use mount to use the samba share as a local directory

9.3 Practical lab

On Server1 (samba server)

a. Workgroup is to be called "Projects"


b. Setup /mnt/studentto be shared with the name "students"
- comment for this directory is this shared directory for student only
- create directory path information
- Workstations from the subnet 192.168.111.0/24 to have access to the share
- The directory must bebrowseable
- All files created to have read and write access for owner and read for group (permission 0660)
-directory can be full permission for owner and read execute for group (permission 0750)

p/s: How to recognize files or directory in the list?

If having (-) in front of the name ==it is file

If having (d) in front of the name ==it is directory

c. Setup /mnt/trainer to be shared with the name "trainers"


- comment for this directory is this shared directory for trainer only
- The directory must be browseable
- All files created to have read and write access for the owner and group only
- Workstations from the subnet 192.168.111.0/24 to have access to the share
d. Create a group called as GMI with GID 4000
e. Create a user name Justin Bieber with uid 4010 and login name justin. (the primary group for all
new users is “GMI” and the secondary group is “users”)
f. Create password for Justin which is 1234
g. Add the the users to /etc/samba/smbpasswd. The password is "novell"
h. The Samba server is to be restarted at boot
i. You can test the Samba share from Server2 using "smbclient"

On server1

1. yast2-i samba samba-client samba-doc


2. cd /etc/samba
3. ll
4. cpsmb.confsmb.conf.ori
5. edit smb.conf
6. [global]
7. workgroup=Projects
8. [students]
9. comment = This shared directory for home only
10. path = /mnt/student
11. hostsallow = 192.168.1.0/24
12. browseable = no
13. read only = yes
14. writeable = yes
15. directory mask =0750
16. create mask = 0660
17. [trainer]
18. comment = this shared directory for projects only
19. path = /mnt/trainer
20. browseable = yes
21. read only =yes
22. hostsallow = 192.168.111.0/24
23. writeable = yes
24. testparm
25. groupadd –g 5000 GMI
26. useraddd –m –g 5000 –G 100 –c “Justin Bieber” –u 5010 Justin
27. passwd Justin
28. 1234
29. smbpasswd –a Justin
30. passwd : novell
31. rcsmb start
32. vi smb.conf
33. rcsmb restart
34. nmbd restart
35. ip address add 192.168.111.128/24 brd + dev eth0
36. rcSuSEfirewall2 stop

On server2

1. yast2 –I samba-client
2. rcSuSEfirewall2 stop
3. smbclient –L//192.168.111.4 –U Justin
4. cd mnt
5. ll
6. mkdirsambashare
7. smbclient //192.168.111.4/student –U Justin
8. passwd = novell
9. smb:\>ls
10. smb:\> get tt
11. smb:\> exit
12. mount –t smbfs //192.168.111.128/trainer /mnt/sambashare –o username=Justin
13. mount
14. ip address add 192.168.111.129/24 brd + dev eth0
Lab 10: Setting email server
Requirement to setup email server – dns server

10.1 DNS server (IP address = 192.168.111.1/24)


1. yast2 –i bind bind-chrootenv bind-devel bind-doc
2. cd /etc
3. ll
4. cp named.conf named.conf.ori

after line 127


zone “saya.org” in {
type master;
file “saya.org.zone”;
};

zone “111.168.192.in-addr.arpa” in {
type master;
file “192.168.111.zone”;
};

:wq
5. cd /var/lib/named
6. ll
7. cp 127.0.0.zone 192.168.111.zone
8. cp localhost.zone saya.org.zone
9. ll
10. edit 192.168.111.zone

IN SOA saya.org root.saya.org

IN NS server1.saya.org

1 IN PTR server1.saya.org

:wq

11. edit saya.org.zone


IN SOA saya.org root.saya.org
IN NS server1.saya.org
server1 IN A 192.168.111.1
:wq
12. edit /etc/resolv.conf
search saya.org
nameserver 192.168.111.1
nameserver 192.168.111.128

:wq
13. edit /etc/HOSTNAME
server1.saya.org
:wq
14. yast2 lan
NIC -> edit
Static IP address: 192.168.111.1
Netmask: 255.255.255.0
Hostname: server1
Domain name: saya.org
Click -> advanced -> additional address
->eth01
->192.168.111.128
->255.255.255.0
15. rcnamed start
16. rcSuSEfirewall2 stop
17. nslookup 192.168.111.1
18. nslookup server1.saya.org

10.2 Email server(IP address = 192.168.111.128/24)

1. rpm –q postfix
2. edit /etc/postfix/main.cf
delete #
myhostname=server1.saya.org
mydomain=saya.org
inet_interfaces=all
mydestination=$myhostname, localhost.$mydomain, local.$mydomain, mail.$mydomain,
www.$mydomain, ftp.$mydomain

add #
#myhostname=server1.saya.org
#inet_interfaces=localhost
#mydestination=$myhostname, localhost.$mydomain
:wq
3. postmap hash:/etc/postfix/transport
4. rcpostfix status
5. rcpostfix start
6. telnet server1.saya.org 25
7. quit
8. telnet 192.168.111.1 25
9. quit
10. telnet 192.168.111.128 25
11. quit

10.3 setting MDA


1. yast2 –I cyrus-imapd
2. cd /etc
3. ll
4. cpimapd.confimapd.conf.ori
5. ll
6. edit imapd.conf
7. edit /etc/postfix/transport
under add
#yourDomaincyrus
8. postmap hash:/etc/postfix/transport
9. rcsaslauthd start
10. rccyrus start
11. telnet server1.saya.org 110
12. quit
13. telnet server1.saya.org 143
14. quit
Lab 11: Setting up FTP server and client

11.1 LVM
On Server1

a) Setup LVM (logical volume management)

• Size : 100MB

• Filesystem: 0x8e

• Usage for ftp : 50 MB

1. yast2 disk -> file system: 0x8e LVM -> size:100MB -> next
2. LVM -> filename:ftp1->next -> size:50MB->next-> until finish

11.2 FTP server


b) Setup ftp server on server1 (192.168.111.131/24, port no: 21)

• Install packages – pure-ftpd

• Edit configuration file for pure-ftpd.conf

• Bind the ip address and port number

• Start the services

• Give full permission for owner, read and execute for group and full permission for others -
/srv/ftp

• Open new console

• susri

• Create file c1 c2 c3 c4 c5

• Add on the port at firewall setting at /etc/sysconfig/SuSEfirewall2

• Stop services firewall

On server2

• Stop firewall services\

• Open new console

• sucicak
• Create file cc1 cc2 cc3 cc4 cc5

• Connect to ftp server: server1 or 192.168.111.131

• Get : to download

• Put : to upload

• Get c1 for server1

Server1 (FTP server=192.168.111.131/24)

1. yast2 –i pure-ftpd
2. cd /etc/pure-ftpd
3. ll
4. cp pure-ftpd.conf pure-ftpd.conf.ori
5. ll
6. edit pure-ftpd.conf
Bind 192.168.111.131,21
:wq
7. rcpure-ftpd start
8. cd /srv
9. ll
10. mkdir ftp
11. ll
12. chmod 757 ftp
13. rcSuSEfirewall2 stop

new console

1. susri
2. cd /srv/ftp
3. ll
4. touch c1 c2 c3 c4 c5
5. ll
6. yast2 firewall -> advanced add port 21
7. edit /etc/sysconfig/SuSEfirewall2
FW_LOAD_MODULES=ip_conntrack_ftp
FW_SERVICES_ACCEPT_EXT=”0/0,tcp,21”
:wq
Server2 (FTP client IP address= 192.168.111.132/24)

new console
1. useradd –m –g 100 –c “cicak” –u 1001 cicak
2. sucicak
3. cd
4. pwd
5. ll
6. cd Documents
7. ll
8. touch a1 a2 a3 a4 a5
9. ftp 192.168.111.131
10. ls
11. get c1
12. exit

get – download
put –upload
Lab 11: Setting LDAP server and client
Lab 12: Apply tar for incremental or full backup
Lab 13: Apply acl with setfacl
Lab 14: Apply disk quota management
Lab 15: Configure log file in syslog.conf

You might also like