Scenario:
- One would like to be able to mount NetWare volumes or folders under Suse Linux 10.1.
- The scenario is of a single user on a Suse 10.1 machine who wishes to mount NSS volumes on a Novell NetWare 6.0 file server on which they have a regular login (eDir). The Suse environment is KDE 3.5.1 and the Novel server communications are IP only (no IPX).
- The Novell server in question is referred to as SOMFS2 but has FQDN somfs2.som.hw.ac.uk and the Suse machine is suse01 (.hw.ac.uk). The Novell user account mentioned (somdjp) is in eDir/NDS context .som.staff.hw
- All testing was performed using VMware Workstation 6.0
References:
- A good page with discussion and lot of links to this subject is here.
- Options: Use ncpfs
- Novell have their own Client for Suse Linux 10 here .
- Good website entitled /etc/fstab demystified
The Novell Client seems excellent for regular Linux desktop users, but a lighter solution is sought here.
NCPFS
The path chosen first was to install ncpfs.
- Using Yast, install the ncpfs package (NetWare Core Protocol File System) - download site http://freshmeat.net/projects/ncpfs/
- Novell Cool Solutions: "HOWTO: Mount Netware Servers in Linux Through /etc/fstab" [Ref]
- Using Yast, package ncpfs was installed.
- > mkdir /mnt/somfs2 [as root, to create the mount point]
- > groupadd nwaccess [group to whom NetWare access is granted]
- > usermod -G nwaccess somdjp [add the user somdjp to the nwaccess group]
- > cd /mnt/somfs2
- > chgrp nwaccess . [Important - see here for why.]
- Edit /etc/fstab to include the last line shown here in blue (followed by a blank line):
- /dev/sda2 / reiserfs acl,user_xattr 1 1
/dev/sda1 swap swap defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
/dev/fd0 /media/floppy auto noauto,user,sync 0 0
somfs2.som.hw.ac.uk/somdjp.som.staff.hw /mnt/somfs2 ncp uid=somdjp,gid=nwaccess,mode=660,owner=somdjp,A=somfs2.som.hw.ac.uk,passwdfile=/etc/ncp-pass 0 0
- Mount the NetWare volumes via
- > su [must change to root to use mount command]
- > mount -a -t ncp [password is read from /etc/ncp-mount]
- > ls /mnt/somfs2 [all Novell SOMFS2 volumes appear under here!]
- The /etc/ncp-pass file must be manually created and have the format
- somfs2.som.hw.ac.uk/somdjp.som.staff.hw:mypassword
namely FQDN of host/FQ Login name of user:password
- Permissions on /etc/ncp-pass are -rw——- root root (so only root can access this file).
- Update: This was later changed so that user somdjp was the owner, and the group was set as nwaccess.
- Dismount NetWare volumes via
- > umount -a -t ncpfs [note the last word is not ncp but ncpfs.]
- [NB: This next part didn't work for me.]
If non-root users are to use the mount command, one must SetUseridRoot the Mount command (see here on a related IPX mount-related web page which has some good information on mounting NetWare volumes). One would change the permissions on the mount command via
- > whereis mount [answer is /bin/mount]
- > chown root:nwaccess /bin/mount
- > chmod 755 mount [owner (root) has twx, group (nwaccess) has rx, other has rx]
Alas, this didn’t work. Issuing the correct mount -a -t ncp command as a non-root user produces no result. Perhaps the /etc/ncp-pass file permission/ownership are at issue?
Change owner to the non-root user who wishes to mount the volume:
- >chown somdjp /etc/ncp-pass
- >chmod 750 /etc/ncp-pass [owner=r,w,x,group=r,x]
- The above didn’t work either. The solution is to use the sudo command.
- Sudo allows one to run selected commands with root (or other user) privileges. It is configured by means of the visudo command. Usage: As root, configure sudo by running
- This starts the microemacs text editor to edit the /etc/sudoers file, which it creates if not present. Note that one should set the EDITOR environment variable or vi will start. Do this by editing /root/.bashrc and adding the line
export EDITOR=ue
- So, back in the visudo environment, enter the following text:
- %users suse01 = NOPASSWD: binmount -a -t ncp, sbinmount -a -t ncp, binumount -a -t ncpfs
- This will allow all users of machine suse01 to use the mount/umount commands with the specified parameters, required to handle mounting of Novell volumes. For the user (somdjp) to mount the volumes he must run
- To dismount volumes, one can run (as root) either of these commands:
- > umount -a -t ncpfs
- > umount /mnt/somfs2 [where the latter is the mount point]
Note that using only the first command sometimes resulted in a ‘file system is busy’ warning message but using the second one always worked. Also, one could run the sync command to flush the file system buffers before dismounting.
- It would be convenient to provide a desktop shortcut to a script which would do the mounting and dismountig, and this is covered next.
Scripting: Mounting the Novell Folders with help from kdialog
So, we can mount the NetWare folders as root, from a command shell by the above mount command.
We could script this and create a simpler bash shell script to do this to avoid remembering the mount syntax. Wouldn’t it be nice, also, to have a KDE desktop shortcut from which we could run this BASH script, which need only prompt for the ROOT password to run the mount command? The solution is using kdialog which will provide a dialogue to the user (as the name suggests.)
References: Shell scripting with KDE Dialog , Kdialog Dialog Types ,
Usage: Refer to the above for further details. The script requires to request the user for the ROOT password, so one would use the examples in the links above to:
- In the user’s home folder, create a bash script with microemacs (for example) named, for simplicity, novell_mount.sh
- The bash script is as follows:
#!bin/bash
# Define the home folder of user on Novell server.
VOL=/mnt/somfs2/somfs2/users2/somdjp
# Tell the user what’s happening:
kdialog –title "Novell Folder Mounting" –passivepopup "Mounting SOMFS2 Volumes …" 1
if [ -d $VOL ]
then
kdialog –title "Novell Folder Mounting" –msgbox "It’s ok!nNovell Volumes are already available, dude, under $VOL ."
exit
else
# Mount the volume using sudo (edit with visudo command)
sudo mount -a -t ncp
fi
# Now test if home folder has mounted
if [ -d $VOL ]
then
kdialog –title "Novell Folder Mounting" –passivepopup "Novell Volumes Mounted under $VOL." 2
else
kdialog –title "Novell Folder Mounting" –msgbox "Novell Volumes did NOT mount.n Oh dear. Try again."
fi
exit
- To make the script executable one must of course type
- > chmod u+x novell_mount.sh
- And to run the script from a command shell one would type
- One can easily create a KDE desktop shortcut to this script, as long as the command parameter is
- /bin/bash -i /home/<user>/novell_mount.sh
- One needs also click Properties-Application-Advanced and select the "Run in Terminal" option or a bouncing ball appears for a good few seconds after the script/shortcut has run. This indicates the application times out, or does not close properly.
- The "Terminal Options" are the KDE Konsole Options, listed here.
- The Terminal options chosen were –vt_sz 2×1 –nomenubar –noscrollbar -T Info
- To create a dismount script, open microemacs (or any editor) and create the following under script novell_umount.sh:
#!bin/bash
# Define the home folder of user on the Novell server:
VOL=/mnt/somfs2/somfs2/users2/somdjp
# Tell the user what’s happening:
kdialog –title "Novell Folder Mounting" –passivepopup "Dismounting SOMFS2 Volumes …" 1
if [ ! -d $VOL ]
then
kdialog –title "Novell Folder Dismounting" –msgbox "It’s ok!nNovell Volumes are not mounted."
exit
else
# Flush any caches to disk
sudo sync
# Dismount by mount name
sudo /bin/umount /mnt/somfs2
# Dismount the volume type using sudo (edit with visudo command)
sudo /bin/umount -a -t ncpfs
fi
# Now test if home folder has dismounted
if [ ! -d $VOL ]
then
kdialog –title "Novell Folder Dismounting" –passivepopup "Novell Volumes Dismounted." 2
else
kdialog –title "Novell Folder Dismounting" –msgbox "Novell Volumes did NOT dismount.n Oh dear. Try again."
fi
exit
- Again, create a KDE shortcut to this script and ensure it is executable, as above. Note that
- A few more sudo commands have been added, for which visudo must be run, and the following line must be present in /etc/sudoers as a result:
- %users suse01 = NOPASSWD: /bin/sync, /bin/mount -a -t ncp, /sbin/mount -a -t ncp, /bin/umount /mnt/somfs2, /bin/umount -a -t ncpfs
- In the discount script, both ways of dismounting were required to ensure the volumes are dismounted. At this stage, I’m unsure why this should be. Volume dismount isn’t actually critical for single-user Linux machines.
Initial Error when running Kdialog
An error message was generated initially when using kdialog, stating "failed to open file /usr/lib/qt3/etc/settings/qtrc". A web-search revealed this was because the above file (qtrc) was readable only by root. The error was resolved by chmod a+x the above file (as root).
Mounting at Boot time: Issues
The Novell volumes are not mounted at boot time, as the network service has not started at the time /etc/fstab is being read and disks/volumes mounted. This isn’t a problem in the scenario here and is further discussed in the NetWare Cool Solutions "Automatically Mounting Remote NCP (NetWare) Shares on SUSE Linux System Boot" [Ref]
which goes into more detail and discusses Samba solutions too. Samba
would mount the volume in a case-insensitive way, suitable for the
documentroot of an Apache webserver.
The Novell article above states:
The Problem:
Many users want to have remote NCP shares mounted on their SUSE Linux machine on system boot. The ncpmount (8) man page explains that to mount a NetWare share on system boot one simply needs to add the share to /etc/fstab. They do this, but the NCP shares are not mounted on system boot.
The Cause
The cause of this problem is simple: the system is attempting to
mount the NCP shares prior to starting the networking. This obviously
fails. After the system has boot, the user can execute mount -at ncpfs as root and have the shares mounted fine
The Solution
The most simple solution is to check whether the server hosting the
NCP share supports Native File Access for SMB/CIFS. If so, the share
can be mounted via Samba. Samba has scripts which mount the shares after networking has been started. These shares can be added to either /etc/fstab or /etc/samba/smbfstab.
So, the best way is to mount the Novell volumes as Samba shares - which would also be case-insensitive and thus suitable for being mounted as the Apache htdocs folder.
Addendum: An article on Linux Clustering advises:
"Next, edit /etc/fstab to make the server mount automatically when rebooting. When doing this, make sure that the file system has the option _netdev added in the options column. This option ensures that the file system is mounted only after the network has been enabled."
Adding the parameter _netdev to /etc/fstab and rebooting caused Suse to boot into command-line mode only, requesting a username and password. Loading microemacs from the command-prompt (ue) and commenting out the whole line by prepending a # symbol at the start resolved the problem.
Later, this was changed back to the line being active (comment removed) but the password file option is removed and replaced by option noauto. This allows the user (in this case somdjp) to manually mount the Novell folders from a command shell, if desired, but they won’t be auto-mounted at system boot time. However, the NetWare folders were no longer mounted for some unknown reason (using >mount -a -t tcp). Solution: put it back to the way it was before it got broken :o)
Using ncpmount
It’s also possible to mount Novell volumes using the ncpmount command that comes as part of the ncpfs package. Initial steps in testing this are as follows:
- In a command shell, change to root (su)
- Make sure the mount point exists (e.g. /mnt/somfs2)
- Issue the command
- >ncpmount -S somfs2 -A somfs2.som.hw.ac.uk -U somdjp.som.staff.hw /mnt/somfs2
whereupon a password will be prompted for and the Novell volumes mount.
- There are many options available (see the hyperlink to ncpmount above). Some of these can store the password in a file, for instance.
- To dismount the volumes one can issue
Note that the normal Linux user (e.g. somdjp) does not have permissions to view the volumes (only root does) when the above command is issued. The remedy is to use the -u and -g flags which specify the default file owner (via uid) and group id of the mounted volumes. These can be determined easily by running
- > cat /etc/passwd [obtain the uid and gid of the user for whom access is required]
- > ncpmount -S somfs2 -A somfs2.som.hw.ac.uk -U somdjp.som.staff.hw -u 1002 -g 100 /mnt/somfs2
This time the regular Linux user with uid 1002 can browse their Novell files - and long filenames are supported.
Samba
Documentation