Friday, August 16, 2019

permissions - Utils installed using snap unable to write to .bashrc



Question : Is there any way we can allow snap utilities to write to .bashrc?



Below are the steps what I did or tried:



I installed vault using snap in Ubuntu:19.04



snap install vault



2019-05-26T09:46:49Z INFO Waiting for restart...
vault 1.1.1 from Snapcrafters installed



After successful installation I was trying to install vault autocomplete feature using



vault -autocomplete-install


Which is throwing error as below :




root@vault-server:~# vault -autocomplete-install


Error executing CLI: 1 error occurred:



*open /root/.bashrc: permission denied



But if I install vault by downloading binary, add soft-link in /usr/bin, and then try to install autocomplete it gets installed successfully and I can see an new entry in ~/.bashrc




complete -C /opt/softwares/vault vault


FYI : /opt/softwares is the /path/to/dir where I copied my downloaded binary.



Adding info for reference :
After installing vault using snap :



which vault



/snap/bin/vault



ls -lrt /snap/bin/


total 1
lrwxrwxrwx 1 root root 13 May 26 09:47 vault -> /usr/bin/snap



ls -lrt /usr/bin/ | grep snap



lrwxrwxrwx 1 root root ubuntu-core-launcher -> ../lib/snapd/snap-confine



-rwxr-xr-x 1 root root snapfuse



lrwxrwxrwx 1 root root snapctl -> ../lib/snapd/snapctl



-rwxr-xr-x 1 root root snap




ls -lrt /usr/bin/ | grep vault


Nothing



Too long to comment.



Maybe, the confinements, specifically classic confinement is the thing you need. From https://docs.snapcraft.io/snap-confinement






  • Strict



    Used by the majority of snaps. Strictly confined snaps run in complete isolation, and consequently, can not access your files, network, processes or any other system resource without requesting specific access via an interface.


  • Classic



    Allows access to your system’s resources in much the same way traditional packages do. To safeguard against abuse, publishing a classic snap requires manual approval, and installation requires the --classic command line argument.


  • Devmode



    A special mode for snap creators and developers. A devmode snap runs as a strictly confined snap with full access to system resources, and produces debug output to identify unspecified interfaces. Installation requires the --devmode command line argument. Devmode snaps cannot be released to the stable channel, do not appear in search results, and do not automatically refresh.






So, you just need to reinstall your vault package under classic confinement:



sudo snap install vault --classic


Hope this helps.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...