Using sudo from within a snap

Simon Fels simon.fels at canonical.com
Mon Aug 8 07:36:42 UTC 2016


On 06.08.2016 15:54, Chris Wayne wrote:
> Hi guys,
> 
> I seem to be having some issues while running anything as sudo from within a 
> snap (namely bug https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1610292).  

If you package sudo within your snap snapcraft will strip the necessary
suid bit from it so it wont work anymore. Only way to use sudo is to use
the one from the core snap.

> Is this something that's expected to work, or is this out of scope (it does work 
> if you run the snap itself with sudo, although then it's a bit annoying as 
> you're hit with https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1595558).

We should fix this so that a sudo <snap-binary> works rather than
putting sudo in a snap or use it from there. You could also check in
your binary if its started as root and if not abort.

regards,
Simon





More information about the Snapcraft mailing list