correct/ideal way to obtain root from a shell script
Hi folks,
I need to run a command as the superuser inside
game-data-packager (gdp). Up until now, I've been
hardcoding a sudo invocation and depending on sudo.
Someone has pointed out to me that depending on sudo does
not guarantee that it is configured properly. However,
hardcoding su is equally wrong, if the user has installed
Debian at priority medium and opted to not enable the root
account.
What I will probably have to do in the short-to-medium term
is adjust gdp to support both methods and do my best to try
to figure out what the correct one is for a given system.
However I was wondering, is there a better way to handle
this situation?
I found this old thread
"Proposal: su-to-root should be replaced with a system
managed by alternatives."
<http://lists.debian.org/debian-devel/2004/11/msg00728.html>
This doesn't look to have got anywhere, and alternatives
aren't the fix here anyway (I guess some su-or-sudo wrapper
implementing policy, a la sensible-browser might be)
Thanks folks,
--
Jon Dowland
01-30-2010, 11:14 PM
Josselin Mouette
correct/ideal way to obtain root from a shell script
Why do you need to run anything as root in a packaging tool?
Aren’t you looking for fakeroot instead?
> "Proposal: su-to-root should be replaced with a system
> managed by alternatives."
> <http://lists.debian.org/debian-devel/2004/11/msg00728.html>
>
> This doesn't look to have got anywhere, and alternatives
> aren't the fix here anyway (I guess some su-or-sudo wrapper
> implementing policy, a la sensible-browser might be)
I’ve been asking to move su-to-root to xdg-utils or debianutils, but the
situation is still stuck.
Cheers,
--
.'`. Josselin Mouette
: :' :
`. `' “I recommend you to learn English in hope that you in
`- future understand things” -- Jörg Schilling
01-31-2010, 05:42 PM
Jon Dowland
correct/ideal way to obtain root from a shell script
--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
02-01-2010, 02:13 AM
Michael Gilbert
correct/ideal way to obtain root from a shell script
On Sat, 30 Jan 2010 22:58:20 +0000 Jon Dowland wrote:
> Hi folks,
>
> I need to run a command as the superuser inside
> game-data-packager (gdp). Up until now, I've been
> hardcoding a sudo invocation and depending on sudo.
maybe packaging isn't the best solution to the underlying problem?
wouldn't it be much more straightforward (from a user's perspective) if
the game data files were automagically loaded into an appropriate
location in their home dir rather packaged and installed into the root
file system?
perhaps an additional utility could be provided (runnable with elevated
priviledge via user's method of choice) that packages the data from
their home dir and installs it to the root file system (that is if they
want it to be available for multiple users)?
anyway, just a thought.
mike
--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
02-01-2010, 06:09 AM
Mike Hommey
correct/ideal way to obtain root from a shell script
So what you are looking for is not a way to run something as root, but a
way to install a package as a user, which is different.
Something like apt-daemon is probably what you are looking for.
Mike
--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
02-01-2010, 06:37 PM
Bill Allombert
correct/ideal way to obtain root from a shell script
On Mon, Feb 01, 2010 at 07:30:23PM +0000, Jon Dowland wrote:
> gdp, by default, invokes dpkg to install the generated .deb
> file.
>
> > I’ve been asking to move su-to-root to xdg-utils or
> > debianutils, but the situation is still stuck.
>
> That sounds sensible. Is there anything I can do to help?
Simply depends on the menu package which provide su-to-root, or
manage to convince xdg-utils upstream to provide xdg-su instead of asking
everyone to switch to policykit ?
> It looks like there might need to be a bit more
> join-the-dots between su-to-root and d-i's "disable root"
> question (to prime $SU_TO_ROOT_SU properly)
We need a solution that still works if user enable root password and disable
sudo after installation. Shadow will note tell you whether root has a password
or not. Maybe menu should have a debconf question (do you use sudo ?) that will
be prefilled by d-i. Technical advices and patches welcome.
Cheers, (Please CC me if you want an answer).
--
Bill. <ballombe@debian.org>
Imagine a large red swirl here.
02-02-2010, 08:20 AM
Fabian Greffrath
correct/ideal way to obtain root from a shell script
Hi Bill,
We need a solution that still works if user enable root password and disable
sudo after installation. Shadow will note tell you whether root has a password
or not. Maybe menu should have a debconf question (do you use sudo ?) that will
be prefilled by d-i. Technical advices and patches welcome.
I know that's a rather pragmatic solution, but why don't you simply
drop the automatic installation of the package and display the user a
message like "Congratulations, a package has been created in your home
directory, please become root and install it." instead?
Cheers,
Fabian
--
Dipl.-Phys. Fabian Greffrath
Ruhr-Universität Bochum
Lehrstuhl für Energieanlagen und Energieprozesstechnik (LEAT)
Universitätsstr. 150, IB 3/134
D-44780 Bochum
--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
02-10-2010, 10:32 AM
Jon Dowland
correct/ideal way to obtain root from a shell script
On Mon, Feb 01, 2010 at 08:09:58AM +0100, Mike Hommey wrote:
> So what you are looking for is not a way to run something
> as root, but a way to install a package as a user, which
> is different.
In my specific case, yes.
> Something like apt-daemon is probably what you are looking
> for.
Thanks for the tip - I'll give it a look!
--
Jon Dowland
02-10-2010, 10:45 AM
Jon Dowland
correct/ideal way to obtain root from a shell script
On Mon, Feb 01, 2010 at 08:37:57PM +0100, Bill Allombert wrote:
> Simply depends on the menu package which provide su-to-root
We've determined that su-to-root in it's current state
doesn't handle the disabled-root case anyway, so this
wouldn't win me anything.