command line – Visual studio code cannot edit files on samba shared folder

I got some problems with my samba service, when i mount shared folder from command line on ubuntu using this:

sudo mount -t cifs -o user=$USER,uid=ubuntu-user,gid=ubuntu-user //ip-address/samba-folder /target

The folder mount ad i can read and write almost everything but files with only extension i cannot (ex. “.env”).

enter image description here

I can edit the first file but the others that are only ” .* ” i receive this error:

Failed to save ‘.env’: Command failed: cd “/home/tommaso”; “/usr/bin/pkexec” –disable-internal-agent /bin/bash -c “echo SUDOPROMPT; “/usr/share/code/bin/code” –file-write “/home/tommaso/.config/Code/code-elevated-WX8vT7b1” “/home/tommaso/Dietpi/home-server/cloudflare/.env”” Error using –file-write: EACCES: permission denied, open ‘/home/tommaso/Dietpi/home-server/cloudflare/.env’

In the other hand, if i mount the folder from ubuntu ‘Server connection’ as below

enter image description here

the mount allow me to edit every kind of file also the .* file, so i think that is related with something like permissions or mount cli command.

P.S. I cannot exec chmod on mounted folder and the files insdie the mounted folder are already owned by ubuntu user (also the group).

Ubuntu 23.04

Read more here: Source link