OpenWrt Forum Archive

Topic: smbmount

The content of this topic has been archived on 14 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Is there anyway to get to function. I saw a package for RC6 and it said the "gzip magic not working" I got this problem before but that was because the file was having ".gz" appended. This is not an issue this time around.

root@openwrt=:~# ipkg install http://riot.org/seb/smbfs_0.0_mipsel.ipk
Downloading http://riot.org/seb/smbfs_0.0_mipsel.ipk
ipkg: invalid gzip magic

Are there any ports of smbmount for Kamikaze? I can't get any of the cifs options to mount my share.

I always get a really generic

mount -t cifs //<address>/<share> /mnt/<dir> -o unc=\\\\<address>\\<share>,ip=<address>,user=<user>,pass=<pass>,dom=<domain>
mount: mounting //<address>/<share> on /mnt/<dir> failed

(Last edited by napierzaza on 14 Oct 2007, 18:45)

I finally got a Win2K share mounted on Kamikaze 7.09 (Broadcom 2.4 kernel).  To make a long story short:

ipkg install kmod-fs-cifs
insmod cifs
ipkg install cifsmount
mkdir /mnt/mount_point
mount.cifs \\\\<address>\\<share> /mnt/mount_point -o user=<user>,pass=<pass>,dom=<domain>

HTH

(Last edited by Bill_MI on 22 Oct 2007, 00:20)

I gave up on that, but got nfs working thankfully. There's about 10 different ways to form the connectiong string, but only on in OpenWRT works.

this works for me - tested on both linux samba servers and WinnXP:

mount.cifs //$server/$share /tmp/mnt/$server/$share -o ip=$target,user=$user,pass=$passwd,dom=$dom

--Yan

Yan: Thanks, that works great here.  Much better than the hokey \\\\ stuff.

Any chance someone can test that with Vista?  I've tested with Samba 3.x and XP sp2 but I don't have vista available (and I don't know anyone who does...)

here's the whole automount script (works with samba3, at http://www.seiner.com/samba3.tar.bz2 )

You need to build a credentials file:

/etc/credentials

# servername="domain/user%passwd"
# servername_share="domain/user%passwd"

scan:

#!/bin/sh

. /etc/credentials

ADDR=`ifconfig | grep 'inet addr' | grep -v '127.0.0.1' | cut -f2 -d:  | cut -f1 -d\  | cut -f1,2,3 -d.  `

echo Checking local interfaces: `ifconfig | grep 'inet addr' | grep -v '127.0.0.1' | cut -f2 -d:  | cut -f1 -d\  `

for addr in $ADDR ; do
        echo Testing subnet $addr.0
        nmap -p 139 "$addr.*" -oG /tmp/$$.$addr.out > /dev/null
        TARGETS=`grep open /tmp/$$.$addr.out | cut -f2 -d\  `
        rm /tmp/$$.$addr.out
        echo found SMB servers at $TARGETS
        for target in $TARGETS ; do
                echo '=========================================='
                echo Probing $target
                server=`nmblookup -A $target -s /etc/samba/smb.conf | grep '<00>' | grep -v '<GROUP>' | awk '{print  $1}' | tr [A-Z] [a-z] `  > /dev/null 2>&1
                echo Found server $server
                cred=`eval echo \\$$server`
                if [[ x$cred != x ]] ; then
                        dom=`echo $cred | cut -f1 -d/`
                        user=`echo $cred | cut -f2 -d/ | cut -f1 -d%`
                        passwd=`echo $cred | cut -f2 -d/ | cut -f2 -d%`
                        echo found credentials for $server
                        if [[ x$1 == 'x-v' ]] ; then
                                echo '------------------------------------------+'
                                nmblookup -A $target -s /etc/samba/smb.conf
                                echo '------------------------------------------+'
                        fi
                        smbclient -U $user%$passwd -W $dom -s /etc/samba/smb.conf -L //$server/ -I $target > /tmp/$$.$target.out 2> /dev/null
                        if [[ x$1 == 'x-v' ]] ; then
                                cat /tmp/$$.$target.out
                                echo '------------------------------------------*'
                        fi
                else
                        echo no credentials for $server - trying anonymous....
                        if [[ x$1 == 'x-v' ]] ; then
                                echo '------------------------------------------+'
                                nmblookup -A $target -s /etc/samba/smb.conf
                                echo '------------------------------------------+'
                        fi
                        smbclient -N -s /etc/samba/smb.conf -L //$server/ -I $target > /tmp/$$.$target.out 2> /dev/null
                        if [[ x$1 == 'x-v' ]] ; then
                                cat /tmp/$$.$target.out
                                echo '------------------------------------------*'
                        fi
                fi
                if [[ `grep -c LOGON_FAILURE /tmp/$$.$target.out` == 1 ]] ; then
                        cat /tmp/$$.$target.out
                        unset shares
                else
                        shares=`grep -v '[A-z]\\$ ' /tmp/$$.$target.out | grep Disk | awk '{print  $1}' | tr [A-Z] [a-z] `
                fi
                rm /tmp/$$.$target.out
                if [[ "x$shares" != x ]]; then
                        echo found shares: $shares
                        for share in $shares ; do
                                cred=`eval echo \\$${server}_${share}`
                                if [[ x$cred != x ]] ; then
                                        dom=`echo $cred | cut -f1 -d/`
                                        user=`echo $cred | cut -f2 -d/ | cut -f1 -d%`
                                        passwd=`echo $cred | cut -f2 -d/ | cut -f2 -d%`
                                        echo checking for $server $target $share
                                        if [[ `grep -c /tmp/mnt/$server/$share /proc/mounts` == 0 ]] ; then
                                                echo not mounted - will attempt to mount
                                                mkdir -p /tmp/mnt/$server/$share
                                                mount.cifs //$server/$share /tmp/mnt/$server/$share -o ip=$target,user=$user,pass=$passwd,dom=$dom
                                                if  [[ `grep -c /tmp/mnt/$server/$share /proc/mounts` == 1 ]] ; then
                                                        echo //$server/$share mounted successfully
                                                else
                                                        echo //$server/$share failed to mount
                                                fi
                                        else
                                                echo //$server/$share already mounted
                                                echo from `grep cifs /proc/mounts | grep /tmp/mnt/$server/$share | cut -f1 -d\ `
                                        fi
                                else
                                        echo no credentials for //$server/$share - skipping....
                                fi
                                done
                fi
        done
done

and the unmounter, unscan:

#!/bin/sh

echo unmounting stale shares
old_shares=`grep cifs /proc/mounts | grep /tmp/mnt | cut -f2 -d\ `

if [[ "x$old_shares" != x ]] ; then
        echo found $old_shares
else
        echo no old shares found
fi

for share in $old_shares ; do
         stop=0
         while [[ `grep -c $share /proc/mounts` != 0 ]] && [[ $stop != 5 ]] ; do
                 echo unmounting $share `grep -c $share /proc/mounts` - try $stop
                 umount $share
                 if [[ `grep -c $share /proc/mounts` != 0 ]] ; then
                        echo $share still mounted - trying....
                        sleep 1
                 else
                        echo $share unmounted successfully
                 fi
                 stop=$(($stop + 1))
         done
         if [[ $stop == 5 ]] ; then
                 echo failed to unmount $share
         fi
done

--Yan

Hi there,
did anyone succeed getting mounted a cifs share with kernel 2.4.32?
I´ve Fonera, with Original Firmware and FreeWLAN Addons installed. It is impossible to me, upgrading kernel because I want to leave FON functionality up and running.

I tried the code above but got the following:

root@OpenWrt:~# insmod cifs
insmod: A module named cifs already exists
root@OpenWrt:~#

The ipkg install ... went fine for me. Also (of course) the "mkdir /mnt/mount_point"
But:

 root@OpenWrt:~# mount.cifs \\\\<ip.of.my.svr>\\<share> /mnt/mount_point -o user="",pass="",dom=<workgroup>
mount error: mount point /mnt/mount_point is not a directory
root@OpenWrt:~#

(My share is not password protected for this test.)
Im sure, /mnt/mount_point" is a directory but why do I get this error?
What can I do next to get it go?
(I also tried the HowTo... no success.)

(Last edited by ChrisPHL on 2 Dec 2007, 14:40)

ChrisPHL wrote:

Hi there,
did anyone succeed getting mounted a cifs share with kernel 2.4.32?

 root@OpenWrt:~# mount.cifs \\\\<ip.of.my.svr>\\<share> /mnt/mount_point -o user="",pass="",dom=<workgroup>
mount error: mount point /mnt/mount_point is not a directory
root@OpenWrt:~#

Hi,

Running very well on Fornera+ with kernel 2.6.19.2

Try this perhaps:

mount -t cifs //ip_share/share_name /mnt/mount_point -o user=myname,passwd=my_pass

I think password is mandatory, not sure.
I'm running with this parameter at each boot, and just after mounting  swapfile installed on share.

Regards, Lama

root@OpenWrt:~# mount -t cifs //<ip.of.my.svr>/share /mnt/mount_point -o user="",passwd=""
mount: Mounting //<ip.of.my.svr>/share on /mnt/mount_point failed: Invalid argument
root@OpenWrt:~#

Hm... nothing...

ChrisPHL wrote:
-o user="",passwd=""

Don't work for me too, this is normal.
You MUST invoke username existing on your computer ! at least admin account.
This is a WinNT/XP restriction.

I create a user on my XP : fonera, with password fonera.
It's running.

Cherrs
Lama

Thought about that, too. But as my share is on a NAS that only makes passwords possible, got stuck there. Within WindowsXP I am only asked to enter password, username is grey (can´t change) and set to "\\<ip.of.my.svr>\Gast".
I´ll try this with a WinXP share folder...

No, it does not work for me.
Btw, I think Fonera+ and Fonera cannot be compared, because standard Fonera uses the old kernel version 2.4.32.
Is there s.th. else I could try?

Yes ChrisPHL,
perhaps the different kernel version 2.4 and 2.6

I'll try tomorrow or tuesday on classic Fonera.

Regards

Hi ChrisPHL

Just tried now with my new unpacked Fonera2100 - 0.7.2r2

Installed package kmod-fs-cifs-2.4.32 from http://fon.rogue.be/lafonera/ , no more.

Command line is very long, better to write a little script ;-)

root@OpenWrt:~# mount -t cifs //192.168.10.11\\fonera /mnt -o unc=\\\\192.168.10.11\\fonera,ip=192.168.10.11,user=fonera,pass=fonera,dom=MYDOMAIN
root@OpenWrt:~# ls /mnt
Fonera.gif
Loading.jpg
......

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
none                      7.0M     80.0k      6.9M   1% /tmp
/dev/mtdblock/2           5.4M      1.6M      3.8M  30% /jffs
/                         1.5M      1.5M         0 100% /
//192.168.10.11\134fonera    231.8G    105.5G    126.3G  46% /mnt

Regards
Lama Bleu

Equal what I do, if I try to mount my share on the NAS, I get an "Invalid Argument" error.

Lama Bleu wrote:

Hi ChrisPHL

Just tried now with my new unpacked Fonera2100 - 0.7.2r2

Installed package kmod-fs-cifs-2.4.32 from http://fon.rogue.be/lafonera/ , no more.

Command line is very long, better to write a little script ;-)

root@OpenWrt:~# mount -t cifs //192.168.10.11\\fonera /mnt -o unc=\\\\192.168.10.11\\fonera,ip=192.168.10.11,user=fonera,pass=fonera,dom=MYDOMAIN
root@OpenWrt:~# ls /mnt
Fonera.gif
Loading.jpg
......

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
none                      7.0M     80.0k      6.9M   1% /tmp
/dev/mtdblock/2           5.4M      1.6M      3.8M  30% /jffs
/                         1.5M      1.5M         0 100% /
//192.168.10.11\134fonera    231.8G    105.5G    126.3G  46% /mnt

Regards
Lama Bleu

It's a long time ago but I wanted to try again this weekend and yeah, it works! Now I'll share my solution here.
I used exactly what Lama Bleu does but left out dom-option and before I had to execute this:

echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled

This will be part of FreeWLAN Addons soon.

The discussion might have continued from here.