Perl Assignment #10: File Tests

 

CS 447/647

Spring, 2012

 

 

Due: 4/10/12

 

Read chapter 12 of Learning Perl.  Do exercises 1 and 2.

 

Submit your assign10.txt and handson10.txt via Web Campus.

 

 

Hands-On Exercise

 

Hands-on is on the other side


 

Setup NFS – for reference see: https://help.ubuntu.com/community/NFSv4Howto

   Sudo bash

   apt-get install nfs-kernel-server

   mkdir -p /export/home

   mount --bind /home /export/home

   cp /etc/fstab /etc/fstab.save

   # Make sure you use >> so you don't overwrite /etc/fstab

   echo "/home /export/home none bind 0 0" >> /etc/fstab

   # Make the following change to nfs-kernel-server     

   vim /etc/default/nfs-kernel-server

NEED_SVCGSSD=no # no is default

   # Make the following changes to nfs-common

   vim /etc/default/nfs-common

NEED_IDMAPD=yes

NEED_GSSD=no # no is default

   cp /etc/exports /etc/exports.save

   # Make sure you use >> so you don't overwrite /etc/exports

   # If you install from offcampus you need to change the network

   # numbers below to match what you have at home

   cat >> /etc/exports <<EOF

/export       134.197.34.0/24(rw,fsid=0,insecure,no_subtree_check,async)

/export/home  134.197.34.0/24(rw,nohide,insecure,no_subtree_check,async)

EOF                 

   reboot

   sudo bash

   mkdir /nfshome

   # Substitute your hostname or IP for cselabX in these commands

   mount -t nfs4 -o proto=tcp,port=2049 cselabX:/ /nfshome

   ls -l /nfshome

 

   # Make the mount permanent in fstab

   echo "cselabX:/home   /nfshome   nfs4    _netdev,auto  0  0" >> /etc/fstab

 

Setup Autofs – For reference see: https://help.ubuntu.com/community/Autofs

  apt-get install autofs

  cp /etc/auto.master /etc/auto.master.save

  echo "/nfs /etc/auto.nfs" >> /etc/auto.master

  echo "cselabX -fstype=nfs4 cselabX:/home" >> /etc/auto.nfs

  # Restart Autofs so changes will take effect

  service autofs stop

  service autofs start

  ls -l /nfs/cselabX

 

script handson10.txt

PS1='$ '

tail /etc/exports /etc/fstab /etc/auto.master /etc/auto.nfs

df -h |grep home

exit