Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

When working on both Windows and Linux servers, I've noticed one difference between them that seems to keep coming up. 2 examples that come to mind:

  1. Deleting a file: In Linux, if you are root, and you say rm -f [filename] there is only one possible result -- The file will be deleted. You will not be given some reason why the system has decided not to fulfill your request (locked, in use, not enough permission, etc.). Not so in Windows, no matter how much rights you have.

  2. Killing a process: In Linux, if you are root, and you say kill -9 [procid], there is only one possible result -- The process will be killed. In Windows you can go into the Task Administrator and kill a process and it may just stay there without even an explanation of why the system has decided to deny your request.

Is there any technical reason why Windows has chosen to give the operating system the final say in what commands get executed? Why can't the Administrator user delete any files it wants and kill any processes it wants, like root can on Linux?

share|improve this question
9  
This is a rant against Windows and even if it were not, it is entirely off topic. – Oded Oct 24 '12 at 18:08
4  
The second case isn't even true; good luck killing a process in uninterruptible sleep on Linux. I suspect the first case isn't true all the time either, but I don't have an immediate example other than stuff like SELinux – Michael Mrozek Oct 24 '12 at 18:17
1  
@Michael Mrozek: In linux, you can delete a file that is being used by a running program and this will not create any problem to the running program. This is very useful especially with temporary files: open a temporary file and delete it right after it is opened. The file handler will be valid until it is closed later, at which point the actual deletion will be happening. – Codism Oct 24 '12 at 18:39
2  
@JoelFan If you have questions about those problems, you should ask about them on the appropriate site. Otherwise, please see our FAQ for what is on-topic here. This doesn't fit into any of those categories. – Thomas Owens Oct 24 '12 at 18:50
1  
@Codism Sure, but I'm pretty sure it's not the case that 100% of the time an rm command will succeed if you're root. Certainly if SELinux is in the way it won't; also if the file has been set immutable (chattr +i), and probably many other cases – Michael Mrozek Oct 24 '12 at 18:57
show 3 more comments

closed as off topic by Oded, kevin cline, Ryathal, jfrankcarr, Thomas Owens Oct 24 '12 at 18:14

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

It's more a design philosophy than anything else.

There are a huge number of Windows Administrators (especially in smaller companies) who are expected to keep the servers/network running while only having limited experience and/or no qualifications (I've been one).

In this situation an OS that watches/limits what even an administrator can do can be a life-safer, Windows is designed to be as easy to pick up and use as possible.
It can certainly be frustrating at times, but Windows is usually right in these circumstances.

Linux, by contrast, is written by people who want efficiency and directness over ease of use. "Just do what I tell you when I tell you", users are expected to know exactly what they're doing before they try it.

share|improve this answer
So why does Linux not have this issue? – JoelFan Oct 24 '12 at 18:18
2  
Linux assumes you know what you're doing. If you want to rm / -rf Linux will happily delete itself from your system. Trust me there are plenty of opportunities to shoot yourself in the foot with Windows too, but there are also more safeguards in place so that you won't ACCIDENTALLY shoot yourself in the foot. – Mike Brown Oct 24 '12 at 18:32
should be: rm -rf / ... unlike Widows, Linux expects you to put your switches before your parameters – JoelFan Oct 24 '12 at 18:35
@JoelFan - it depends on the command; e.g. see find: linux.die.net/man/1/find – Mike Partridge Oct 24 '12 at 19:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.