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

Viewed 27

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
1 Answers

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.

Related