Domanda

Sto cercando di scrivere uno script di shell per montare il dispositivo Loop e sto assegnando questo script con un bit adesivo da eseguire come UID (root). (Questo è per altri utenti su server) il problema è che non possoSembra di eseguire il comando "Mount" senza usare sudo davanti ad esso.Quando sono in account root, posso eseguire il comando 'Mount' senza alcun problema, quindi ho pensato di impostare lo script con rws-r_x-r_x lo farebbe.

Sono fraintendendo il concetto di usare un bit appiccicoso?o c'è qualche altro modo?

Il server è in esecuzione sotto Ubuntu 10.04

È stato utile?

Soluzione

You mean the setuid bit, not the sticky one. The kernel doesn't honor the setuid bit on scripts. See this post for a thorough description, here's a summary: the gist is that suid on a script is insecure.* The kernel starts reading the script to execute it, but it sees the #!/path/to/interpreter and figures out that it needs to be interpreted. It then cancels "executing" the script directly and calls the specified interpreter, passing the script name as the first argument (and all subsequent arguments in order after that). The reason setting UID is insecure in this instance is that an attacker could potentially change the script to be executed between the kernel setting the new UID and the interpreter reading the file.

*: The other post mentioned that perl handles its scripts in such a way that they can be suid.


As for the actual mounting problem at hand, add a line to /etc/fstab/ and include the user option.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top