0

I'm configuring a file server at work. It's an Ubuntu server where I've mounted and shared a hard disk. i.e. Via "Local Network Share" - samba under the hood.

This works fine. Users can browse to the machine from Windows. There is no need to provide credentials (before credentials were enabled and people grumbled).

But now I need to be able to upload files to the server. i.e. I need write permissions. But I don't want all users to be able to write.

Is it possible to set up the share so guests can browse and read it (with no credentials) but other users can sign in and write to disk?

I came across this post

https://serverfault.com/questions/354791/samba-share-with-guest-access-and-authenticated-users-for-write-access

which seems to suggest that it is. But in my smb.confg file I don't see the folder I'm sharing.

I also don't fully understand the suggestion. Some of the concepts are lost on me since I was a UI baby.

Clarification:

From the perspective of Windows users I'm looking to

a) Grant read-only guest access so anyone can download files without credentials b) Still support authorization (for 1/2 generic users) who can upload files.

The reason I need this is because I want to store pdb symbols on the server and use "symstore add" to upload them from a Windows machine.

0

If what your saying is permissions required are : user ??? , group (trusted) rwx, supplementary (named) r,public none. The only way to simulate this extra permissions is to make the files group read,public none user whatever. Then create a frequent cron job which will smartly copy users ~/.samba_upload this will be as root circumventing permissions.

  • I should clarify - from the perspective of Windows users I'll looking to a) Grant read-only guest access so anyone can download files without credentials b) Still support authorization (for 1/2 generic users) who can upload files. – Shane Gannon Sep 17 '14 at 9:04
  • PS: I'm new to Ubuntu and I'm afraid some of the concepts you've mentioned are going over my head. I understand file/folder permissions (i.e. controlled with chmod). But don't get what you mean by "user ??? , group (trusted) rwx, supplementary (named) r,public none". – Shane Gannon Sep 17 '14 at 9:10
0

Right lets take a step back. Every file has an owner (user) and is in a group. File permissions fall into 3 categories user, group and others. Users can be added to groups. File pemisions can be Read, Write or eXecute. The command apropos list all relevant manuals, the command man followed by a command displays that commands man(ual) page. Try commands chown and chmod are of intrest as are the ownership and permisions of the directory your samba-drive is mounted to. I think your solution is to put the files into a rw group and others r, put trusted users into the files group.

  • Ah - understand where you are coming from. The user group gets read-write while group other gets read-only. i.e. drwxrwxr--. But at the moment the permissions are drwxrwxrwx. i.e. Its open access. But still guest users cannot write (which is what I want). So I don't understand how file level permissions will help? i.e. Since it looks like they are irrelevant. – Shane Gannon Sep 17 '14 at 10:17
  • But your suggestion does seem to have helped me come up with a solution. While verifying my response I noticed some of the permissions where incorrect. Once I fixed them and restarted my own solution worked. – Shane Gannon Sep 17 '14 at 10:18
0

Was thinking it over and found a simple solution. The folder I'm sharing is

/mnt/primary/primary/Public

On Public I right clicked and choose Local Network Share. I set the following options

  1. Share this folder
  2. Guest access (for people without a user account)

I moved up one directory to

/mnt/primary/primary

On primary I right clicked and choose Local Network Share. I set the following options

  1. Share this folder
  2. Allow others to create and delete files in this folder

I also had to set a Samba User (otherwise there were no credentials to use for people accessing the primary share). I did that with

sudo smbpasswd -a USERNAME

Where USERNAME is the name of the user with write permissions. This command asked me to assign a password with USERNAME as well.

Now when I browse to the share from Windows I see 2 folders.

  • primary
  • Public

Users who browse into Public have read-only access and need no credentials.

Users who browse into primary get a username/password prompt where USERNAME/password works. Those who sign in have write access.

Caveat: This only works if the correct file permissions are set in /mnt/primary/primary. For simplicity I choose to grant full permissions to all users. i.e.

chmod 777 -R /mnt/primary/primary

But obviously this is a bad idea if you are concerned about security on the ubuntu machine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.