SOLVED:
These are the steps taken to connect to a Samba/Windows share using CIFS and autofs in Opensuse 13.1. As mentioned above I am running a laptop which connects to a NAS Qnap TS-212. I prefer the CIFS mount to Samba mount because it mounts it as a local folder which means Amarok and Digikam are able to link to it including backup software. It is also better than using the fstab method as it deals with the network connection as to when it is available or not, so you don’t have the timeout issues.
This is the reference which I made to suite and work on a clean Opensuse 13.1 laptop install: Accessing Windows Or Samba Shares Using AutoFS | HowtoForge - Linux Howtos and Tutorials
Please note the nas is called ts-212 on the network and in the reference it is FILESERVERNAME.
Step 1: Ensure your Firewall will allow the network connection.
With the YAST firewall module I added samba client to “allowed service”.
Step 2: Activate the autofs service through YAST service (runlevel). If the service is not listed you will need to install autofs but it seems to be installed by default.
Step 3: As root user create the file ** /etc/auto.smb.[size=2][FONT=arial]ts-212[/size] containing the following two lines:
username=username
password=topsecrete
Once created;
chmod 600 /etc/auto.smb.ts-212
Step 4: Add a line at the bottom of the **/etc/**auto.master file. Please note I changed the local mount point to /mnt and reduced the timeout from 60 to 6 which may not suite all users.
/mnt /etc/auto.cifs –timeout=6
Step 5: create a file called /etc/auto.cifs, then paste the script below into it and make it executable. I have included an altered line to make this work with my default system.
#!/bin/bash
# $Id$
# This file must be executable to work! chmod 755!
key="$1"
# Note: create a cred file for each windows/Samba-Server in your network
# which requires password authentification. The file should contain
# exactly two lines:
# username=user
# password=*****
# Please don't use blank spaces to separate the equal sign from the
# user account name or password.
credfile="/etc/auto.smb.$key"
# Note: Use cifs instead of smbfs:
mountopts="-fstype=cifs,file_mode=0644,dir_mode=0755,uid=1000,gid=100"
smbclientopts=""
for P in /bin /sbin /usr/bin /usr/sbin
do
if -x $P/smbclient ]
then
SMBCLIENT=$P/smbclient
break
fi
done
-x $SMBCLIENT ] || exit 1
if -e "$credfile" ]
then
mountopts=$mountopts",credentials=$credfile"
smbclientopts="-A "$credfile
else
smbclientopts="-N"
fi
$SMBCLIENT $smbclientopts -gL $key 2>/dev/null \
| awk -v key="$key" -v opts="$mountopts" -F'|' -- '
BEGIN { ORS=""; first=1 }
/Disk/ { if (first) { print opts; first=0 };
gsub(/ /, "\\ ", $2);
sub(/\$/, "\\$", $2);
print " \\
/" $2, "://" key "/" $2 }
END { if (!first) print "
"; else exit 1 }
'
Step 6: Type the following into the terminal as root.
/etc/init.d/autofs restart
Step 7:
In KDE system settings>Network settings; I changed all the Connection preferences to 8 seconds. This change may not suite everyone.[/FONT]
**