[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Maintainer scripts: execute command as another user: use sudo or su?



On Wed, Feb 26, 2014 at 04:07:35PM +0100, Emilien Klein wrote:
> In the pre- and postinst scripts, a command has to be performed as
> that user (e.g. make a backup of the database).
[…]
> I am wondering what the best way is to fix this. I see 2 solutions:
> 1. Depend on sudo
> 2. Use "su --command" instead

Beside what others already said:
As you said it is run in preinst scripts you would need to pre-depend on
sudo – and you would need to discuss this first on debian-devel@ as
strongly recommend by debian-policy (§3.5 and §7.2). The outcome of this
discussion would probably be that you should use su…

su on the other hand is 'free' to use as it is provided by the essential
login package, so no dependency is needed at all.


Best regards

David Kalnischkies

Attachment: signature.asc
Description: Digital signature


Reply to: