[Gambas-user] How to authenticate and switch to root user fromwithin gambas application?

Jose J. Rodriguez joe1962 at ...626...
Wed Oct 4 15:42:46 CEST 2006


On 10/4/06, Timothy Marshal-Nichols
<timothy.marshal-nichols at ...247...> wrote:
>
> Hello
>
> Not sure how you can switch to being root user when the application is
> running.

I need to check the source code of "su" I guess, see how it pulls off
this bit of magic.

> But you could test if the current user is root and provide a
> warning message and also disable option only available to root:
>
>         ' root user always has an Id of 0
>         IF User.Id = 0 THEN
>                 ' Disable options that can only be run by root
>                 Message.Info("Not root user - you would have a better
> message")
>         END IF
>

That's mostly what I do, except I check for username "root". Is it
safer to check for id = 0 because the name of root can be changed? I
never thought of that.

> In KDE you can create desktop shortcuts and menu items that will run an
> application as root and prompt for the root password.
>

Unfortunately, that's a KDE-specific .desktop file setting. It doesn't
work in XFCE.

Regards,
Joe1962




More information about the User mailing list