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 › 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]:
🌐
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 ...
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!

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.
Find elsewhere
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.)

🌐
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
🌐
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.
🌐
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).
🌐
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?
🌐
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.
🌐
Red Hat
redhat.com › sysadmin › samba-windows-linux
Mounting and mapping shares between Windows and Linux with Samba
November 20, 2025 - Although there are multiple approaches to adding a new local user on a Windows machine, for the simplicity of this article I will be using PowerShell. Launch PowerShell as an administrator and issue following commands: PS > $password = Read-Host -AsSecureString PS > New-LocalUser -Name “user” -Password $password · Now that we have created a new local user account matching the Samba user account, we can log in to Windows with our newly created user account.
🌐
TechRepublic
techrepublic.com › home › networking
How to Use Samba File Sharing for Linux and Windows
November 6, 2025 - This process enables Linux users to access shared resources over the Samba network. ... ✅Expert tip: To access the shared folder, the user must be a member of the smbgroup. Add them with:
🌐
Red Hat
access.redhat.com › solutions › 39821
How to configure samba share such that Windows Users creating folders on Samba share would like the folders to be accessed (Read, write Permissions) to other users also - Red Hat Customer Portal
August 7, 2024 - Example: $setfacl -d -m g:"PNQ\domain users":rwx /abc · Can add -R to the above if you want the default permissions to be added to the existing files and folders that are already created in /abc · After doing the above configure smb.conf to inherit permissions and also inherit acls . Example: [global] workgroup = PNQ realm = GSSLAB.PNQ.REDHAT.COM server string = Samba Server Version %v security = ADS password server = 10.65.208.43 passdb backend = tdbsam log file = /var/log/samba/log.%m max log size = 50 idmap uid = 16777216-33554431 idmap gid = 16777216-33554431 template shell = /bin/bash i
🌐
SambaWiki
wiki.samba.org › index.php › Setting_up_Samba_as_a_Domain_Member
Setting up Samba as a Domain Member - SambaWiki
October 9, 2024 - If you do decide to add uidNumber & gidNumber attributes to AD, you do not need to use numbers in the 3000000 range and it would definitely be a good idea to use a different range. The 'rid' or 'autorid' idmap winbind backends calculate the user and group IDs from the Windows RID.