Samba - Share definition on a folder under a home directory
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Samba - Share definition on a folder under a home directory
I have set up samba to the best of my abilities (new at Linux - Red Hat Linux 9 is what I am starting with) and I believe it is running correctly - I can see the Windows2000 machine's shared folders from Linux and I can see the shared folders on Linux from Windows. I think that I just need a little explanation that I am doing this correctly.
The issue I am wondering about is that I wish to share a folder "docs" (/home/craig/docs) on the Linux machine without sharing the contents of "craig" (/home/craig), is that possible?
My understanding was that if you shared a specific folder located on the Linux box, that folder would be the only one available to be seen and explored on the network. What I am finding, is that I not only have the "docs" folder displayed in the \\workgroup\Localhost listing, but also its parent folder ("craig")and all of "craigs" contents including the "docs" folder displayed - "docs" and "craigs" show up as 2 separate entities.
However, I noticed that if I share a root folder like /tmp, that works fine and does not allow the contents of the root directory ("/") to be seen in the Windows Neighborhood.
The only thing that I tried was to comment out the [homes] section. This seemed to get rid of the home directories and leave me with just the directories that I have specified.
Is it really bad to do this? It seems to restrict users from looking at all files within their own user home files (ones that are not specified), including the hidden ones. It also seems to remove the names of the users on the network. Do you want all users names or home files on the Linux machine to be viewed by others on the network? Are there any pluses or minuses to all this?
Thanks for any help with this, I hope it is not to many questions for one posting, but they all seem interrelated to me. Thanks again.
[homes] is special i.e. samba automatically creates a home share for all valid users with the name of the shared directory as the username.
The home share is only visible and accessable by that user. Your the only valid user for docs so I am not sure why you want it as a seperate share except for maybe a shortcut. The point IMHO of having a home directory on a server is that a client can access data from any workstation on the network and it is hopefully backed up on a regular basis.
You can find documentation for samba at www.samba.org
Thanks for responding and I see your point about making files available. I guess a follow up point to my first question would be that it makes sense to see files like you would on you home directory, but why would you want "system files" and files that you do not create like the .bash history files and folders like .gnome, .mc, .moilla ... etc.
I would think that all you would want to appear on the network would be the files that you create. Is there a way to limit the files on the network to appear as they do when, on the Linux machine, you are looking at your home directory?
P.S. Thanks again for the help and thanks for the link I will check that out today.
The simplest thing is to create a new Documents directory (chmod -R 777) (chown -R root.users) and place what you want to share there. Make sure that all your users are members of the "users" group.
Then add the following to smb.conf:
[Documents]
comment = Public Documents
path = /home/samba/public/Documents
public = yes
browseable = yes
writeable = yes
valid users = @users
printable = no
I'm not sure what you mean by creating a new group for users. If you mean that you would want to exclude some and allow other users, you would do that in smb.conf with:
"valid users = user1 user4 user5 ...".
Craig wants to share folders between Linux and Win2k. To do this without Samba he would need to use nmb (nfs). While nfs, is built in to Linux, since it is open source, you have to purchase it for Windows.
To share a folder between Linux machines, all you have to do is right click on the folder (not on the desktop, but in your home directory). Click on properties and go to the tab marked "Local Net Sharing". Click on "shared" and then click on "Configure File Sharing".
Then it's on to "Allow all users" or "Custom" and you're set. But this only works between Linux machines.
Since I don't want to buy server software just for my Notebook, I just use Samba, since it's already there.
Thanks for the great info! I think I will stay with samba because it is free. Are there pluses to using nfs? What are the differences between the 2 (samba and nfs) other than cost for nfs on Windows?
well nfs provides a better management facility and it mounts the remote file/directory so as you are working on your machine only. These are a few general points. There are technical differences also
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.