Giancarlo Metitieri
Giancarlo Metitieri

Reputation: 135

Unable to create / edit files as non-root through Samba mount

I'm trying to setup a code-server (vscode in browser) instance and read/write from a mounted samba share. Unfortunately when I try to add a file it gives me an error that I do not have permissions to read/write to that folder. When I try to add files with the same credentials on Windows it does work though. This is the error that VSCode gives me:

Unable to write file 'vscode-remote://localhost:8080/home/user/repository/test' (NoPermissions (FileSystemError): Error: EACCES: permission denied, open '/home/gmetitieri/user/test')

If I sudo touch file.txt then the file will be created and added. I already used chmod and added full access to the folder but it still won't work. Is this a credentials thing or am I missing something?

I already tried this answer but it still doesn't let me write as non-root

Edit: This is the command I used to mount the drive (just with different folder names and IP address):

sudo mount -t cifs -o rw,vers=3.0,credentials=/root/.examplecredentials //192.168.18.112/sharedDir /media/share

Upvotes: 1

Views: 2443

Answers (2)

Artur Sá Menezes
Artur Sá Menezes

Reputation: 11

Considering "non-root through Samba", especially in new releases of OpenSuse (...15.3 -- 15.4), I do few movements into normal configuration panels (no sudo commands or anything technical).

Using Yast Firewall section -- For now (immediate solution):
I turn off the firewall, then see what you can turn on (after this) to keep the samba working with Microsoft Windows.

More details on how to do this with images on my website.

Upvotes: 1

James Risner
James Risner

Reputation: 6074

This happens when the directory on the Samba share does not have permission for non-root users.

In your smb4.conf file:

[test]
        comment = Test share
        path = /path/to/directory
        force user = unixuser
        valid users = sambauser

In this example, unixuser should be the owner of the files in /path/to/directory. The user logged into Samba in this example is a user called sambauser.

Upvotes: 0

Related Questions