Muppy-SMB to find and mount shared network-folders (final?)

Under development: PCMCIA, wireless, etc.
Message
Author
User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

Muppy-SMB to find and mount shared network-folders (final?)

#1 Post by MU »

This dotpup tries to find shared folders of Windows or Linux computers in a local network.
It mounts only folders without password-protection.

You also can share a folder (/root/shared) on your computer for the network.

Download
http://dotpups.de/dotpups/System_Utilities/getdir.pup
http://dotpups.de/dotpups/Network/Muppy-SMB.pup (1.6 MB)

If you have a old Puppy (2.10 or older), you must install PuppyBasic 2.5 as alien Package:
http://ftp.nluug.nl/ftp/pub/os/Linux/di ... 2.5.tar.gz


If you run Muppy-smb from the dotpups-menu, you get a dialog.

Screenshot:
Image




You also can run it with a parameter, then no dialog appears:

This mounts all shares available to /mnt/Network/:
Muppy-smb -codepage 850

This mounts them with a german codepage, and opens /mnt/Network/ in Rox:
Muppy-smb -codepage 437 -rox

This unmounts them:
Muppy-smb -umount

For more info about sharing folders, read Rarsas great HowTo:
http://www.murga-linux.com/puppy/viewtopic.php?t=2163

Mark
Last edited by MU on Sun 14 Jan 2007, 21:25, edited 6 times in total.

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#2 Post by sunburnt »

MU; I'll try it tomorrow, it's late now.
It sounds a lot like a neo LinNeighborhood & also the boot mount util. I worked on.
I assume it'll also find Samba shares as well as Win. shares (it should).

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#3 Post by MU »

I assume it'll also find Samba shares as well as Win. shares (it should).
I think so too.
Will try to set up samba-shares at work later :)
Mark

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#4 Post by MU »

I updated the dotpup.
It now checks, if the created folders are really mounted.
If not, and if they are empty, they will be deleted.
This also happens when you unmount.

So your folderstructure stays "clean".

Folders with a "$" in the name will not be mounted, as it seems that they are temporary folders from Windows, like "print$".


So what remains to be done:
- speed things up.
As I added smbtree later, I do not use it yet to determine the foldernames.
Using it might be faster, as I could skip a loop.
- add some buttons to the dialog, like a help with Rarsas HowTo and LinNeighbourHood to be able to mount (protected) folders manually.
- detect german languagesettings to set -codepage 437 automatically?

Mark

Goble
Posts: 21
Joined: Fri 30 Jun 2006, 07:28

#5 Post by Goble »

Share names with trailing $ -char are "hidden" shares in Windows, not temporary shares. One can create a share name using $ as a last char to hide the share from other workstations on the network. Clients must know the exact name of the share to map it (ie using \\mypchost\files$ as a share name in file explorer or net use command).

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#6 Post by MU »

ok, thanks, so it is ok not o mount them I think.
If someone explicitly wants to use hidden folders, he could use them with LinNeighbourHood :)

Mark

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#7 Post by sunburnt »

Mark; I installed getdir.pup & Muppy-SMB.pup, & clicked for English.
Then I ran mount & no shares were mounted
There are 3 LAN shares & 2 local, I used LinNeighborhood to test mount them.

I couldn't make smbstatus give me any share info (weard), I didn't try much.
I used: "smbtree -N -S" to get WorkGroups & Hosts.
And used: "smbclient -L $HOST" to get that host's shares.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#8 Post by MU »

you could run it from a console, and post the output here.
Mark

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#9 Post by sunburnt »

I'm running Puppy-1 (duh), should be Muppy... right? (gee, I wonder if that's it?)
In case it might help, here's the complaint:

# ./Muppy-smb
101
# [Syntax error]
Expected an expression
in file "Muppy-SMB", line 29:
allmachines = xwin_system("./smbtree -N| tr -s ' '|cut -f2|grep '\\\\'|sed 's/\\\\//g'")
^

*** glibc detected *** double free or corruption (top): 0x080aeee0 ***

#


And hey! The picture's cool... you look like a rock star!

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#10 Post by MU »

I see, you use an old ersion of Puppybasic, that does not support xwin_system() yet.
Please upgrade with with pupget or using this unleashed package:
http://ftp.nluug.nl/ftp/pub/os/Linux/di ... 2.5.tar.gz

And hey! The picture's cool... you look like a rock star!
*lol* ok, if I just had the money and groupies ;)

I recently bought a webcam, that unfortunately is not supported by Puppys drivers (was extremely cheap, so I did not check in advance). Made a testvideo in XP then, that's what I took the picture from.
http://dotpups.de/pics/diverse/mark-nov-2006.avi

Mark

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#11 Post by sunburnt »

Success! It's late & all the other PCs are off, but it mounted both browsable shares on this one.
Tomorrow I'll try it again with all the PCs on, if there's errors I'll post back.

NOTE: LinNeighborhood defaults to making mount dirs. in /root, & there were problems with Puppy trying to backup the shares at shutdown, etc.
In Puppy1 all you had to do was set LinNeighborhood to make the dirs. out of /root.
In Puppy2 the SAVE file covers everything, so I don't know how to deal with it,
other than modifing Barry's code to unmount all shares before backing up.
Barry may have already taken care of this, I don't know...
You may be aware of this, or it may not matter, but I thought I'd mention it.
Here's the report:

# ./Muppy-smb
101
# Domain=[PUPGROUP] OS=[Unix] Server=[Samba 3.0.21c]
Domain=[PUPGROUP] OS=[Unix] Server=[Samba 3.0.21c]
mounting: /root/network/PUPSERVER/docs
###### //PUPSERVER/docs on /root/network/PUPSERVER/docs type smbfs (rw,nosuid,nodev,file_mode=0755,dir_mode=0755,codepage=cp)

mounting: /root/network/PUPSERVER/public
###### //PUPSERVER/public on /root/network/PUPSERVER/public type smbfs (rw,nosuid,nodev,file_mode=0755,dir_mode=0755,codepage=cp)

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#12 Post by MU »

Maybe I should mount them in /mnt/NetWork or /var/NetWork.

Then I could create a symlink NETWORK in /root so that it is easily found.
Mark

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#13 Post by MU »

Updated the dotpup, there was a potential bug with multiple domains.

I also tested a new version, that was slightly faster.
But it had a new problem: the Printer-folders were displayed as illegal entries in Rox.
Did not find out the reason.

The old version ran more stable, so I'll stay with that.
If someone wants to test my rejected new trial anyway, replace this file:
http://dotpups.de/tests/neu/Muppy-SMB

But I encountered another strange thing in both versions:
I just can mount 3 shares, after that I get a connect-error in the console.
It is not related to a special folder, as my new program sorted the entries differently.
The old version did not mount //TORSTEN/Dokumente, the new one TORSTEN/SharedDocs.

If it might be related to the maximum possible amount of loop-devices?
I'm puzzled about it, and have no idea at moment.


Mark

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#14 Post by sunburnt »

Hey Mark; I tried the newer script & nothing, this is all it output:

# ./Muppy-smb2
sh: ./smbtree: not found
.....UN-mounting
.....now mounting
sh: ./smbtree: not found

smbtree isn't in the dir. /usr/local/bin, so that's it...

###################
The old script sub dir. all hosts it found under the one before it:

# ./Muppy-smb
101
# mounting: /root/network/60GB//ME//PUPSERVER/MUSIC
###### Nothing
COULD NOT MOUNT
rmdir: `/root/network/60GB//ME//PUPSERVER/MUSIC': Device or resource busy
mounting: /root/network/60GB//ME//PUPSERVER/0

The hosts are: 60GB, ME, PUPSERVER... & MUSIC is the share.
It did this with all the shares, some mounted & some did not... of course.
It looks to be a simple dir. creation problem.

###############
I've made a short "mount everything" script, if you want to try it...
It'll smbmount, smbumount, & a test mode, you'll see it at the top.
It makes the mount dirs. in /tmp/smb, & they're one dir. deep (60GB_MUSIC)
You may want to mess with it, or I'll be glad to modify it for you...
It'd make a nice GUI with 2 ListBoxes, 1 = Hosts & 2 = Host's Shares.
NOTE: The test output may report something like this (just ignore it):
Domain=[PUPGROUP] OS=[Unix] Server=[Samba 3.0.21c]
Domain=[PUPGROUP] OS=[Unix] Server=[Samba 3.0.21c]
Attachments
smbmount-all.gz
May the Holidays bring Fortune & Joy!
(516 Bytes) Downloaded 838 times

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#15 Post by MU »

ok thanks., I'll have a look a wednesday at work.
Good to have another trial :D
sh: ./smbtree: not found
you must run it in the folder with smbtree, so replace
/usr/local/Muppy-SMB/resource/Muppy-SMB with it.

But forget it, because...


...today I tested further, and encountered this:
neither LinNeighbourhood nor smbtree listed both Computers with shares in our network.
They are TORSTEN and KLEINER, but only one was visible.

I finally managed to build a script that lists both.

http://dotpups.de/tests/SMB-tests/testscript

the output will look like this:
sh-3.00# ./testscript
TORSTEN/SharedDocs
TORSTEN/Exceldateien
TORSTEN/C
TORSTEN/Dokumente
KLEINER/SharedDocs
sh-3.00#

It does not mount or so, justs lists those folders, so that I can use it as an external tool to call from my Puppybasic-script.
Might be enhanced, for example it would work erratic, if you had two computers called "PUPPYPC".

To understand better how it works, I added some notes on the commands here:
http://dotpups.de/tests/SMB-tests/neushell.txt

Unfortunately every version does list far not all folders that are shared.
No idea why.

I also had this problem:
NOTE: The test output may report something like this (just ignore it):
Domain=[PUPGROUP] OS=[Unix] Server=[Samba 3.0.21c]
Domain=[PUPGROUP] OS=[Unix] Server=[Samba 3.0.21c]
The reason:
it is sent to the errorchannel "stdout".
You can suppress that with
thecommand 2>/dev/null

Mark

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#16 Post by sunburnt »

Yep; using smbtree, local shares on the PC it's being run on didn't always show.
That's why in the script, I use both smbtree & smbclient, reliable results it seemed.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#17 Post by MU »

Your script also shows just one server at work.

My script showed both servers, but now at home just one (I exported some folders in Puppy).

So I added lots of new code, and finally have a quite usable state:

http://dotpups.de/dotpups/Network/Muppy-SMB.pup (1.6 MB)

Screenshot:

Image

You can mount all folders found in a network, or share an own folder from your computer with 1 buttonclick.

smbd and nmbd are included.

Problems:
at work, not all shared folders from XP are visible, no idea why. Also LinNeighbohood cannot find them.

When you mount folders, and switch off the corresponding machine before unmounting them again, that might block Rox-filer for a minute or so.
It might be best to reboot then.

But this seem to be general problems, I am not shure that can be solved.

So if I get positive results, this might be the final version.

Mark

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#18 Post by MU »

I updated the dotpup.

Changes:
- smbtree is no longer used, as it was unreliable when a computer disconnected, and so the dotpup is smaller.
Instead I use nmblookup '*'

- when I mount, no longer everything needs to be unmounted before.
This makes it faster.

There remains this problem:
when a computer shuts of, while its shared folder is mounted, it cannot be remounted until you reboot.

I have no idea how to solve that.
Hmm.. maybe if I create a new folder...
If I get an input/output-error trying to create the mountpoint "NOTEBOOK/public" (because it was not unmounted before the shutdown of the remote machine), I could create "NOTEBOOK-$datetime/public" as a fallback.

Will try that next week.

Mark

User avatar
sunburnt
Posts: 5090
Joined: Wed 08 Jun 2005, 23:11
Location: Arizona, U.S.A.

#19 Post by sunburnt »

Gave the new one a try in Puppy-1 & it errored with: couldn't find dir.: initrd
Perhaps try a path to a Puppy-1 dir. & Puppy-2 will handle it properly.

I've been looking at my book: Using Samba, & it gives no clear single way of getting Hosts & Shares.
Typical... a M$ mess of a protocol with hap-hazard utilities... but we gots what we gots.

User avatar
Hacao
Posts: 226
Joined: Thu 11 Aug 2005, 03:27
Location: Saigon, Vietnam
Contact:

OK

#20 Post by Hacao »

Hi !

Work well,

Thanks,
[url=http://www.murga-linux.com/puppy/viewtopic.php?t=44675]Hacao Linux 2009 CE released ![/url]

[url=http://hacao.com]Hacao.com[/url] English & Vietnamese !

Post Reply