Nope. Your server won't understand the credentials from your local PC because the SIDs would be completely different even if you have the same name on both servers.

If you're looking to have a central file space, you can just map the share as a network drive and the auto-login capabilities will take care of your requirement.

Answer from Nathan C on Stack Exchange
๐ŸŒ
Samba
samba.org โ€บ samba โ€บ docs โ€บ using_samba โ€บ ch09.html
Samba
In Chapter 3, we showed you how to add Windows clients to a network in which user accounts were maintained on the Samba server. We added a user account to the Windows client using the same username and password as an account on the Unix system. This method works well in many computing environments.
๐ŸŒ
SambaWiki
wiki.samba.org โ€บ index.php โ€บ Adding_users_with_samba_tool
Adding users with samba tool - SambaWiki
June 11, 2017 - To create a Unix user, you use ... you must add these options: There are two other options available, if you do not supply these, they will be set for you: There are several other options available, these are applicable whether you are creating a Windows or a Unix user: If you create a Windows user and then need to make it a Unix user as well, you can do it this way: Find the SID allocated to the user by using the following command on a Samba ...
Discussions

How to create a Samba share that is writable from Windows without 777 permissions? - Unix & Linux Stack Exchange
What is the correct way to gain write access to Samba shares from a Windows domain computer without granting 777 permissions? ... I recommend to create a dedicated user for that share and specify it in force user(see docs). Create a user (shareuser for example) and set the owner of everything in the share folder to that user: adduser ... More on unix.stackexchange.com
๐ŸŒ unix.stackexchange.com
Samba/Windows shares with AD authentication
I'll give this a shot because it sounds like a similar problem I ran into a while back. I'm not sure I can give you a step by step, but might point you in the right direction. If I remember correctly, sssd is what you want if you want to use the Rocky machine to access content on an AD domain. However, it is not compatible with Samba, so you do not want to use it if you are trying to set Rocky up as an AD member server. I use realm to join the domain, but specify samba instead of letting it use sssd which it seems to try to default to: sudo realm join -v --membership-software=samba --client-software=winbind your.domain.here More on reddit.com
๐ŸŒ r/RockyLinux
17
7
June 6, 2023
TrueNAS Scale SMB

Do it over again.

Leave everything to defaults.

Add one user, make the user 'god', add them to the share.

Try again.

More on reddit.com
๐ŸŒ r/truenas
8
8
May 22, 2021
Can't access Samba Share through Windows 10
What version of SMB are you allowing? Win10 jettisoned SMBv1 about a year ago. More on reddit.com
๐ŸŒ r/OpenMediaVault
8
3
March 25, 2020
๐ŸŒ
SambaWiki
wiki.samba.org โ€บ index.php โ€บ Windows_User_Home_Folders
Windows User Home Folders - SambaWiki
February 1, 2024 - Log in to a Windows machine using an account that has permissions to create new folders on the \\server\users\ share. Navigate to the \\server\users\ share. Create a new home folder for the user. Add the user to the access control list (ACL) of the folder and grant Full control to the user.
๐ŸŒ
nixCraft
cyberciti.biz โ€บ nixcraft โ€บ howto โ€บ centos โ€บ samba add a user
Samba Add a User - nixCraft
May 25, 2014 - Let us say you want to give joe access to /data/accounts (make sure directory /data/accounts exists) directory. Open /etc/samba/smb.conf file and add/modify share called [accounts]:
๐ŸŒ
Cheap Windows VPS
cheapwindowsvps.com โ€บ blog โ€บ how-to-add-a-samba-user-on-linux
How to add a Samba User on Linux - Cheap Windows VPS
January 24, 2025 - There, weโ€™ve added Sam. Save and close the file. Thereโ€™s one more step to do before Sam can access the share, though. Once youโ€™ve saved your changes, youโ€™ll need to restart Samba to see the new permissions take effect. ... At this point, the new user should have access to the Samba network share. ... Deploy a pure-NVMe Windows or Linux VPS in minutes โ€” full admin access, instant setup, from $6/mo.
Find elsewhere
Top answer
1 of 2
1

I assume that you have a central windows server with central user profiles (active directory). To integrate these workstations you have to mount the user home directories into /home on your linux machines and hook up the active directory into linux.

The keywords that you want to search for are: ldap pam active directory integration. Useful links:

  • Ubuntu Active Directory Howto
  • Debian LDAP/PAM

note that integrating a windows machine into linux/ldap is generally not recommended (unless you have lots and lots of spare time on your hands). It might work satisfactorily with Samba 4.0. I haven't tried since it provides its own ldap...

Edit: I think I might have misunderstood you. If you want to access a linux samba share from windows simply follow the Ubuntu Samba Server Guide. If you want to login with as $user to the server simply create $user on the server. And set a samba password for the user:

smbpasswd -a $user

the configure the samba server according to your needs. Note: You don't need ldap/kerberos for this kind of setup. It usually helps to use your windows username and password as username/password for the linux user $user. In that case you won't need to configure any passwords on Windows.

2 of 2
1

I haven't actually tried this but I might need it myself soon. Maybe this link could help you? For future reference I'll copy the proposed solution here as well.

Add a line in /etc/samba/smbusers of the form:

linux_name = windows_name1 windows_name2 <etc.>

e.g.
a_user = [email protected]

This maps Windows name(s) (i.e. your Microsoft account used to log on to Windows 8) to a linux name (i.e. an existing linux & samba account). You may also need to add this parameter to the [global] section of: /etc/samba/smb.conf.

username map = /etc/samba/smbusers

To test the configuration use the following command:

testparm -vs | grep "username map"

Let me know if you got it to work!

๐ŸŒ
Linux.org
linux.org โ€บ home โ€บ forums โ€บ server linux โ€บ general server
add a user into samba windows file sharing. | Linux.org
May 14, 2013 - For samba sharing we should have the same user name in linux and window AD side create samba user and make sure smb user and linux user should same smbpasswd -a username pdbedit -l --> to show samba users testparm - to check if any errors restart the smb service Go to windows servers and go to network and give the ip
Top answer
1 of 1
5

I've managed to figure out how to make what I requested work and will post the instructions.

  1. First, you need to figure out what the username you need to add is. The easiest way to do this is to first add log level = 2 to smb.conf. Then start and enable the Samba service. Then connect to the Samba server using File Explorer on the Windows PC while logged into the relevant account (you don't have to open any shared directories). Then open the log file found at /var/log/samba/log.<ip address of Windows PC> and the required username will be noted there. You can now set log level to 0 if you want.
  2. Create a Linux account for the Samba user using the useradd command (or use an existing one if you prefer). You don't need to worry about passwords with this account but if you create a new account, you may want to block login on it. This account's username doesn't have to be the same as the name noted above but it would be easier if it was. This account's purpose is for the purpose of file permissions and for Linux to determine what files and directories the Windows user is allowed to access.
  3. Create a Samba user with the same name as the Linux account in step 2 using the smbpasswd command. Make sure the password assigned to this account is the same as the one used for the Windows account.
  4. If the Samba and Windows accounts don't share the same username, you will have to either add !<Samba user> = <Windows user> to smb.conf or add <Samba user> = <Windows user> to smbusers and username map = /etc/samba/smbusers to smb.conf.
  5. And that should be it. Be sure to set the valid users = option on any shares you want accessible only by your Windows account.
Top answer
1 of 5
103

I recommend to create a dedicated user for that share and specify it in force user(see docs).

Create a user (shareuser for example) and set the owner of everything in the share folder to that user:

adduser --system shareuser
chown -R shareuser /path/to/share

Then add force user and permission mask settings in smb.conf:

[myshare]
path = /path/to/share
writeable = yes
browseable = yes
public = yes
create mask = 0644
directory mask = 0755
force user = shareuser

Note that guest ok is a synonym for public.

2 of 5
6

In the share settings in smb.conf, you'll need to specify the names of users and/or groups that are allowed to write to the share, using a write list = ... line.

Example:

[myshare]
...
write list = my_linux_username

Then you'll need to use the smbpasswd command to set up a password to authenticate my_linux_username for Samba:

sudo smbpasswd -a my_linux_username

This step is necessary because the standard system passwords in /etc/shadow are hashed in algorithms that are incompatible with the password hash algorithms used in the SMB protocol. When a client sends a SMB authentication packet, it includes a hashed password. It can only be compared to another password hash that uses the same algorithm.

(Very, very old instructions from the previous millennium may recommend disabling password encryption in Samba, and using certain registry hacks to allow Windows to emit unencrypted passwords to the network. This advice is obsolete: those registry hacks may no longer work in current versions of Windows, and allow anyone who can monitor your network traffic to trivially capture your password.)


There's one more thing you may have to do client-side. When your Windows client system is joined to an Active Directory domain and you're logged in with an AD account, it automatically prefixes all unqualified usernames with the name of the AD domain of the user, i.e. you will be authenticating as AD_DOMAIN\your_username, not just your_username.

If you are logged in with a local account (or your client system is not joined to an AD domain), Windows may automatically prefix the username with the client hostname unless you specify another domain name.

To successfully log in to a stand-alone Samba server from a stand-alone Windows client, you may have to specify your username as SAMBA_SERVER_HOSTNAME\your_username.

Otherwise Samba will see the username as WINDOWS_CLIENT_HOSTNAME\your_username, conclude that it has no way to verify any users belonging to domain named WINDOWS_CLIENT_HOSTNAME, and will reject the login.

(Newer versions of Samba may have a built-in check for this specific situation, and they might allow you access nevertheless. But this is basically how SMB authentication works "under the hood", and if you need to deal with old versions of Samba, it might be useful still.)

๐ŸŒ
LinuxQuestions.org
linuxquestions.org โ€บ questions โ€บ linux-newbie-8 โ€บ add-windows-user-to-samba-share-560256
add windows user to samba share
June 8, 2007 - I have a samba share and do not know how to grant a windows user access [spout] path = /app/safepay/outbound browseable = no create mode = 750
๐ŸŒ
Super User
superuser.com โ€บ questions โ€บ 1473041 โ€บ how-to-associate-a-windows-user-with-a-linux-user-for-samba-share-permissions
How to associate a Windows user with a linux user for samba share permissions - Super User
August 19, 2019 - Currently getting "no access permission" error (even though, ostensibly, the Windows users linux uid and gid in AD should pass the shares ACL restrictions). Anyone with more experience with these kinds of problems have any advice or best practices recommendations? ... @Ramhound So are you saying that I need to make individual samba users (via smbpasswd -a <user>) for each of the users?
๐ŸŒ
Linux Mint Forums
forums.linuxmint.com โ€บ board index โ€บ main edition support โ€บ networking
Samba and Windows usernames ! (SOLVED) - Linux Mint Forums
unix password sync = Yes syslog = 0 log file = /var/log/samba/log.%m max log size = 1000 dns proxy = No usershare allow guests = Yes panic action = /usr/share/samba/panic-action %d idmap config * : backend = tdb force user = stuart [printers] comment = All Printers path = /var/spool/samba create mask = 0700 printable = Yes browseable = No [print$] comment = Printer Drivers path = /var/lib/samba/printers [Fileshares] comment = Test Folder path = /home/stuart/Fileshares valid users = stuart nobody acest read only = No create mask = 0770 stuart@Minty-Server ~ $ net usershare info --long [Fileshares] path=/home/stuart/Fileshares comment= usershare_acl=Everyone:F, guest_ok=y stuart@Minty-Server ~ $ Very intersting info about the passwords, does this mean that in my Samba users I need to have the same windows usernames and also their windows passwords ?
๐ŸŒ
Notes_Wiki
sbarjatiya.com โ€บ notes_wiki โ€บ index.php โ€บ Quick_samba_server_with_authentication_setup
Quick samba server with authentication setup - Notes_Wiki
Linux or MAC clients can easily change passwords as described earlier using 'smbpasswd -r <samba-server> -U <samba-user>'. However for Windows clients there is no easy way to change samba password.
๐ŸŒ
TechRepublic
techrepublic.com โ€บ home โ€บ networking
How to add and enable users for Samba share - TechRepublic
November 7, 2022 - Open up a terminal window on your Samba server (or just log in, if itโ€™s a headless machine) and issue the following command sudo smbpasswd -a USER (where USER is the username to be added).
๐ŸŒ
Beta42
beta42.dev โ€บ blog โ€บ adding-users-to-samba-server
Beta 42 | Adding Users to Samba Server
November 10, 2020 - Windows does not allow multiple user authentications to a single host. Alternatively, to share a directory with a group of users, you can use group sharing. Use the following line to share a directory with a group of users: path=/var/samba/shares/group-share valid users = @groupname
Top answer
1 of 1
10

As for this specific error message:

Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.

The problem here is that when a user on Windows first makes contact with a server it automatically passes that users' local login username. If you have a public share it remembers that it took that username successfully. When you try to connect to a private share and don't pass the exact same username and password, it thinks you are trying to access with another name.

Some workarounds:

1) Map the Windows user to the local Linux user - this is useful for Win10 users who log into their systems with a Microsoft account.

  • Create a file at /etc/samba/smbusers

  • Map the local Linux user to the Windows user by adding the conversion to the file. For example:

luci = [email protected]
john = "John Smith"
  • Then add a reference to the map in /etc/samba/smb.conf in the [global] section:
username map = /etc/samba/smbusers
  • Finally restart smbd: sudo service smbd restart

2) Make another connection to the Linux server

Windows can address a Linux server in two (three in Win10) different ways. By hostname, by ip address, or by mDNS name (Win10 only):

\\ubuntu\Protected
\\192.168.0.100\Protected
\\ubuntu.local\Protected

Even though all of these point to the same machine, Windows sees them a three separate hosts.

3) Map the "network drive"

When mapping a drive, select the "connect using different credentials" option.