Linux Access to NetWare Filesystem

Valid HTML 4.01!


This page is out of date,

please see http://www.rainsbrook.co.uk/wiki/doku.php?id=rb:linuxloginscripts.

NetWare grew up providing file and print services and later management to windows based pcs using the NetWare Core Protocols (NCP) originally running over IPX and more recently over TCP/IP. Novell has in the past sold an NFS server add on for unix systems access but more recently NetWare 6.5 has included native file access based on NFS for free. However this requires server modifications and is unavailable on 4.1x and 5.x.
In order to make a Linux workstation a drop in replacement for a windows one, the Linux workstation should really be able to communicate over NCP as though it were a windows one. The underlying package to achieve this is called ncpfs and is available from Freshmeat.net. Some distributions include a version of ncpfs, other don't so compilation is required. This page refers to my experience of running ncpfs with Slackware 10 and Netware 5.0.
 
Download & Installation of ncpfs
As I am running this on Slackware, I produced a .tgz package and installed it with "installpkg /path/to/ncpfs.tgz". From memory, it compiled cleanly. For other distributions, use .rpms, .debs etc as appropriate, or compile it from source!
 
Thoughts on Login scripts
The windows Netware Client will process login scripts stored in NDS after a sucessful login. ncpfs does not seem to have this capability. In order to make the Linux workstation a windows drop-in as near as possible some network "drives" need to be "mapped". Because the linux filesystem with everything mounted under / and windows using letters for drives differ, it is not possible to provide an exact drop-in. The approach I have taken at the moment is to write a "login script" in bash which wrapps the ncplogin and ncpmount commands and uses some environment variables to customise the script. This assumes that the Linux login name and the Novell login name are the same. Also because the Linux login namespace is flat and the Novell login name space is hierachical (eg. .user.container.tree) I have had to hard code the container/tree part of the name and prepend the $LOGIN Linux username. The bash login script will present the user with the default container and offer the chance to alter it before starting the login process.
The drive "letters" we use are H: for home mapped to the user name under the site container. Under Linux, a mount point is set up called H under the /home/username/directory and the bash login script mounts the appripriate part of the netware filesystem under it. To avoid the problem of a user saving work in an unmounted /home/username/H directory if a Novell login fails and then the work becoming unavailable when the next login is successful, I think I will modify the login script to create the mount points first before attempting to login and in the logout script delete the mount point if there are no files in it. Currently each user has a copy of the login script in /home/username/, so the logout can be run, I am not sure if there is an equivalent system .profile logout.

Assuming the user is using KDE, a desktop icon is generated and squirted out for each mapped drive. This uses a graphic which needs to be copied to a suitable location (/opt/kde/share/icons/novell-folder-32.png is a good choice for KDE!).

Here is the current Login Script:-
#!/bin/bash
#Script to login to Netware server
#mounts home directory under ~/H
#Written 26/08/2004 onwards copyright Andrew Stringer

#set up variables
LOGINSERVER=server
CONTEXT=.context
TREE=tree
VOLUME=.volume.tree

#define functions

#generate desktop icon, $1 is the name of the desktop icon, it must end with
#.novell.desktop as on logout icons are destroyed which match this name ending,
#$2 is the mount point under $HOME/ where the icon points to, also this is the 
#icon name which appears on the desktop.
generate_icon()
{
cat <$HOME/Desktop/$1.novell.desktop
[Desktop Entry]
Encoding=UTF-8
GenericName=$2
Icon=/opt/kde/share/icons/novell-folder-32.png
Name=$1:
Name[en_US]=$1:
Type=Link
URL=$HOME/$1/
EOF
}


#1st login to Netware
/usr/local/bin/ncplogin -A $LOGINSERVER -S $LOGINSERVER -U $USER$CONTEXT

#map H drive to ~/H if logged in OK.
if [ $? -eq 0 ]; then
 /usr/local/bin/ncpmap -A $LOGINSERVER -T $TREE -V $VOLUME -R users/andrew H &&
 #squirt out desktop icon
 generate_icon H "Personal files on Server"
else
#if login is unsucessful, exit with status 1
exit 1
fi

echo ""
#show ncpfs mounts
echo "********* Current Connections *********"
mount |grep ncpfs
echo "***************************************"
echo""

exit 0




and the logout script:-
#!/bin/sh
#script to log out of Netware server
#written & copyright Andrew Stringer

#disconnect all resources
/usr/local/bin/ncpumount -a

#delete desktop icons ending with .novell, these were created at login
rm $HOME/Desktop/*.novell.desktop >/dev/null

exit 0


Icon Files. Right click and save to desired location.
Mounted Desktop icon,
Unmounted Desktop icon (currently not used),
Plain Desktop folder icon.
 
Printing
Nothing much done on this. NetWare 6.5 uses CUPS and a print job from linux can be sent directly to the print queue on NetWare. Works really well IF you have the correct driver for the printer on the linux workstation.
ncpfs is supposed to be able to submit jobs to traditional Novell print queues on NetWare 5 and earlier, but 6.5 really is so much better on all fronts I have not bothered testing the printing aspect of ncpfs.
 
Wine and Novell
Part of the reason for creating mount points corresponding to dos drive letters under /home/username/ was to facilitate creating fake drives under Wine. Our organisation uses Lotus Notes version 5 as an email and database client. As it happens Notes seems to run well with wine because it uses its own dlls and stores settings in its own .ini files. We use the H: drive to store the Notes .id for each user so this needs to be mapped as a drive letter with wine for Notes to use it. Also in the wine config, the other network drives are mapped similarly to try to create the most consistant windows environment for the user.
***UPDATE*** IBM now have a native Linux client for Lotus Notes based on the eclipse framework, v8.x seems to work really well, see here for more information.
 
PAM
So far I have done nothing with PAM. Ideally this would allow a single sign on with a Novell account and require no local Linux account.