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

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



Le 26/02/2014 16:07, Emilien Klein a écrit :
> Hi Mentors,
> 
> TLDR: in order to execute a command as another user, should `sudo` or
> `su --command` be used?
> 
> 
> I'd like to get your opinion on how to best solve this issue:
> I've got a package [0] that uses dbconfig-common to manage its
> database. The database is owned by a specific user (not root).

Hi Emilien,

I think you should use su. I am almost certain that sudo can be
configured in such a way that would break your assumptions, whereas su
can simply not be configured.

Besides, as you noted yourself, using sudo would imply a completely
unnecessary new dependency.

su is the right using tool for assuming another personality and dropping
privileges from root.

Kind regards, Thibaut.


Reply to: