@electroman No problem. Hope it helps.
Hi, great article. Was hoping someone ran into the same issue i have and could give me some pointers.
i setup the samba share on Ubuntu20.04 following the instructions above. i am running ubuntu as a virtual desktop in Virtualbox and using Windows 10 to try to connect to the samba share i created on the Ubuntu file system. both shares work and i can see them in windows 10 file explorer and drop files into each share. Ubuntu can see them when i login to ubuntu and i can open them and mange (delete/edit,etc.). but when i copy a file within Ubuntu to the samba shares, and then go over to windows 10 and open the share i cannot open them or delete them or do anything with them from windows. the files are locked and have an “x” in the icon. it seems like some sort of file permissions issue. Even when i do sudo chmod 777 on all the files in ubuntu, no go. still can’t do anything with them in Windows.
also i cannot map the drives in windows with my credentials for the user i login with to Ubuntu (i use the same user id and password for the Ubuntu shared folder). when i try to map the drive windows i get an error the the network share is already mapped and i need to disconnect it. its not though.
any help would be much appreciated
Hi Bgillette,
Welcome to our forums.
About your first issue: please post us the stats of an example file you placed on the share from the Linux box, so we can get a hold on your situation. Something like:
$ stat example.file
We’ll need the output of this command.
I’ve been trying to share a folder with permissions and haven’t had luck.
in the smb.conf file I’ve tried this
[mysharedfolder]
path = /mnt/disk3
writable= Yes
create mask = 0777
direectory mask = 0777
public = No
valid users = username
write list = username
guest ok = no
available = yes
browseable = yes
printable = no
locking = yes
strict locking = no
and trying to access to the folder from windows asks me for credentials and won’t access, I’ve already changed the password with this:
sudo smbpasswd -a username
if I change this line to yes would work without a problem but I want some security:
public = Yes
in the credentials for windows I’ve used the following as user name:
ubuntuserver\username
username
none of them work
by the way, username is the user name im using in ubuntu.
can anybody see what I’m doing wrong
-
guest ok
andpublic
are synonyms. Hence,guest ok = no
meanspublic = no
, andguest ok = yes
meanspublic = yes
. In a nutshell: you’re supposed to use only one of these two parameters (e.g.guest ok = no
), i.e. either useguest ok
orpublic
– not both. -
Even though
writable
is supposed to work, I’d replacewritable= Yes
withwriteable = yes
just in case (the spaces are also important). -
On your Linux system:
- Open your file manager (e.g. Thunar, Nautilus etc.) and then
- Open the following location (which happens to be the location of your Linux Samba server’s shared folder):
smb://localhost/mysharedfolder/
- Then provide the
username
username and its password. - If your file manager asks for a domain/group, provide the one that you pre-configured in the
[global]
section of yoursmb.conf
file, e.g. if you setworkgroup = ubuntuserver
then typeubuntuserver
(if you didn’t configure theworkgroup
, do it before proceeding). Also take a look at the sample contents of ansmb.conf
file that I provided above.
-
If you edit the
smb.conf
file, then after saving the changes don’t forget to restart the Samba server so these changes take effect:sudo service smbd restart
-
If you succeed with your (client) Linux connection to your own (server) Linux Samba share, then the problem may be somewhere in your Windows configuration.
-
Yet, if you still can’t succeed with a Windows connection attempt, then it’s also likely that there’s some misconfiguration within your
username
user data on Linux. In such case:- If
username
is NOT your Linux user account, then delete it withsudo userdel -r username
and then add it again withsudo useradd -M -N -g sambashare username
(Linux is case-sensitive: do not use capital letters where it’s not capitalized – and vice-versa). - If
username
IS your Linux user account, then add it to thesambashare
group withsudo usermod -a -G sambashare username
.
- If
-
If you either execute
userdel
,useradd
orusermod
, then don’t forget to restart the Samba server afterwards, so these changes take effect:sudo service smbd restart
what you suggested here smb://localhost/mysharedfolder/ worked perfectly on linux, I also tried in a virtual machine with macOS and I was also able to access to the folder
and windows worked after I applied this line you suggested:
sudo usermod -a -G sambashare username
Thank you so much.