8

My home setup has a Linux server which serves several shares, each with a different user & password.

I.e.: public, user1, user2

I can connect to my shares individually via \\server\public with the user & password.

However, once I entered credentials for one of the shares, it seems I can't access any of the other shares on the same machine.

Is there a way around this?

4
  • Is there a particular reason you don't want to create an additional user that has access to multiple shares? Also, are you mounting through explorer or using command line (e.g., net use)
    – Eric G
    Feb 16, 2012 at 5:01
  • There is a specific reason. One share is public for all of the house guests (e.g. public), and others are private (user specific). Explorer uses the same windows resources as net use so there won't be any difference there. (And I tested to make sure of that)
    – Am.
    Feb 16, 2012 at 9:12
  • So, it should be mapped for each logged in user, its not that you want to map them all with the same windows account? If its one account to many shares, then you should be able to add additional permissions in your samba configuration.
    – Eric G
    Feb 16, 2012 at 14:43
  • My samba config has several users for different shares. That one works fine when i login each time with a different user from my client pc. but once i logged in, I cant log to another share with different credentials.
    – Am.
    Feb 16, 2012 at 23:37

3 Answers 3

4

Following the answers here Samba+Windows: Allow multiple connections by different users?, I figured there is no solution from the windows client.

So I added several aliases to my linux server: /etc/samba/smb.conf

[global]
    unix extensions = no
    netbios aliases = ALIAS1 ALIAS2 ALIAS3
    wide links = yes
    workgroup = WORKGROUP
    os level = 20
    follow symlinks = yes
    wins support = true

then I connected to each alias with a differenet user & password.

1

I realize this is old, but I ran into a similar issue. I found that I could fix it by setting the folder as a public share, but then also adding access for the users who were already set up with other folders.

My setup (for public share in /etc/samba/smb.conf):

[Share]
    comment = Public Share
    path = /path/to/target/folder
    available = yes
    browsable = yes
    writeable = no
    public = yes
    valid users = user1 user2 user3 # These users are set up with their own shares

This way the authorized users can use their credentials to access the public folder.

EDIT: So I am learning my way around this site, and of course still around Linux, and apparently Windows!

After setting things up as above and seeming to have everything working properly, my in-laws brought their laptop, which I did some work on and then used to check my network share settings. I was kinda right. So since then I've done some more testing.

My final settings for public share are:

[share]
comment = Public Share
path = /path/to/public/share
guest ok = yes
guest account = nobody
browsable = yes
writeable = no
public = yes

Of course Ubuntu (20.04) lets me mount my private and public shares independently with no questions asked other than for passwords for the private shares.

Windows 7 seems to let me mount both public and private either in that order or reverse. (Public, then private, or private, then public.) It seems that if my username and password are the same for the Win7 account as for the SAMBA share account, it will log me right in to the matching private share. (Confirmed by attempting to open a share that isn't mine, and it asked for credentials.)

Windows 10 on the other hand, will only allow both shares mounted if the private share is mounted first. At least the first time, or for random mounts. If the private share's password is saved and both shares are set to "mount at login", it seems to work smoothly.

2
  • It seems you may be attempting to edit this with a second account bracham rather than Bracham Holfeld If that is the case, the accounts should be merged superuser.com/help/merging-accounts
    – Dave M
    Apr 25, 2020 at 11:38
  • Thank you Dave! That was much easier than I expected!
    – bracham
    Apr 26, 2020 at 5:37
0

The solution with multiple netbios aliases is great because it is done on server and can be accessed from any device on the network. However some devices do not have this options in settings nor will allow you to edit configuration files directly.

I found a simple workaround for Windows:

You can edit localhost file in C:\Windows\System32\drivers\etc

You must first gain permission to save changes to the hosts file. You can run your plain text editor (notepad, notepad++) as administrator and navigate to file within the app or you can give yourself a permanent permissions:

  1. Click on it with right mouse button and select "Properties".
  2. Go to "Security" tab and click "Edit". "Permissions for hosts" window will open.
  3. CLick "Add" and type in your Windows account name, then click OK.
  4. You are back on "Permissions for hosts" window. Make sure your username is selected in "Group or user names" box, then tick the checkbox "Full control" in column "Allow" in the box below.
  5. Click "Apply" and then "Yes" on the popup window. Then "OK" and "OK" again.

You can now open your hosts file in any plain text editor (like notepad, notepad++) and add your aliases to the end of file.

Write IP of the server followed by space, followed by alias. For example:

192.168.1.126 User.Server
192.168.1.126 User2.Server
192.168.1.126 User3.Server

Then you can simply access your share via \\User2.Server for example or map it as a network drive.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .