Jump to content

Sharing multiple drives W/Samba


Crashdamage
 Share

Recommended Posts

I have 2 Linux and 1 Winshaft98 machines setup with Samba. Everything works OK, but 1 Linux machine has a couple of large HDs with many, many gigs of mp3s, photos and other stuff I want to make available to the other machines, especially the other Linux unit. These drives are mounted as /data1 & /data2. Problem is Samba only allows shares that are mounted in /home. I tried putting links to the drives in public shares, but Samba doesn't support links either. I know this has probably been asked before, but searches in Google, Samba mailing list archives and Samba manuals have been no help. Probably a simple solution, but I'm too dense to figure it out.

Any Samba experts out there know how to do this?

Link to comment
Share on other sites

You need to add a new share. The easiest way is to use SWAT if you have it installed, point your browser at http://localhost:901/ (I think, somebody correct me if I got the port wrong I am writing this from winxp from memory).

 

Or, you can manually add a section to /etc/smb.conf

You need to add something like this for each of your directories. (This code adds a share called mp3 which gives read/write access to everyone with an account on the machine to the directory /data1.

 

[mp3]

path = /data1

writeable = Yes

 

That's it however, if you want users to be able to edit files created by other uses then you will need to fiddle about with masks. Here is the above lines modified to include my masks. (This assumes that existings files are accessible by all users).

 

[mp3]

path = /data1

writeable = Yes

create mask = 0777

force create mode = 0777

directory mask = 0777

force directory mode = 0777

inherit permissions = Yes

 

Or if you want to restrict access to a particular group (which is very useful and what I use most often) then you want to use the following code, which restricts access to only the users in the group music. (The @ sign in the valid users line means group rather than user, I leave it as an exercise to work out how to restrict access to a single user). (This assumes that all existing files are read and writeable to the group music.)

 

[mp3]

path = /data1

valid users = @music

force group = music

writeable = Yes

create mask = 0770

force create mode = 0770

directory mask = 0770

force directory mode = 0770

inherit permissions = Yes

Link to comment
Share on other sites

I should've been a little more complete in my first post but I was in a hurry, sorry. I already tried manually adding shares in /etc/smb.conf like you suggest, but couldn't get the newly defined shares to mount. I thought it must be something to do with the thing about no shares allowed except in /home. Anyway, that's when I thought I'd try creating links to the drives in /home instead. Didn't realize Samba doesn't allow links.

 

I must've goofed somehow in defining the shares, but it passed testparm...hmmm...I'll go back to that and make sure I make no mistakes. At the time, I thought that's how I should do it and it still sounds right that that's the correct approach. I'm at work now runnin' Winblows, but I should have time tonight to try it again.

 

Thanks!

Link to comment
Share on other sites

Things to check (and do) if it doesn't work after you modify smb.conf (the first one is very obvious although not strictly neccessary, I think)

 

1. Restart samba

2. If you just use the basic setting (no user or group information) check that the user you are trying to mount the samba share as can actually access the files under linux. If not you won't be able to access them under windows or samba.

Link to comment
Share on other sites

Yeah, I'd thought to do "service smb stop" & "service smb start" and file permissions are ok.

I messed around some last night and got the new shares to mount, (it WAS an overlooked file permission screwin' that up) but any attempt to browse or copy them immediately locks up any file manager. Tried a couple of configurations in /etc/samba/smb.conf, including configuring them just like the public shares that work corrrectly. Testparm still ok with what I was trying. I was falling asleep before I got it fully sorted it out. I'll play with it some more this weekend and tell what I've done in more detail.

 

Thanks!

Link to comment
Share on other sites

Alright, after quite a bit of foolin' around yesterday, I've got this working, but not quite right. I'm not even quite sure how.

 

I can mount and copy from the /data1 & /data2 drives now, and file managers don't immediately lock up, but it's (samba itself?) very unstable. Tried using Endeavour2 (which never,*ever* gives any trouble normally), Konqueror, XWC, MC - doesn't matter what file manager I use, any of them may lock up anytime when trying to copy or browse the shares. Endeavour2 seems a little better than the others, no surpise there. This might happen while browsing the shares or in the middle of copying a group of folders - just stops, locked up. Randomly, as far as I can tell. It isn't a file permissions thing, 'cause it may stop while copying folders with the exact same permissions. I noticed it always has finished a folder, not stopped in the middle of a group of files, at least so far. When it locks up, it leaves the accessed share dead and unable to be unmounted, and the only thing that really clears it up is rebooting the client machine. A couple of times, I had to reboot the server unit because it left a dead share there too. I hadn't rebooted that machine in months, but I couldn't get it straightend out with ps, restarting X, stop/start samba, etc. so...do it the old Winshaft way...

 

I tried several definitions for the shares in /etc/samba/smb.conf including variations of the examples suggested and a couple of others I thought might work. Finally just went back the the simple ones I started with. Present examples of some of my shares:

 

[Data1-MP3]

path = /data1/MP3

comment = /data1/MP3

public = yes

guest ok = yes

writable = yes

 

[Data2-MP3]

path = /data2/MP3

comment = /data2/MP3

public = yes

guest ok = yes

writable = yes

 

[Downloads]

path = /home/tim/Downloads

comment = /home/tim/Downloads

public = yes

guest ok = yes

writable = yes

 

Passes testparm, of course. Been using Komba2 and thought about switching to LinNeighborhood but I get the same results mounting shares manually from a terminal so screw that.

I don't understand why this is so unstable, much less why the shares didn't work at all when I tried these same entries the first time. I thought I had some idea what i was doing with samba - I've setup samba a couple of times before and never had much trouble.

 

I get the feeling the answer to this is really simple, one of those things where you appreciate the aynonimity of the 'Net where you can be real stupid without guilt...

Link to comment
Share on other sites

I have some suggestions you might like to try. The first one in the list has definitely caused me problems before with some versions of windows (I can't remember if it was win95 or win98 but I think it was win98), the others are just some suggestions that are along similar lines and may help or may not. Please also note that these apply to share names not file or directory names.

 

1. Some of your share names are too long. Try share names of 8 or less characters.

 

2. Try using all lowercase for your sharenames. I have had problems where one system is sending case independant data while the other is expecting case dependant data.

 

3. Get rid of hyphens and other non-alphanumeric characters from your sharenames.

 

Hope these help, but like I said they might not.

Link to comment
Share on other sites

Thanks for the suggestions. I didn't necessarily expect them to work 'cause I'm working with 2 ML 8.2 & 1 Win98SE machines and none of those should have any proble m with long filenames. But I thought you might have hit on something with the upper-lower case stuff. I tried all the suggestions, but still the same situation. Unstable and frustrating, and it seems just about as unstable no matter which machine I'm working from.

 

I'm not used to all this rebooting anymore. If anyone knows how I can avoid doing it to kill dead shares I'm all ears!

 

I think I'll try uninstalling samba and reinstall with a newer version. I'm still using 2.2.3 that came with 8.2. It's one of the few packages I use much I haven't upgraded. Think I'll go ahead and give LinNeighorhood a try too, I'd kinda like to anyway. Maybe somehow all that will just get me lucky and straighten things up. Maybe it's a samba install gone bad? I'm out of other ideas...

 

Well, maybe not quite...I've got a couple of new nic cards laying around, with different chipsets than the ones I'm using now too. I'll do some swapping around. Maybe a bad card? Some kinda bug in the driver for the ones I'm using?

Link to comment
Share on other sites

Sorry my suggestions weren't much help. The only other thing I can suggest and this really is scrapping the bottom of the barrel, is changing the name of the host computer you are trying to connect from (the win98 SE ones), using all lower case letters only, less than 8 characters. Believe it or not I just couldn't get a win98 client to connect to my samba server although it could read shares from all the other windows machines on the network and see the shares from my Linux box. This was after a reinstall and I had changed the name of the machine to fit my new naming convention (calling all my staff computers after Babylon 5 characters), so I changed the name back to what it had been previously and it worked fine. Later I tried the same name on different computers and they didn't work with that name either. So my suggestion if changing the name of your computer.

 

As to your other point. You can kill old shares by restarting smb. If you don't know how to do this from the command line but have SWAT installed point your web browser (running on the server) at http://localhost:901/

Link to comment
Share on other sites

Thanks, but as I said a couple of posts ago, I already tried stopping and starting smb, restarting X, checking with ps etc., etc. Nothing I could think of but a reboot would kill the dead shares.

 

I haven't had time to mess with this anymore since my last post, but this weekend I'm gonna try the stuff I talked about like swapping nic cards or reinstalling samba. It's gotta be a corrupted file, goofy nic driver, something odd but simple like that. If I figure out just how to fix it and not through sheer stupid luck, I'll post it here for anyone who has a similar problem.

Link to comment
Share on other sites

  • 8 months later...

I cant tell you how much smb.conf tinkering I have done, and across a few versions of Samba now my method for seeing through the successful restart of Samba is the following

killall -HUP smbd

and

killall -HUP nmbd

which is really only necessary for naming, so...

 

Anyway, another point I felt it important to touch on in case someone comes across this thread later is the fact that unless this is very old information, there is no reason you should have to have your shares stem from /home. I have shares across all of my drives and they all work flawlessly. I share them to both nix and 98/2k boxes.

Link to comment
Share on other sites

  • 1 month later...

A follow up to my last follow up:

I've abandoned killall -HUP smbd and nmbd as I saw it fail me once.

I'm critical that way. Now I take the longer route of "killall nmbd" and "killall smbd" followed by "nmbd -D" and "smbd -D". Also, nmbd is strictly supposed to be about name resolution and what "level" your samba server is, etc., but I typically go ahead and restart it too just to be sure even if I am just changing a share definition.

 

I don't claim to be a know all on Samba, but I have done quite a bit of learning and use it a lot.

Link to comment
Share on other sites

  • 4 months later...
Guest sgla1
[mp3]

path = /data1

writeable = Yes

 

That's it however, if you want users to be able to edit files created by other uses then you will need to fiddle about with masks. Here is the above lines modified to include my masks. (This assumes that existings files are accessible by all users).

 

[mp3]

path = /data1

writeable = Yes

create mask = 0777

force create mode = 0777

directory mask = 0777

force directory mode = 0777

inherit permissions = Yes

This looks like exactly what I was trying to do. My only question is: the 'mask' numbers look like the actual file permissions you want. Is 'mask' in smb.conf different than umask, which is the offset of the permissions you actually want set?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...