Alternative for sudo

Alternative for sudo

Mir ist bewusst, dass wir mit einem Befehl einen Befehl/ein Skript als Super-/anderer Benutzer ausführen können sudo. Aber besteht die Möglichkeit, dass das sudoDienstprogramm selbst vom Benutzer nicht verfügbar/entfernt ist? Wenn ja, was könnte die Alternative zu sein sudo? suUnd was kann es tun sudound sudenselben Zweck erfüllen?

Antwort1

Mit „sudo“ können Sie jedes Programm als beliebiger Benutzer starten. Es ist „setuid root“, da das Programm selbst hierfür Root-Berechtigungen benötigt. Die Stärke von sudo besteht darin, dass Sie einfach konfigurieren können, wer was tun darf. Sie können einem Benutzer erlauben, nmap (und nur nmap) mit sudo auszuführen.

Mit „su“ können Sie eine Shell als beliebiger Benutzer starten. Wenn Sie eine Shell starten, können Sie natürlich auch jedes andere Programm starten. Es ist daher gefährlicher; auf gut verwalteten Systemen suist der Zugriff im Allgemeinen deaktiviert, sudokann aber für bestimmte Programme verfügbar sein.

Der Grund, warum die beiden oben genannten Programme verwendet werden, ist die Verantwortlichkeit. Sudo protokolliert alle gestellten Anfragen. Daher ist es für einen Administrator sehr einfach, nachzuverfolgen, was ein Benutzer mit Root-Rechten getan hat. Wenn Sie Zugriff auf eine Shell gewähren, kann ein Benutzer tun, was er will (es ist ein „schwarzes Loch“). (Natürlich verhindert die erweiterte Protokollierung auf Kernel-Ebene dies.

Natürlich können diese Programme auch markiert werden setuid. Dadurch werden die Berechtigungen des Besitzers der Binärdatei bei der Ausführung geändert. Wenn Sie es schaffen, das setuidBit bei eg zu aktivieren /bin/bashund den Besitzer von /bin/bashauf zu setzen root, sind Sie bei jeder Ausführung root /bin/bash.

Lastly, physical access to the machine will allow you to do whatever you like. You can boot from a flash drive and access the local filesystem. You could even configure your bootloader to use a different init process which immediately launches a shell in single-user mode (without asking for a password).

Antwort2

It seems that no one has answered the question of whether or not there exist alternatives to sudo besides su, so you might be interested to know that the sudo website actually maintains a list of sudo alternatives:

http://www.sudo.ws/other.html

The list includes both open-source and commercial software. Here are the open-source sudo alternatives listed at the moment:

That said I've never used any of these alternatives, nor have I ever seen or heard of them in any other context. It also seems like at least some of these are experimental, defunct or otherwise unsupported. The impression I get is that sudo and su are the only real game in town.

Antwort3

Log in as root (if allowed on your tty) or reboot the computer and log in with init=/bin/bash on the command line to restore the required functionality.

I point out that only root can remove sudo.

sudo and su serve similar but different purposes. "sudo" allows you to do something with someone elses permissions while "su" allows you to "become" that user and lets you behave like them.

Antwort4

If the machine has openssh-server installed, then an alternative to sudo might be:

ssh root@localhost ..command.. ..goes.. ..here..

If it hasn't been disabled then there is su as you mentioned:

su - root -c "..command.. ..goes.. ..here.."

verwandte Informationen