Setting up lan share on ubuntu 16.04 permission denied

I have a home lan where I just want to set up a share for anyone to use without passwords. BUT

getting access denied from both a ubuntu mate 16.04 machine and a windoze 7 machine on the same lan. I can see the shared folder on a machine called DENT from both the machines AND I can browse to it BUT when I try to create a file in the folder /home/dave/camera I get
"error while creating new file
smb://dent/memories/.
permission denied

What am I doing wrong please? Here’s what I have done so far.

SO I have set up a share in samba
sudo apt install samba

edited /etc/samba/smb.conf as below

workgroup = workgroup
security = user
[memories]
comment = Ubuntu File Server Share
path = /home/dave/camera
browsable = yes
guest ok = yes
read only = no
create mask = 0755

CREATED the folder

sudo mkdir -p /srv/samba/share
sudo chown nobody:nogroup /srv/samba/share/

RESTARTED samba
sudo systemctl restart smbd.service nmbd.service

I am going to tell you something I always do as a matter of course when I set up a share in samba. I don’t know how it works, but it seems to get rid of permission problems for me. It may represent some other kind of security breach which , for others with more security-based needs, may not a be a good idea. But, it works for me and, as I said, I always use it. You may also wish to try it out:

Open Caja and navigate to “etc/samba”

Inside there is a file called “smb.conf”. Before you do anything else, right-click it and select “properties” and select the “opens with” tab. Inside there, ensure Pluma is the default program to open a file of this type with. Then close the properties dialog box.

Now, right click the file and select “open as administrator”. The file will now open in Pluma with full editing-rights.

Scroll down to the bottom of the file and you should see your recently added Samba entry. When you find it, add the following line to the bottom of the entry

force user = username

Where “username” is your actual username.

So, for example, mine would read as:

force user = stephen

See below for an example Samba entry with this additional line:

[stephen]
    path = /home/stephen
    writeable = yes
;    browseable = yes
    guest ok = yes
    force user = stephen

When you are done, save and close “smb.conf”.

Then restart samba.

Now try and access the share again and see if your original problem persists.

1 Like

Hey Stephen

I am trying to get to grips with nano so I use that to edit the file BUT thanks for the heads up on the open with application.
The select file RMC click didn’t give me the option to open as administrator ( nb I am using 16.04 lts)
I added the line
force user = dave

and it STILL failed. THIS Is fracking amazing as I tried to x2go to the machine as user dave and I STILL can’t create a file in the darn thing!!! Gotta say windoze is looking pretty good to me :slight_smile:
thanks for the attempt though really nice of you.

ALSO here is the result of the ls -l

drwxr~xr~x 2 nobody nogroup 4096 jan 13 17:01 camera

What am I doing wrong!!

Hi @theakson,

I don’t have a clue about Samba but you can take a look at the links below which may help:

hey @wolfman

GREAT to hear from you again and thanks for the links. Still nothing, in fact at one point I changed all my /home/user permissions to all the wrong things :frowning:

So no luck at all and I followed the instructions to the letter. This has to be me so I will ask the question a different way if that’s ok.

“all I want to do is share up a single folder on a machine called DENT on a single lan network. the fact that they can see DENT makes a user valid. users should have all access rights to the folder.”

how does everyone else do this on a vanilla ubuntu mate 16.04 lts??? I MUST be missing something here.

1 Like

Okay, this is precisely what i do:

Install Ubuntu Mate OS

Install system-config-samba

Open system-config-samba and add a location:

Then I open "etc/samba/smb.conf and add the following to the bottom of the newly created network location entry:

force user = stephen

Then restart samba and/or log out and back in.

When anyone first tries to access the share it gives a choice of how they want to connect. I always choose to connect as a "user" and choose "stephen" and enter my password. It never asks this again as it puts that password in something called the "keyring" I think.

If using your own user-name and password is an issue because you expect lots of different people to want to access this share, then I am guessing you could add them as a user to your host system and then this would allow them to access the share with their own user-name and password. Again, it would only require this the first time. You may need to add a "force user" line for every user you expect to access the share. But, I am guessing here.

I don't know if what I am doing is "right". But, it works.

1 Like

Hey @stevecook172001

first of all thank you so much for taking the time to TRY to help me out, I will not waste any more of it. I could not get this to work at all and have decided to give in. It’s just not worth the hassle when I can get this done in windoze with a couple of clicks. I remember in prior versions of ubuntu that much of this was easy but seemingly not now. I am sure there are valid reasons for removing the adding of users via gui and installing samba as standard but to be honest I would have preferred to have the option to put them in at install time. ANYWAY, thanks so much to you and @wolfman it’s very rare that I give in on things like this but screw it :slight_smile: I’m going to still use ubuntu but not the fracking folder share stuff.

1 Like

Hi @theakson,

did you see this thread? (not sure if it would help?):

I have marked this as solved even though it isn’t, basically just to close it as you said you are giving it a miss now!. :smiley:

hey @wolfman
no I didn’t see that thread, thank you for finding it. I am of the camp that if I can’t get samba working then the sharing gods are against me :slight_smile: I thought the dark days of messing around with conf files for this were over. I can see the relevance if the deployment is a production environment that has to be locked down, in my case all I want to so is have one ubunutu 16.04 mate box share a folder on another ubuntu 16.04 mate box on the same lan. I have followed the instructions that you and the great @stevecook172001 gave me to the letter. @stevecook172001 couldn’t have made it more clear and yet it STILL doesn’t work. Thanks again and I agree with the closure of the thread as I am SURE that it is solved for all the rest of the group and contains excellent information. thanks to all for a great effort.

2 Likes

Hey there
I decided to have one more go round on this as I don’t like having something like this out there. So I used this in my smb.conf file

workgroup = workgroup
security = user
[memories]
comment = our camera stuff
path /home/dave/camera
browsable = yes
guest ok = yes
read only = no
create mask = 0777
directory mask = 0777

Which results in the following

drwxrwxr-x 2 dave dave 4096 jan 15 07:27 camera

so ON the machine I can create a folder or a file and save it BUT on the windoze machine I cannot. NOR am I asked for a login at all?? all I get is permission denied. I thought the 0777 and guest ok allowed pretty much everything. I can see the folder fine from the windoze machine AND can EDIT an existing file created on the machine BUT cannot create a file or a directory.

Hi @theakson,

I unmarked the solved thingy as you seem to want to continue!. :smiley:

I hope @stevecook172001 can help you further!. :smiley:

hey @wolfman
thanks I really don’t like leaving these things hanging. I have followed @stevecook172001 instructions to the letter so I am sure this is something MY side and right now I don’t see it. the 0777 should give everyone access to the folder to do everything but it isn’t working on either a ubuntu machine or a windoze machine on the same lan. It’s very strange and obviously something I am missing. I will keep at it

ok so I gave in an cheated. I went into terminal and sudo chmod -R 777 /home/dave/camera and all is well. This did NOT address why the create mask = 0777 and directory mask = 0777 didn’t do the same thing BUT that’s a tale for another day. Thanks to you @wolfman and @stevecook172001 I can now go into Martin luther king day secure in the knowledge that I have bodged another job :slight_smile:
thanks again to you both

2 Likes

Hey, there! Perhaps this video from Jay LaCroix might help you with setting up your Samba sharing: https://www.youtube.com/watch?v=1JVLZBcwAz8.

He’s written quite a few Linux books which I have. Very knowledgeable guy.

1 Like

WOW this is GREAT I like the way he takes a minimalist approach. Thanks so much @qaztacos really helped me out. I got this darn thing kludged and it’s working but I am not a happy bunny as I would like to know what I did wrong. I’m going to watch all Jay’s videos and do a complete install properly. thanks again

2 Likes

From what i have read system-config-samba has not been updated in quite awhile and allowing access to everyone breaks the new versions of samba as the devs desided to focus on security issues in samba and think everyone who uses samba is on a network server and not a home computer. Adding the force user Steve posted may be the way to go to browse without a password.I setup the same users on all my computers so i haven’t ran into that problem.I add a user to samba with the sudo smbpasswd -a username with the username being the user on the linux box which would be dave on your linux machine.

hi @straycat_tim

does this mean this isn’t my fault :slight_smile: thanks for the info on system-config-samba, I will check that out. Thanks again for taking the time
theakson

I have just followed the Jay LaCroix Samba video and can confirm it works perfectly.

No more system-config-samba for me…:slight_smile:

2 Likes

Hey @stevecook172001
your instructions were EXCELLENT just what I needed to get into this. Thanks for taking the time glad @straycat_tim post helped you and I will try on the next go round. I’m going to watch all LaCroix’s vids so I won’t bother you good people with the silly stuff :slight_smile:

2 Likes

No such thing as a “silly question” on here Theakson…:slight_smile:

More than happy to help.

1 Like