Oleg firmware

From WIKI-WLAN

Jump to: navigation, search

Odkar ASUS WL-300, WL-500b, WL-500b/v2, WL-500g, WL-500gx (deluxe, premium) ASUS-WLHDD uporabljajo firmware na osnovi Linux-a, je moral ASUS objaviti GPL kodo.

Eden od pomembnih alternativnih firmvarov na osnovi te kode je Oleg firmware, ki vključuje v firmware dodatne "strežniške" zmogljivosti. Ena od pomembnih lastnosti je možnost enostavnega nameščanja dodatnih paketov Optware, ki razširi že razširjene zmogljivosti samega Oleg firmvera in tako lahko spremenimo ruter v zmogljivo Linux škatlo.

http://wl500g.dyndns.org/


Vsebina

Kako formatiramo 320GB disk Western Digital WD3200

Za uporabo na wl500gx in dodatnega programja Optware na Oleg firmware. Za telnet program priporočam putty, ki zna tudi ssh.

Logiramo se na router

telnet my.router
oleo login: admin
Password: admin
[admin@oleo root]$


Poglejmo kaj javi jedro:

hub.c: new USB device 01:02.2-1, assigned address 2
scsi0 : SCSI emulation for USB Mass Storage devices
  Vendor: WDC WD32  Model: 00JB-00KFA0       Rev:  0 0
  Type:   Direct-Access                      ANSI SCSI revision: 02
Attached scsi disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: 625142448 512-byte hdwr sectors (320073 MB)
Partition check:
 /dev/scsi/host0/bus0/target0/lun0: unknown partition table
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 2

Disk je prazen in nima nobenih particij. Najprej naredimo le te.

[admin@oleo root]$ fdisk /dev/discs/disc0/disc
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.

The number of cylinders for this disk is set to 38913.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
    (e.g., DOS FDISK, OS/2 FDISK)
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)  
Command (m for help): p  
Disk /dev/discs/disc0/disc: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Najprej bomo naredili 2GB particijo za /opt software. Dobro je imeti particionirano disk tako, da particije začnejo na cylinder bounary. Če tega ne upoštevate potem imate na koncu velikosti particije oznako plus. Primer takega particioniranja:

Command (m for help): p 

Disk /dev/discs/disc0/disc: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

                Device Boot    Start       End    Blocks   Id  System
/dev/discs/disc0/part1               1         250     2008093+  83  Linux
/dev/discs/disc0/part2             251         313      506047+  82  Linux swap
/dev/discs/disc0/part3             314       38913   310054500   83  Linux

Za enote piše, da en cilinder vzame 8225280 bytov. Če želimo izračunati za 2GB, koliko to znese cilindrov uporabimo račun 2*1024*1024*1024/8225280=261.1 Zadovoljimo se z 261 cilindri. in tako naredimo prvo particijo za /opt programe.

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-38913, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-38913, default 38913): 261 
Command (m for help): p 

Disk /dev/discs/disc0/disc: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes 
               Device Boot    Start       End     Blocks   Id  System
/dev/discs/disc0/part1               1         261     2096451   83  Linux

Nadaljujemo z kreiranjem 512MB swap particije. 261/4=65. 65+262=327

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (262-38913, default 262):
Using default value 262
Last cylinder or +size or +sizeM or +sizeK (262-38913, default 38913): 327

Command (m for help): p

Disk /dev/discs/disc0/disc: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes 

               Device Boot    Start       End    Blocks   Id  System
/dev/discs/disc0/part1               1         261     2096451   83  Linux
/dev/discs/disc0/part2             262         327      530145   83  Linux

Pomembno. Particijo št 2 je potrebno označiti z tipom swap, ki ima številko 82.
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap)

Command (m for help): p 
Disk /dev/discs/disc0/disc: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

                Device Boot    Start       End    Blocks   Id  System
/dev/discs/disc0/part1               1         261     2096451   83  Linux
/dev/discs/disc0/part2             262         327      530145   82  Linux swap


Sledi še particioniranje za preostanek diska za uporabniške datoteke:

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (328-38913, default 328):
Using default value 328
Last cylinder or +size or +sizeM or +sizeK (328-38913, default 38913):
Using default value 38913

Command (m for help): p

Disk /dev/discs/disc0/disc: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes 
               Device Boot    Start       End     Blocks   Id  System
/dev/discs/disc0/part1               1         261     2096451   83  Linux
/dev/discs/disc0/part2             262         327      530145   82  Linux swap
/dev/discs/disc0/part3             328       38913   309942045   83  Linux

Vse skupaj je potrebno še zapisati na disk z

Command (m for help): w
The partition table has been altered! 
Calling ioctl() to re-read partition table.
Syncing disks.
[admin@oleo root]$


Po napornem particioniranju sledi še formatiranje kreiranih particij. A popreje je bolje še se naredi virtualni spomin (swap) in se ga aktivira:

[admin@oleo root]$ mkswap /dev/discs/disc0/part2
mkswap: warning: truncating swap area to 524284kB
Setting up swapspace version 1, size = 536862720 bytes
[admin@oleo root]$ swapon /dev/discs/disc0/part2
[admin@oleo root]$ free
              total         used         free       shared      buffers
  Mem:        30148         9320        20828            0         1100
 Swap:       524276            0       524276
Total:       554424         9320       545104

Zdaj pa formatiramo /opt particijo z enostavnim ukazom:

[admin@oleo root]$ mke2fs -j -M /opt -L opt /dev/discs/disc0/part1
mke2fs 1.35 (28-Feb-2004)
Filesystem label=opt
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
262144 inodes, 524112 blocks
26205 blocks (5.00%) reserved for the super user
First data block=0
16 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done 

This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

Particijo za uporabniške datoteke bomo formatirali nekoliko drugače, saj lahko upoštevamo, da bodo datoteke velike in bi bilo osnovno formatiranje z veliko superbloki potrata diska. Ravno tako ne bomo nič diska rezervirali za superuserja, ker bo najverjetneje en sam uporabnik na sistemu. Število i-nodov bomo naredili na vsakih 512KB po enega. Se pravi dva i-noda na 1MB. Za 300000MB to pomeni max 6000000 datotek.

[admin@oleo root]$ mke2fs -j -i 524288 -m 0 -M /tmp/harddisk -L user-data /dev/discs/disc0/part3
mke2fs 1.35 (28-Feb-2004)
Filesystem label=user-data
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
605440 inodes, 77485511 blocks
0 blocks (0.00%) reserved for the super user
First data block=0
2365 block groups
32768 blocks per group, 32768 fragments per group
256 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
       4096000, 7962624, 11239424, 20480000, 23887872, 71663616

Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done 

This filesystem will be automatically checked every 24 mounts or 
180 days, whichever comes first.  Use tune2fs -c or -i to override.


Zdaj še ročno mountajmo particiji na ustrezni mesti:

[admin@oleo root]$ mount /dev/discs/disc0/part1 /opt
[admin@oleo root]$ mount /dev/discs/disc0/part3 /tmp/harddisk

Poglejmo koliko je prostega prostora in koliko datotek je možno na posamezno particijo shraniti:
[admin@oleo root]$ df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/root                 2688      2688         0 100% /
/dev/discs/disc0/part1  2063504     32828   1925856   2% /opt
/dev/discs/disc0/part3309846164     32828 309813336   0% /tmp/harddisk

Sistemu je potrebno dopovedati, da ob vsakem zagonu aktivira swap particijo in mounta particiji na ustrezno mesto. To napišemo v post-boot datoteki:

[admin@oleo root]$ mkdir /usr/local/sbin
[admin@oleo root]$ cd /usr/local/sbin
[admin@oleo sbin]$ cat > post-boot << __EOF__
#!/bin/sh
if [ `nvram get usb_smbenable_x` = 0 ]; then
        insmod scsi_mod
        insmod usb-storage
        insmod sd_mod
fi
( for i in 1 2 3 4 5 6 7 8 9 10; do
  if [ -b /dev/discs/disc0/part1 ]; then
       /bin/mount -t ext3 -o noatime /dev/discs/disc0/part1 /opt
       /bin/mount -t ext3 -o noatime /dev/discs/disc0/part3 /tmp/harddisk
       /sbin/swapon /dev/discs/disc0/part2
       break
  fi
  echo "Cakam $((i*3)) sekund"
  sleep 3 
done ) > /tmp/mount.log 2>&1
swapon /dev/discs/disc0/part2
# Pobrisimo audio module. Kdo pa to rabi
killall waveservermain
rmmod audio
rmmod soundcore
# Pa se tiskalnik
killall p910nd
killall lpd
killall infosvr
rmmod printer
# Razne ponastavitve
echo 8192 >  /proc/sys/net/ipv4/ip_conntrack_max

# Disable response to broadcasts.
# You don't want yourself becoming a Smurf amplifier.
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts

# Enable bad error message protection.
echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses

#echo '600 1800 120 60 120 120 10 60 30 120' > /proc/sys/net/ipv4/ip_conntrack_tcp_timeouts
__EOF__

Seveda lahko namesto tega uporabimo editor visual eye (vi post-boot).

Za permanentno shranitev te nastavitve uporabimo flashfs ukaz.

[admin@oleo sbin]$ flashfs save
tar: Removing leading '/' from member names
...
[admin@oleo sbin]$ flashfs commit
Commited.
[admin@oleo sbin]$ flashfs enable

e2fsck USB diska

Konsistentnost zunanjega USB diska je potrebno preveriti ob vsakem večjem sesutju sistema. Postopek pri treh ext2 -j particijah (srednja je swap):

[admin@oleo root]$ flashfs disable
[admin@oleo root]$ reboot
[admin@oleo root]$ umount /tmp/harddisk/part1
[admin@oleo root]$ umount /tmp/harddisk
[admin@oleo root]$ swapon /dev/discs/disc0/part2 
[admin@oleo root]$ e2fsck -f -y /dev/discs/disc0/part1 
e2fsck 1.35 (28-Feb-2004)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
opt: 17720/262144 files (7.4% non-contiguous), 85887/524112 blocks
[admin@oleo root]$ time e2fsck -f -y /dev/discs/disc0/part3 
 Pass 1: Checking inodes, blocks, and sizes
 Inode 266244 is in use, but has dtime set.  Fix? yes
  
 Inode 266245 is in use, but has dtime set.  Fix? yes
 
 Inode 266246 is in use, but has dtime set.  Fix? yes 
 ...
 Restarting e2fsck from the beginning...
 Pass 1: Checking inodes, blocks, and sizes
 ...
 
[admin@oleo root]$ flashfs enable
[admin@oleo root]$ reboot

Konsistentnos diska se lahko preverja tudi ob samem zagonu računalnika, ce se nekoliko dopolni datoteko post-boot z dodatnimi ukazi e2fsck. Ob normalni ustavitvi strežnika se e3fsck preskoči in to največ 30 krat. Če pa e2fsck opazi možnost nekonsistentnosti datotečnega sistema se avtomatsko izvede kontrola. Vse skupaj je možno spremljati v datoteki /tmp/mount.log

#!/bin/sh
if [ `nvram get usb_smbenable_x` = 0 ]; then
       insmod scsi_mod
       insmod usb-storage
       insmod sd_mod
fi
( for i in 1 2 3 4 5 6 7 8 9 10; do
  if [ -b /dev/discs/disc0/part1 ]; then
       /sbin/swapon /dev/discs/disc0/part2
       e2fsck -y /dev/discs/disc0/part1
       e2fsck -y /dev/discs/disc0/part3
       /bin/mount -t ext3 -o noatime /dev/discs/disc0/part1 /opt
       /bin/mount -t ext3 -o noatime /dev/discs/disc0/part3 /tmp/harddisk
       break
  fi
  echo "Cakam $((i*3)) sekund"
  sleep 3
done ) > /tmp/mount.log 2>&1

# Pobrisimo audio module. Kdo pa to rabi
killall waveservermain
rmmod audio
rmmod soundcore
# Pa se tiskalnik
killall p910nd
killall lpd
killall infosvr
rmmod printer

Namestitev Optware paketov

Namestitev dodatnih paketov je mogoča z dveh virov. Prikayan bo primer za priporočeni vir. To je oleg vir http://ipkg.nslu2-linux.org/feeds/optware/oleg/cross/stable/

Po particioniranju in formatiranju (/opt, swap in /tmp/harddisk) sledi namestitev dveh osnovnih paketov: uclibc-opt in ipkg-opt

NFS strežnik

Nastavitve za izvoz imenikov vgrajenega NFS serverja sledijo naslednjim navodilom:

EXPORTS(5)                                                          EXPORTS(5)

NAME
      exports - NFS file systems being exported (for Kernel based NFS)

SYNOPSIS
      /etc/exports

DESCRIPTION
      The  file  /etc/exports serves as the access control list for file sys-
      tems which may be exported to NFS clients.  It is used  by  exportfs(8)
      to  give  information  to  mountd(8)  and  to the kernel based NFS file
      server daemon nfsd(8).
      The file format is similar to the SunOS exports file.  Each  line  con-
      tains  an  export  point  and  a  whitespace-separated  list of clients
      allowed to mount the file system at that point. Each listed client  may
      be  immediately  followed  by  a parenthesized, comma-separated list of
      export options for that client. No whitespace is  permitted  between  a
      client and its option list.
      Blank  lines  are  ignored.  A pound sign ("#") introduces a comment to
      the end of the line. Entries may be continued across newlines  using  a
      backslash.  If an export name contains spaces it should be quoted using
      double quotes. You can also specify spaces or other  unusual  character
      in  the export name using a backslash followed by the character code as
      three octal digits.

  Machine Name Formats
      NFS clients may be specified in a number of ways:

      single host
             This is the most common format. You may specify a host either by
             an abbreviated name recognized be the resolver, the fully quali-
             fied domain name, or an IP address.

      netgroups
             NIS netgroups may be given as @group.  Only  the  host  part  of
             each  netgroup  members  is consider in checking for membership.
             Empty host parts or those  containing  a  single  dash  (-)  are
             ignored.

      wildcards
             Machine names may contain the wildcard characters * and ?.  This
             can be used to make the exports file more compact; for instance,
             *.cs.foo.edu  matches  all  hosts  in the domain cs.foo.edu.  As
             these characters also match the dots in a domain name, the given
             pattern  will  also  match  all  hosts  within  any subdomain of
             cs.foo.edu.

      IP networks
             You can also export directories to all hosts  on  an  IP  (sub-)
             network simultaneously. This is done by specifying an IP address
             and netmask pair as address/netmask where  the  netmask  can  be
             specified  in  dotted-decimal  format,  or  as a contiguous mask
             length (for example, either `/255.255.252.0' or  `/22'  appended
             to the network base address result in identical subnetworks with
             10 bits of host). Wildcard characters generally do not  work  on
             IP  addresses, though they may work by accident when reverse DNS
             lookups fail.


  RPCSEC_GSS security
      To restrict access to an export using rpcsec_gss security, use the spe-
      cial   string  "gss/krb5"  as  the  client.   It  is  not  possible  to
      simultaneously require rpcsec_gss and to make requirements  on  the  IP
      address of the client.


  General Options
      exportfs understands the following export options:

      secure This option requires that requests originate on an internet port
             less than IPPORT_RESERVED (1024). This option is on by  default.
             To turn it off, specify insecure.

      rw     Allow  both  read  and  write  requests  on this NFS volume. The
             default is to disallow any request which changes the filesystem.
             This can also be made explicit by using the ro option.

      async  This  option  allows  the NFS server to violate the NFS protocol
             and reply to requests before any changes made  by  that  request
             have been committed to stable storage (e.g. disc drive).

             Using  this option usually improves performance, but at the cost
             that an unclean server restart (i.e. a crash) can cause data  to
             be lost or corrupted.

             In  releases  of nfs-utils upto and including 1.0.0, this option
             was the default.  In this  and  future  releases,  sync  is  the
             default,  and  async  must  be explicit requested if needed.  To
             help make system adminstrators aware of this change,  'exportfs'
             will issue a warning if neither sync nor async is specified.

      no_wdelay
             This  option has no effect if async is also set.  The NFS server
             will normally delay committing a write request to disc  slightly
             if  it  suspects  that  another  related write request may be in
             progress  or  may  arrive  soon.   This  allows  multiple  write
             requests  to  be  committed to disc with the one operation which
             can improve performance.  If an NFS server received mainly small
             unrelated requests, this behaviour could actually reduce perfor-
             mance, so no_wdelay is available to turn it  off.   The  default
             can be explicitly requested with the wdelay option.

      nohide This  option is based on the option of the same name provided in
             IRIX NFS.  Normally, if a server exports two filesystems one  of
             which  is  mounted  on  the  other, then the client will have to
             mount both filesystems explicitly to get access to them.  If  it
             just  mounts  the  parent, it will see an empty directory at the
             place where the other filesystem is mounted.  That filesystem is
             "hidden".

             Setting  the  nohide  option on a filesystem causes it not to be
             hidden, and an appropriately authorised client will be  able  to
             move  from  the  parent  to that filesystem without noticing the
             change.

             However, some NFS clients do not cope well with  this  situation
             as,  for  instance, it is then possible for two files in the one
             apparent filesystem to have the same inode number.

             The nohide option is currently only  effective  on  single  host
             exports.   It  does  not work reliably with netgroup, subnet, or
             wildcard exports.

             This option can be very useful in some situations, but it should
             be used with due care, and only after confirming that the client
             system copes with the situation effectively.

             The option can be explicitly disabled with hide.

      no_subtree_check
             This option disables subtree checking, which has  mild  security
             implications, but can improve reliability is some circumstances.

             If a subdirectory of a filesystem is  exported,  but  the  whole
             filesystem isn't then whenever a NFS request arrives, the server
             must check not only that the accessed file is in the appropriate
             filesystem  (which  is easy) but also that it is in the exported
             tree (which is harder). This check is called the  subtree_check.

             In  order  to  perform  this check, the server must include some
             information about the location of the file in  the  "filehandle"
             that  is  given  to  the  client.   This can cause problems with
             accessing files that are renamed while a client  has  them  open
             (though in many simple cases it will still work).

             subtree  checking  is  also  used to make sure that files inside
             directories to which only root has access can only  be  accessed
             if  the  filesystem is exported with no_root_squash (see below),
             even the file itself allows more general access.

             As a general guide, a home directory filesystem, which  is  nor-
             mally  exported  at  the  root and may see lots of file renames,
             should be exported with subtree checking disabled.  A filesystem
             which  is  mostly  readonly,  and at least doesn't see many file
             renames (e.g. /usr or /var) and for which subdirectories may  be
             exported,  should  probably  be  exported  with  subtree  checks
             enabled.

             The default of having subtree checks enabled, can be  explicitly
             requested with subtree_check.


      insecure_locks

      no_auth_nlm
             This  option (the two names are synonymous) tells the NFS server
             not to require authentication of locking requests (i.e. requests
             which  use  the  NLM  protocol).   Normally  the NFS server will
             require a lock request to hold a credential for a user  who  has
             read  access  to the file.  With this flag no access checks will
             be performed.

             Early NFS client implementations did not send  credentials  with
             lock  requests,  and  many current NFS clients still exist which
             are based on the old implementations.  Use this flag if you find
             that you can only lock files which are world readable.

             The  default  behaviour  of  requiring  authentication  for  NLM
             requests can be explicitly requested with either of the  synony-
             mous auth_nlm, or secure_locks.


      mountpoint=path

      mp     This  option  makes it possible to only export a directory if it
             has successfully been  mounted.   If  no  path  is  given  (e.g.
             mountpoint  or  mp)  then  the export point must also be a mount
             point.  If it isn't then the export point is not exported.  This
             allows you to be sure that the directory underneath a mountpoint
             will never be exported by accident if, for example, the filesys-
             tem failed to mount due to a disc error.

             If a path is given (e.g.  mountpoint=/path or mp=/path) then the
             nominted path must be a mountpoint for  the  exportpoint  to  be
             exported.

      fsid=num
             This  option forces the filesystem identification portion of the
             file handle and file attributes used  on  the  wire  to  be  num
             instead  of  a number derived from the major and minor number of
             the block device on which the filesystem is mounted.  Any 32 bit
             number  can  be  used,  but  it  must  be unique amongst all the
             exported filesystems.

             This can be useful for NFS failover, to ensure that both servers
             of  the  failover  pair  use  the  same NFS file handles for the
             shared  filesystem  thus  avoiding  stale  file  handles   after
             failover.

             Some  Linux  filesystems  are  not  mounted  on  a block device;
             exporting these via NFS requires the  use  of  the  fsid  option
             (although that may still not be enough).

             The  value   0 has a special meaning when use with NFSv4.  NFSv4
             has a concept of a root of the overall exported filesystem.  The
             export point exported with fsid=0 will be used as this root.


  User ID Mapping
      nfsd bases its access control to files on the server machine on the uid
      and gid provided in each NFS RPC request. The normal  behavior  a  user
      would expect is that she can access her files on the server just as she
      would on a normal file system. This requires that  the  same  uids  and
      gids  are used on the client and the server machine. This is not always
      true, nor is it always desirable.

      Very often, it is not desirable that the root user on a client  machine
      is also treated as root when accessing files on the NFS server. To this
      end, uid 0 is normally mapped to a different id: the  so-called  anony-
      mous or nobody uid. This mode of operation (called `root squashing') is
      the default, and can be turned off with no_root_squash.

      By default, exportfs chooses a uid and  gid  of  -2  (i.e.  65534)  for
      squashed access. These values can also be overridden by the anonuid and
      anongid options.  Finally, you can map all user requests to the  anony-
      mous uid by specifying the all_squash option.

      Here's the complete list of mapping options:
      root_squash
             Map  requests from uid/gid 0 to the anonymous uid/gid. Note that
             this does not apply to any other uids that might be equally sen-
             sitive, such as user bin.

      no_root_squash
             Turn  off root squashing. This option is mainly useful for disk-
             less clients.

      all_squash
             Map all uids and gids to the anonymous  user.  Useful  for  NFS-
             exported  public  FTP  directories, news spool directories, etc.
             The opposite option is no_all_squash, which is the default  set-
             ting.

      anonuid and anongid
             These  options  explicitly  set the uid and gid of the anonymous
             account.  This option is primarily useful  for  PC/NFS  clients,
             where you might want all requests appear to be from one user. As
             an example, consider the export entry for /home/joe in the exam-
             ple  section below, which maps all requests to uid 150 (which is
             supposedly that of user joe).

EXAMPLE
      # sample /etc/exports file
      /               master(rw) trusty(rw,no_root_squash)
      /projects       proj*.local.domain(rw)
      /usr            *.local.domain(ro) @trusted(rw)
      /home/joe       pc001(rw,all_squash,anonuid=150,anongid=100)
      /pub            (ro,insecure,all_squash)

      The first line exports the entire filesystem  to  machines  master  and
      trusty.   In  addition to write access, all uid squashing is turned off
      for host trusty. The second and third entry show examples for  wildcard
      hostnames and netgroups (this is the entry `@trusted'). The fourth line
      shows the entry for the PC/NFS client discussed above. Line  5  exports
      the  public  FTP  directory  to  every host in the world, executing all
      requests under the nobody account. The insecure option  in  this  entry
      also  allows clients with NFS implementations that don't use a reserved
      port for NFS.

FILES
      /etc/exports
4.2 Berkeley Distribution       28 October 1999                     EXPORTS(5)

Primer /etc/exports

# automagically generated from web settings
/tmp/harddisk *(rw,async,no_root_squash)  
/opt    *(rw,async,no_root_squash)  

Ročno izvozimo z

$ exportfs -a

NFS klient

Poleg strežnika je mogoče uporabljati tudi klienta in tako mountati imenike z drugih strežnikov. Skripta potrebna za uporabo NFS sistema

#!/bin/sh
insmod sunrpc
insmod lockd
insmod nfsd
insmod nfs
/opt/sbin/portmap

nfsd ni potreben ta klienta. Naložimo imenike s stežnika oleo na klientu boleo

[admin@boleo /]$ mount -t nfs oleo:/opt /opt
[admin@boleo /]$ mount -t nfs oleo:/tmp/harddisk /tmp/harddisk
Personal tools