In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what happens when Linux users delete the root directory". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
A friend suddenly asked me this question today, and I couldn't answer it for a moment. In most cases, none of us will execute this command, which will damage our operating system, but this situation is more likely to happen. So the reason why this command can be executed is accidental?
After searching in some communities, I finally saw Ben N's answer on a website, and his answer was as follows:
Logging in as root or using sudo is actually saying to the machine, "I know what I'm doing." Preventing people from doing suspicious things usually also prevents them from doing smart things.
In addition, there is a very good reason to allow users to operate on the root directory: completely remove the operating system and file system to decommission the computer. (dangerous! On some UEFI systems, rm-rf / may also damage the physical machine.)
Obviously, people accidentally executed this command, so that a security function was added. Rm-rf / does nothing on most systems and provides-no-preserve-root, and you can't type it by accident. It also helps to guard against poorly written but well-intentioned shell scripts.
It means that if the parameter-no-preserve-root is not specified, GNU rm will refuse to execute the command, and only enter rm-rf / and will not delete the files in the root directory. It has been tested on Ubuntu, and the test results are as follows:
The result of my execution of rm-rf / * is as follows, frantically deleting system files.
But after a while there was no response, I pressed Ctrl + C to stop, the page is as follows, the input box can still appear
But some commands cannot be used, but you can change directories at will.
This means that some system files cannot be deleted, and some related commands seem to be executable, so as Ben N said, when you log in with a root user, or use sudo to use this command, you are saying to the system, "I know what I can do, I know exactly what what I am doing," or you can think that Linux is designing this dangerous command. It is not blocked because I delete my computer's files when I want to retire my computer.
So in the general use of Linux is, generally do not use excessive permissions of users, for some often need to operate the directory you can use root user permissions set to 777, or you commonly used users to join the root user group, and so on, this is also convenient to operate, but also to prevent some beginners' misoperation leading to system crash, and so on.
So much for the content of "what happens if Linux users delete the root directory". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.