2020-10-23 - sudo bash

yes – as a rule of thumb you should not make scripts SUID. same for bash and other shells. there are however times, you do know what you're doing and / or it is ok to hack a bit to make it work “here and now”.

fun fact – if you do

sudo chmod u+s /bin/bash
bash

you'll not have root. bash will detect that and drop privileges on its own.

there is however a workaround – if you're absolutely sure you know what you're doing, you can go for

bash -p

this will tell bash to ignore this safety feature and run shell SUID, as requested. so you can do this, but it has to be explicit. IMHO nice balance between staying secure by default and allowing to do crazy things, when needed.

blog/2020/10/23/2020-10-23_-_sudo_bash.txt · Last modified: 2021/06/15 20:09 (external edit)
Back to top
Valid CSS Driven by DokuWiki Recent changes RSS feed Valid XHTML 1.0