0

I want to edit some files using Visual Studio Code. The files are saved on RaspberyPi, the shared folder of which is mounted in fstab on my Ubuntu 18.04.

Configuration smb.conf on RPi`

 [openHAB-conf]
  comment=openHAB2 site configuration
  path=/etc/openhab2
  writeable=yes
  public=yes
  create mask=0777
  directory mask=0777
  veto files = /Thumbs.db/.DS_Store/._.DS_Store/.apdisk/._*/
  delete veto files = yes

fstab configuration (on Ubuntu)

fstab:
//192.168.1.130/openHAB-conf /home/t/OH2/etc cifs defaults,username=XXX,password=XXX,file_mode=0777,dir_mode=0777,noperm    0 0

Result of /home/t/OH2/ ls -l :

drwxrwxrwx  2 t    root    0 kwi 21 13:55 etc

I can't change group owner using chgrp, it doesn't work, but I can change file/folder onwer.

Finally - I may open files on VCode but I can't write any changes. There's always a message (and authorising as a root in a popup window doesn't work neither):

Failed to save 't.items': Insufficient permissions. Select 'Retry as Sudo' to retry as superuser.

If I use sudo code --user-data-dir="/home/t/OH2/etc" there's no any problem. But according to explanantion Why is it bad to log in as root? that it is not advisable.

Any advice?

1 Answers1

0

I think the only problem is that you're missing the "user" option in your fstab file - just add it to the comma-separated list of options you already have.

Is there any reason you have to use Samba for the RasPi share (e.g., maybe you need it for access via Windows)? If not, the simplest solution might be either using sshfs, a command to create a mount over ssh - type this in a command shell:

sshfs 192.168.1.130:/openHAB-conf /home/t/OH2/etc

...or mounting via nfs in your fstab file which looks like this:

192.168.1.130:/openHAB-conf /home/t/OH2/etc nfs noauto,user 0 0
Eric Mintz
  • 2,516
  • 12
  • 24
  • I use username=XXX,password=XXX in my fstab file. – twlodar May 01 '19 at 10:28
  • There's no particular reason to use samba. In fact I didn't know sshfs. I mounted using sshfs in command shell but it not worked. I think the problem is in RPi with owner of the openhab2 catalogue. drwxrwxr-x+ 13 openhab openhabian 4096 Apr 21 13:55 openhab2. (I tried to mount over sshfs as an openhabian user) – twlodar May 01 '19 at 10:40
  • I solved the issue by adding user and password in smb.conf on RPi. Now I can open any file in Visual Studio Code from shared RPi directories. – twlodar May 06 '19 at 20:41