←back to thread

466 points CoolCold | 1 comments | | HN request time: 0.214s | source
Show context
ccorcos ◴[] No.40220178[source]
Can someone explain what this is / how it works to someone who has done a considerable amount of programming but lacks this kind of operating system level knowledge?

I was under the impression that ‘sudo’ was baked into the entire system. Like ‘cd’ or ‘ps’. How exactly can you just swap out sudo? Does that involve swapping out chmod as well?

replies(8): >>40220205 #>>40220206 #>>40220219 #>>40220224 #>>40220238 #>>40220277 #>>40220342 #>>40222121 #
1. stouset ◴[] No.40220277[source]
> I was under the impression that ‘sudo’ was baked into the entire system. Like ‘cd’ or ‘ps’.

Neither of these are “baked into the entire system” for any meaningful sense of the word. `cd` is just a shell builtin and is casually reimplemented in every single shell. It’s just environment state within your session. `ps` is just a binary that (on Linux) parses stuff in /proc.

None of it is magic. Neither is sudo. It’s just a binary like any other (though in sudo’s case, it’s setups, which is how it can cross the permissions boundary).