Page 1 of 1

[HOWTO] Browse (read) and mount (write) network shares

Posted: 12 Oct 2013, 23:09
by iolalog
I had a little trouble finding a good source of information on how to handle accessing and mounting network shared (samba) in Porteus. I may have overlooked something, but just in case I'll share my findings with you.

Browse Network (read mode)
The error I list here is specific to Thunar (file manager in XFCE), but the solution for browsing the network should be generic enough. I got this odd message when I tried to browse the network. Turns out all you have to do is to add samba through Porteus Package Manger, and you can browse the network fine.

Mount network shares (write mode)
I had to figure out how to access the shares in "write mode" (not browse them as guest), and mounting the share(s) in question came up as the likely solution. I tried the System->Mount... utility to no avail, and searched the forum. This topic gave me the following command (run as root in terminal):

Code: Select all

mount.cifs //X.X.X.X/path /mnt/pc -o username=YOUR_DOMAIN/your_username,password=your_password
Using this command I got the following error however:
mount error(95): Operation not supported
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Searching the forum turned up nothing, but searching with Google it seems the kernel was recently defaulted to NTLM2 security mode. As my NAS likely doesn't support it (or have it enabled), I had to use this less secure workaround:

Code: Select all

mount.cifs //X.X.X.X/path /mnt/pc -o username=YOUR_DOMAIN/your_username,password=your_password,sec=ntlm
Once I did this, all was well. Hope this will help others as well!

Re: [HOWTO] Browse (read) and mount (write) network shares

Posted: 12 Oct 2013, 23:47
by brokenman
Excellent write up. There is also the script /opt/porteus-scripts/mount-manager which should be able to mount shares over cifs without using samba. Take a look. If you find any bugs let me know.

Re: [HOWTO] Browse (read) and mount (write) network shares

Posted: 13 Oct 2013, 01:20
by iolalog
Thanks brokeman! I used your script before, but it lacks the same argument that I mention in the first post.

Code: Select all

## Setup mountpoint
[ ! -d $MNTDIR ] && mkdir /$MNTDIR || umount $MNTDIR 2>/dev/null
## Mount the share
mount.cifs //$IPADDY/$SHDIR $MNTDIR -o user=$SHUSR,password=$USERPWD 2>/tmp/log
I changed it to add the argument (,sec=ntlm), and it works fine.

Code: Select all

## Setup mountpoint
[ ! -d $MNTDIR ] && mkdir /$MNTDIR || umount $MNTDIR 2>/dev/null
## Mount the share
mount.cifs //$IPADDY/$SHDIR $MNTDIR -o user=$SHUSR,password=$USERPWD,sec=ntlm 2>/tmp/log

Re: [HOWTO] Browse (read) and mount (write) network shares

Posted: 13 Oct 2013, 14:38
by brokenman
Thanks. I'll leave it as is (in the mount-manager) for now since this security protocol is not used for all devices. I can connect to my NAS without it and any other share on the network. Thanks for picking it up!

Re: [HOWTO] Browse (read) and mount (write) network shares

Posted: 13 Oct 2013, 23:36
by iolalog
I checked this a little closer, and it has to do with the default in the core. I'll update the howto to reflect this.

As for your script (and it's GUI under System), it would be useful to have one of two added:
1. The ability to choose security options (as people in my situation can't connect without modifying without it).
2. Automatic probing of security options. If default (more secure) works, fine. If less secure works, ask if mounting in a less secure manner is desired.

Re: [HOWTO] Browse (read) and mount (write) network shares

Posted: 14 Oct 2013, 06:11
by fanthom
what about this:

Code: Select all

## Setup mountpoint
[ ! -d $MNTDIR ] && mkdir /$MNTDIR || umount $MNTDIR 2>/dev/null
## Mount the share
mount.cifs //$IPADDY/$SHDIR $MNTDIR -o user=$SHUSR,password=$USERPWD,sec=ntlm 2>/tmp/log || \
mount.cifs //$IPADDY/$SHDIR $MNTDIR -o user=$SHUSR,password=$USERPWD 2>/tmp/log
same way i'm trying to mount nfsv4 share first and if fails then dropping to nfsv3 in PXE boot.

Re: [HOWTO] Browse (read) and mount (write) network shares

Posted: 14 Oct 2013, 14:51
by brokenman
The option to choose would be ideal, but I don't have the resources to test most of them, and the average user probably wouldn't have any idea what it means. There are various sec options including:
sec=krb5
sec=ntlmssp
sec=ntlmv2
sec=ntlm

I think a string of double pipes will do for now as I assume ntlm is the more common option. Thanks.