4 ms·
TL;DR: the author doesn't know, and lists the standard possibilities: superuser, switch user, or subshell. From the article: "Well, I wish I had an answer, but
by tedchs 14y ago
TL;DR: the author doesn't know, and lists the standard possibilities: superuser, switch user, or subshell. From the article: "Well, I wish I had an answer, but I don’t."
- whatshisface 14y agoBetter TL;DR: The author points out that the meaning has changed over time from the initial meaning of "superuser" to "switch user", due to feature creep.
- deleted 14y ago[deleted]
- joshguthrie 14y agoFunny as it's the opposite of the UNIX philosophy: "Write programs that do one thing and do it well"...
- eurleif 14y agoIs switching to an arbitrary user really "more than one thing"? Would the UNIX philosophy be to have a separate switch program for every user on the system?
- beatgammit 14y agoI think `joshguthrie` means something along the lines of this: http://harmful.cat-v.org/cat-v/ http://harmful.cat-v.org/cat-v/ I think `su` is pretty good as-is, but sudo has a bit of feature creep. For example, I don't think these belong in sudo (taken from Linux): -e: edit something -l: list allowed/forbidden commands -p: change prompt Ideally, sudo would just run as root and su would just switch users. Then instead of: sudo -u some_user cmd You'd do this instead: sudo su -c "cmd" some_user Su only does one thing (switch users, -c for one-off cmd) and sudo only does one thing (change to root). Currently, both "sudo -u some_user cmd" and "sudo su -c some_user cmd" accomplish basically the same thing, which is a sign of feature creep.
- eurleif 14y agosudo has security features. It's possible to restrict the set of commands that can be executed, for example. What would be a Unixy way to do that? How can you decouple the thing that gives you root access from the thing that restricts what you can do with it?
- deleted 14y ago[deleted]
- morpher 14y ago"-e: edit something" (or 'sudoedit') is actually very useful. It makes a temporary copy of th file that is editable by your user, allowing the editor to be run without elevated privileges. After the editor quits, it moves the edited file back over the original. This could be a simple wrapper script around sudo, but that could require entering the password twice.
- joshguthrie 14y agoThere is a difference of "functionality" between "Become Super User" and "Switch User", the base intent is not the same.
- joshguthrie 14y agoTL;DR: Legacy code with gotos in it.
- dwyer 14y agoWay to nitpick about goto while completely overlooking the obvious buffer overflow.
- metaphorm 14y agothats not an inappropriate use of gotos either. they're in the same function, just a few lines down, and are just used to improve the safety and efficiency of the code. in fact thats the textbook case of the only time when a goto is actually a good idea.
- UnoriginalGuy 14y agoIt is C, of course it is going to have goto's in it. How else are you going to handle error conditions? Copy and paste the error code a dozen times within a single function? (hint: C doesn't support exceptions) You could use longjmp/setjmp but those have a lot of the same issues that people claim goto has. In fact worse in several ways, since while goto makes it hard to follow the program flow, longjmp makes it /impossible/.
- derleth 14y ago> since while goto makes it hard to follow the program flow, longjmp makes it /impossible/. Only if you don't use it tastefully. It can be a nice way to bail out of a recursive function with an error code, which is precisely how I've used it. Really, it looks exactly the same as a try ... catch block in that C++/Java/C# language everyone's on about now.