Glam Prestige Journal

Bright entertainment trends with youth appeal.

Context (irrelevant):

I was looking around the net and stack for this particular issue but couldn't find an answer. Some answers even suggested enabling guest_ok which is in my honest opinion a massive security flaw, even in a home network, although I could be wrong, the chances tend to the latter :)

1. Situation

I had a pi(hole) 3 laying around and wanted to enable a common place for all my everyday files. Files that I read & edit on a regular basis like code, scripts or even simple notes / txt.

I followed a guide with my linux knowledge and ended up with a functional samba share on the pi's inserted usb stick, accessible from everywhere in my LAN.

2. Problem

The problem is that applications like sublime or codeblocks are unable to create files. I can still move files in and out with the regular file explorer/thunar though editing existing files in sublime works but I have to enter the password every. single. time. (so if you press Ctlr+S 20x, that's 20 times entering the same password). Starting applications with sudo results in "Save as" being unable to display the samba share though this was more of an experiment since you wouldn't run Sublime etc... as root on a regular user anyway.

3. Samba smb config:

[NetworkDrive]
path = /network
browseable = yes
writeable = yes
valid users = pi
public = no
guest ok = no
read only = no
create mask = 0777
directory mask = 0777

EDIT: Even setting guest and public to yes, results in the beforementioned no permission error in sublime etc...

As you can see, I login with the pi user's cred, which seems to work fine, on other platforms since I don't wish to create another extra user and the hassle of permissions etc..., if the pi user exists and somewhat works, why not.

4. Conclusion

How can I make it so that applications such as text editors and IDEs have the permission to create, edit and read on the Share just like the explorer? Also the request for password for each Cntrl+S has to stop as well :(

3

2 Answers

EDIT: Even setting guest and public to yes, results in the beforementioned no permission error in sublime etc...

If you haven't already, make sure to run sudo service smbd restart when you are finished with any changes.
ANYWAY,

You should try out force user = pi in your CONFIG file. This should require no authentication on your end when saving files if I recall correctly. As for security flaws, as long as nobody has the server's local IP address (since I don't think you'll be port forwarding SAMBA), you should be fine. public = no handles this pretty well.

Well, ignore this now.

I installed Samba, and the main cause for "Permission denied" errors was because the shared folder was not owned by the logged-in user trying to edit it. sudo chown pi /network in your case should work. Reload the service with sudo service smbd restart, and things should work.

Authenticating all saves to your Raspberry Pi should be fixed with this too.

6

For future readers, I append the solution to the problem. Sadly this has no decisive solution. I can simply give you the config and tell you what I did which solved my issue:

[Nameofyourshare]
path = /path/to/your/share
browseable = yes
writeable = yes
force user = pi
public = no

<---Removed guest ok and the default seems to be yes I dont know.

read only = no
create mask = 0777
directory mask = 0777

I believe the real solution to my specific case is to set the vers in the cifs mount command specifically to 1.0, which weirdly enough fixed connection/access/Permission denied errors on my Phone (test, 1.0 worked, 2.0 even if forced in smb conf didnt work).

Though the unmount could also have fixed this issue. I dont know. If you have the same issue, here's what I would tell you, test if your phone can connect with either SMB protocol v1 or v2. If only v1 works without authentication or connection/permission issues then use the command: sudo mount -t cifs -o vers=1.0,username=pi // /mnt/ <--- The 'x' represent the ip of the share/device, username the one from force user from .conf and /mnt where to be mounted.

As for @Nirbodha, I thank you for helping and would've upvoted your reply if I had >= 15 rep. Sadly I can't pick your reply as the definitive solution, though it's part of the solution. I truely think the protocol version (&remounting maybe) was the issue.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy