Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

spawning a root shell as user

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
7 posts • Page 1 of 1
Author
Message
irondog
l33t
l33t
User avatar
Posts: 715
Joined: Mon Jul 07, 2003 1:41 pm
Location: Voor mijn TV. Achter mijn pc.

spawning a root shell as user

  • Quote

Post by irondog » Wed Jun 02, 2004 8:02 pm

I'm trying to give a normal user the power of of a root-shell.

I thought: "lets copy /bin/bash to ~ and give it the same permissions as /usr/bin/passwd" (as this executable makes me able to change /etc/passwd without being root :), so it must work)
So, people running the binary temporary obtain root privilleges, but it's not like that....

What is the mistake I make in this (mind / thinking) process?
Please don't ask me why I should want this, I'm just paranoid a sys-admin will update to a kernel without p-trace bug.
Alle dingen moeten onzin zijn.
Top
spb
Retired Dev
Retired Dev
User avatar
Posts: 2135
Joined: Fri Jan 02, 2004 1:18 pm
Location: Cambridge, UK

  • Quote

Post by spb » Wed Jun 02, 2004 8:13 pm

Not sure I ought to be helping you with this, but I will say this much: read 'man bash'. Everything you need to know is in there.
Top
searcher
Apprentice
Apprentice
User avatar
Posts: 175
Joined: Thu Mar 13, 2003 9:55 pm
Location: NL

Re: spawning a root shell as user

  • Quote

Post by searcher » Wed Jun 02, 2004 8:35 pm

irondog wrote:Please don't ask me why I should want this, I'm just paranoid a sys-admin will update to a kernel without p-trace bug.
Sounds to me like you have no business getting root on that box, and that sys-admin probably should keep up to date. If you feel you have a legitimate need for root acces to a box, call the sysadmin and get him to setup sudo for you.

~searcher
You are unique ... just like everyone else.
Top
ecatmur
Advocate
Advocate
User avatar
Posts: 3595
Joined: Mon Oct 20, 2003 8:07 pm
Location: Edinburgh
Contact:
Contact ecatmur
Website

  • Quote

Post by ecatmur » Wed Jun 02, 2004 8:40 pm

I'm pretty sure bash refuses to be run as a suid binary. If you really want to be able to suid to a shell you'll need to write a suid wrapper around system() (in C, natch).
No more cruft
dep: Revdeps that work
Using command-line ACCEPT_KEYWORDS?
Top
irondog
l33t
l33t
User avatar
Posts: 715
Joined: Mon Jul 07, 2003 1:41 pm
Location: Voor mijn TV. Achter mijn pc.

  • Quote

Post by irondog » Wed Jun 02, 2004 8:44 pm

I think you are right. That's the problem. The idea is good (it worked with /bin/touch), but bash refuses it :)
Alle dingen moeten onzin zijn.
Top
spb
Retired Dev
Retired Dev
User avatar
Posts: 2135
Joined: Fri Jan 02, 2004 1:18 pm
Location: Cambridge, UK

  • Quote

Post by spb » Wed Jun 02, 2004 8:56 pm

ecatmur wrote:I'm pretty sure bash refuses to be run as a suid binary. If you really want to be able to suid to a shell you'll need to write a suid wrapper around system() (in C, natch).
It can be made to run setuid. As I said, it's all in the man pages. By default if the effective UID is different to the real UID (i.e. it's a setuid binary), it doesn't load any environment, and sets euid to the real uid. But it can be made to do otherwise.
Top
irondog
l33t
l33t
User avatar
Posts: 715
Joined: Mon Jul 07, 2003 1:41 pm
Location: Voor mijn TV. Achter mijn pc.

  • Quote

Post by irondog » Wed Jun 02, 2004 8:59 pm

ecatmur wrote:I'm pretty sure bash refuses to be run as a suid binary. If you really want to be able to suid to a shell you'll need to write a suid wrapper around system() (in C, natch).
The system function seems to spawn its argument in /bin/sh, causes the same problem. Trivially I have to setuid(0); seteuid(0); setgid(0); first before executing it. :)
I see no way to do this when calling /bin/bash from a shell as UID, GID and EUID are readonly.
Alle dingen moeten onzin zijn.
Top
Post Reply

7 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic