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

Re: setuid script



cesarino vinh <cesarinovinh77@gmail.com> wrote:
> I just wanted to run my browser with a different user, because it's
> safer :S

Safer than what...?


> How can I do that? I'm using wright now the "gksu" - and then run as user...
> so I can't make a shell script to do that, and I don't want to modify the
> browser's executable, and I'm not in programming, but the solution is to
> write an eg. C program to launch the browser, and then set SUID bit fot that
> C app?

Use sudo and a script that sets up the environment appropriately

    #!/bin/sh
    #
    # This script is safe ONLY if you can guarantee no other users are
    # running programs on this system
    ####################################################################
    #
    xhost +local:
    sudo -H -u otheruser DISPLAY="$DISPLAY" firefox "$@"

Then you add an entry in /etc/sudoers that allows you to sudo to the
user "otheruser" and run the firefox program (or whatever your preferred
browser is).

Chris


Reply to: