Samba: net usershare command, and requesting an example from smb.conf
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
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: net usershare command, and requesting an example from smb.conf
Ubuntu Server 8.10 with Samba (not sure how to figure out which version, but it's only been a couple of days since I did:
apt-get install samba
and it's apparently working, at least to some extent.
My server is without GUI, and I'm trying to do everything using the CLI and NOT install any kind of GUI - no Webmin and especially no desktop.
Plus, I'm running it virtually headless (not "actually" because I've still got a monitor and keyboard and mouse - whatever purpose THAT serves! but "virtually" because I'm doing everything remotely from my WinXP Pro desktop using PuTTY, and I'm not looking at the server monitor, which has timed out and turned off).
I have managed to get my RAID5 array mounted, and I'm able to see the folders & files when I'm logged in using PuTTY.
I have created the users, both in Linux and in Samba, and both have the same username & password.
I am trying to create the shares using
net usershare add DATA /NW-DATA/DATA Network-Data david:f guest_ok=n
where "DATA" is the name that I want to appear when viewing the Microsoft Windows Network,
/NW-DATA/DATA is the folder (and all sub-folders) that I want to see when I look at "DATA" from the Windows machines,
[Network Data] is the comment, david:f is the acl where david is to have full read/write rights,
and guest_ok=n means that guests cannot use it.
All this is assuming that I understand the "net usershare" command
When I enter the command, it comes back to the command prompt. I am now able to SEE "data" in my Microsoft Windows Network, but can't get into it. So, I'm wondering, Did I enter the command correctly?
Also, if someone has an example from smb.conf of a folder they're sharing, that'd go a long way to helping me. I HAD one, but apparently failed to move the data cable when I did a full installation of Ubuntu 8.10 - so, instead of installing on a blank drive, I installed on a drive I'd gotten running by copying a section from my OpenSuSE OS HDD, but my OpenSuSE OS HDD is the one that's blank (I blanked it with the intent of doing the second Ubuntu install on it while I kept the first one exactly for this purpose. Me thinks me screwed me self!
Tomorrow, we're running to the bookstore & I'm going to see if they have something worthwhile on Samba. I've already exhausted Linux for Dummies and The OpenSuSE Bible, neither of which are much help as both re oriented toward GUI use.
That looks pretty good. I'm picking up a book on Samba this morning, so I'll have a bit more reference. I'll let you know what I end up with. My smb.conf does not have a [share] section, yet, so I've got to insert that, too.
I HAVE inserted most of the text you've provided - with changes reflecting my system.
I have definitely looked at some of the Samba.org instructions. The problem is mine - I'm either too busy dealing with the kids in the morning, or too tired in the evenings, to be able to - within my realm of patience - find what I need, implement it, test it, and confirm that it works or try something else. Finding it, and recognizing that I've found it, is usually the hard part. That's why a book does me worlds of good - I can read it during the work day when I'm taking a few minutes break, and it's uninterrupted concentration time.
The bookstore had no Samba books, but did have almost a dozen different ones I could order (& wait weeks to get). However, they had Linux Administration - A Beginner's Guide - Fifth Edition, which I purchased because it had some decent looking sections on sharing and users and permissions (as well as hardening a server), and most of it had comprehensive CLI syntax that looks like I can use it. They had another that was comprehensive to Ubuntu, but only a very small section on the Server, and even that was GUI oriented - it came with a DVD and was $15 more expensive, so I didn't figure it would provide 25% more value! Maybe when I get to installing Ubuntu on our desktops, it'll provide more value. But, for the moment, I went with the more generic book - it's more in-depth than the "For Dummies" book that I got.
And, speaking of strictly Linux, is there that much difference in how the Kernels work? I mean, I understand that the server version is better for that purpose, and the desktop version comes with a GUI. And, I understand that different distros have their own agendas of releases & how they follow-up to fix bugs (or don't). But, the core of the Linux kernel is essentially the same from one version to another, and Samba is equally consistent. Is that a reasonably true assumption?
I recall seeing an article on the difference between server and desktop kernels for Ubuntu, but honestly can't recall what they were. it's not a difference kernel as such, just that they compile it with different options. If you ever feel the urge to compile your own kernel, you'll find that you can select what drivers to support, what filesystems, memory models, etc to activate. This is what they mean. Different kernel versions include bug fixes, new drivers (the latest supports the ext4 filesystem for example).
Tell me, what are you trying to do with samba exactly?
Tell me, what are you trying to do with samba exactly?
Bill, in a nutshell, I'm trying to learn enough about Samba that I'm able to do complete administration from the command line. That's a big task, I know, like learning DOS when all I know is French (I know far more DOS than French, but that's the idea). That's the big picture. Specifically, I want to be able to use the CLI to create shares & then to create users within groups that have RW access to some folders, RO access to other folders, and not even able to browse other folders.
I figure that if I can do it with the CLI, then I'll have a pretty good understanding of the nuts & bolts of the system. I'd like to be as fluent in Linux & Samba as I am in DOS & Windows.
Big task, I know. But, I'm "konquering it one task at a time!"
Just remember - Linux permissions trump Samba permissions, so if a user or group doesn't have directory/file access at the Linux level, it won't matter what you tell Samba to do.
ie, it you are connecting as user david, group users, but the directory is owned by root:root with 700 permissions, Samba won't be able to force a read or write of that directory.
Also, SELinux can be an issue with Samba if you are using it. If so, remember to check audit logs.
When you say using the command line, I assume you're just editing smb.conf?
Just remember - Linux permissions trump Samba permissions, so if a user or group doesn't have directory/file access at the Linux level, it won't matter what you tell Samba to do.
That is good to know. I didn't figure that there were overlapping jurisdictions, but it sounds like they are and that Linux takes precedence over Samba. This leads me to ask the question: Is there a way to share files to Windows desktops without using Samba (or another, similar, type of package)?
Quote:
Originally Posted by billymayday
Also, SELinux can be an issue with Samba if you are using it. If so, remember to check audit logs.
You mentioned this to me previously, and I looked at the file (I'd have to look back at that thread/post to see which one), but I couldn't tell you that I recognized anything from SELinux - not that I'd recognize it if it was printed on my eyeglasses!!!
Quote:
Originally Posted by billymayday
When you say using the command line, I assume you're just editing smb.conf?
Actually, no. I'd PREFER to issue commands from the prompt and let them put the information where it belongs. It is good, however, to look into smb.conf (& other files such as etc/passwd, /etc/shadow, bashrc/.profile, /etc/group - just to name a few) to see the changes the commands make. Among the commands, I'd like to use useradd, userdel, usermod, groupadd, groupmod, & groupdel. And, as I'm guessing you are understanding, these are just the ones I've read about today. If I can get away without modifying any files directly, I'd rather be able to do that because it means I'll have a strong grasp of the commands, and I'd be able to learn the editing of smb.conf (& the other files) by seeing how it/they change as I use the commands.
And, here's the most important part: I'm making a document so that I'll be able to rebuild the server quickly and efficiently. It'll be easier for me to do that with instructions centered around the commands & not the editing. Plus, in the event of a true disaster when my wife might have to rebuild the server (& she hasn't got the grasp of technology that I have). She'd be easier able to execute the commands than to edit the files manually (she follows a recipe pretty well, and that's how easy I want my instructions to be, and that's what I've managed to accomplish - so far).
Aaah, the weekend is here. I'll have more time to read and work through this!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.