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

Post tutorials, HOWTO's and other useful resources here.
iolalog
White ninja
White ninja
Posts: 17
Joined: 04 Oct 2013, 01:31
Distribution: Porteus 2.1 XFCE 64bit
Location: Norway

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

Post#1 by iolalog » 12 Oct 2013, 23:09

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!
Last edited by iolalog on 13 Oct 2013, 23:48, edited 1 time in total.
Olav

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

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

Post#2 by brokenman » 12 Oct 2013, 23:47

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.
How do i become super user?
Wear your underpants on the outside and put on a cape.

iolalog
White ninja
White ninja
Posts: 17
Joined: 04 Oct 2013, 01:31
Distribution: Porteus 2.1 XFCE 64bit
Location: Norway

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

Post#3 by iolalog » 13 Oct 2013, 01:20

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
Olav

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

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

Post#4 by brokenman » 13 Oct 2013, 14:38

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!
How do i become super user?
Wear your underpants on the outside and put on a cape.

iolalog
White ninja
White ninja
Posts: 17
Joined: 04 Oct 2013, 01:31
Distribution: Porteus 2.1 XFCE 64bit
Location: Norway

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

Post#5 by iolalog » 13 Oct 2013, 23:36

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.
Olav

User avatar
fanthom
Moderator Team
Moderator Team
Posts: 5666
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland
Contact:

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

Post#6 by fanthom » 14 Oct 2013, 06:11

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.
Please add [Solved] to your thread title if the solution was found.

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

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

Post#7 by brokenman » 14 Oct 2013, 14:51

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.
How do i become super user?
Wear your underpants on the outside and put on a cape.

Post Reply