FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 01-30-2010, 09:58 PM
Jon Dowland
 
Default 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
 
Old 01-30-2010, 11:14 PM
Josselin Mouette
 
Default correct/ideal way to obtain root from a shell script

Le samedi 30 janvier 2010 * 22:58 +0000, Jon Dowland a écrit :
> 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.

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
 
Old 01-31-2010, 05:42 PM
Jon Dowland
 
Default correct/ideal way to obtain root from a shell script

On Sun, Jan 31, 2010 at 01:14:35AM +0100, Josselin Mouette wrote:
> Le samedi 30 janvier 2010 * 22:58 +0000, Jon Dowland a écrit :
> > 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.
>
> Why do you need to run anything as root in a packaging tool?
>
> Aren’t you looking for fakeroot instead?

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?

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)


--
Jon Dowland
 
Old 01-31-2010, 08:27 PM
Daniel Baumann
 
Default correct/ideal way to obtain root from a shell script

Jon Dowland wrote:
> That sounds sensible. Is there anything I can do to help?

help persuading the blocking maintainers to do the right thing.

--
Address: Daniel Baumann, Burgunderstrasse 3, CH-4562 Biberist
Email: daniel.baumann@panthera-systems.net
Internet: http://people.panthera-systems.net/~daniel-baumann/


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 02-01-2010, 02:13 AM
Michael Gilbert
 
Default 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
 
Old 02-01-2010, 06:09 AM
Mike Hommey
 
Default correct/ideal way to obtain root from a shell script

On Sun, Jan 31, 2010 at 06:42:07PM +0000, Jon Dowland wrote:
> On Sun, Jan 31, 2010 at 01:14:35AM +0100, Josselin Mouette wrote:
> > Le samedi 30 janvier 2010 * 22:58 +0000, Jon Dowland a écrit :
> > > 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.
> >
> > Why do you need to run anything as root in a packaging tool?
> >
> > Aren’t you looking for fakeroot instead?
>
> gdp, by default, invokes dpkg to install the generated .deb
> file.

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
 
Old 02-01-2010, 06:37 PM
Bill Allombert
 
Default 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.
 
Old 02-02-2010, 08:20 AM
Fabian Greffrath
 
Default 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-Universitt Bochum
Lehrstuhl fr Energieanlagen und Energieprozesstechnik (LEAT)
Universittsstr. 150, IB 3/134
D-44780 Bochum

Telefon: +49 (0)234 / 32-26334
Fax: +49 (0)234 / 32-14227
E-Mail: greffrath@leat.ruhr-uni-bochum.de


--
To UNSUBSCRIBE, email to debian-devel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 02-10-2010, 10:32 AM
Jon Dowland
 
Default 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
 
Old 02-10-2010, 10:45 AM
Jon Dowland
 
Default 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.


--
Jon Dowland
 

Thread Tools




All times are GMT. The time now is 07:37 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org