linux用戶的根目錄_為什么Linux允許用戶刪除根目錄?

linux用戶的根目錄

linux用戶的根目錄

why-does-linux-allow-users-to-remove-the-root-directory-00

Most of the time, none of us willingly performs an action that will literally break our operating systems and force us to reinstall them. But what if such an action could easily occur even by accident on the user’s part? Today’s SuperUser Q&A post has the answer to a confused reader’s question.

在大多數情況下,我們沒人愿意執行會破壞操作系統并強迫我們重新安裝它們的操作。 但是,如果即使是用戶意外,也很容易發生這種動作怎么辦? 今天的“超級用戶問答”帖子回答了一個困惑的讀者的問題。

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

今天的“問答”環節由SuperUser提供,它是Stack Exchange的一個分支,該社區是由社區驅動的Q&A網站分組。

問題 (The Question)

SuperUser reader fangxing wants to know why Linux would allow users to remove the root directory:

超級用戶閱讀者fangxing想知道為什么Linux允許用戶刪除根目錄:

When I installed Linux on my computer for the first time, I always liked to use root because I did not need to add sudo and enter my password every time I executed a command that needed root level permissions.

第一次在計算機上安裝Linux時,我總是喜歡使用root,因為不需要每次執行需要root級權限的命令時都添加sudo并輸入密碼。

One day, I just wanted to remove a directory and ran rm -rf? /, which “broke” my system. I have been wondering why Linux’s designers did not block such a dangerous command from being run so easily.

有一天,我只想刪除一個目錄并運行rm -rf / ,它“破壞了”我的系統。 我一直在想,為什么Linux的設計人員沒有阻止這么危險的命令這么容易地運行。

Why does Linux allow users to remove the root directory?

為什么Linux允許用戶刪除根目錄?

答案 (The Answer)

SuperUser contributor Ben N has the answer for us:

超級用戶貢獻者Ben N為我們提供了答案:

Why should it block you from doing whatever you want with your own computer? Logging in as root or using sudo is literally saying to the machine, “I know what I am doing.” Preventing people from doing dubious things usually also prevents them from doing clever things (as expressed by Raymond Chen).

為什么要阻止您使用自己的計算機執行任何操作? 從根本上登錄或使用sudo對機器說:“我知道我在做什么。” 阻止人們做可疑的事情通常也會阻止他們做聰明的事情(如雷蒙德·陳表示)。

Besides, there is one singularly good reason to allow a user to torch the root directory: decommissioning a computer by completely erasing the operating system and file system. (Danger! On some UEFI systems, rm -rf / can brick the physical machine too.) It is also a reasonable thing to do inside a chroot jail.

此外,有一個奇特的理由讓用戶可以破壞根目錄:通過完全擦除操作系統和文件系統來停用計算機。 (危險!在某些UEFI系統上, rm -rf /也會使物理機變磚。)在chroot監獄中進行操作也是合理的。

Apparently, people accidentally ran the command so much that a safety feature was added. rm -rf / does nothing on most systems unless –no-preserve-root is also supplied, and there is no way that you can type that by accident. That also helps guard against poorly-written but well-intentioned shell scripts.

顯然,人們不小心運行了命令,以至于添加了安全功能。 rm -rf /在大多數系統上不執行任何操作,除非還提供了–no-preserve-root ,并且您不可能無意間輸入該內容。 這也有助于防止編寫不良但意圖良好的shell腳本。



Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

有什么補充說明嗎? 在評論中聽起來不錯。 是否想從其他精通Stack Exchange的用戶那里獲得更多答案? 在此處查看完整的討論線程。

Image Credit: Wikimedia Commons

圖片來源: Wikimedia Commons

翻譯自: https://www.howtogeek.com/277896/why-does-linux-allow-users-to-remove-the-root-directory/

linux用戶的根目錄

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/280117.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/280117.shtml
英文地址,請注明出處:http://en.pswp.cn/news/280117.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

純css實現叉號

HMTL部分 <a href"#" class"close"></a> CSS部分 .close {position: absolute;right: 32px;top: 32px;width: 32px;height: 32px; } .close:before, .close:after {position: absolute;left: 15px;content: ;height: 33px;width: 2px;backgro…

微軟跨平臺maui開發chatgpt客戶端

image什么是maui.NET 多平臺應用 UI (.NET MAUI) 是一個跨平臺框架&#xff0c;用于使用 C# 和 XAML 創建本機移動(ios,andriod)和桌面(windows,mac)應用。imagechagpt最近這玩意很火&#xff0c;由于網頁版本限制了ip&#xff0c;還得必須開代理&#xff0c; 用起來比較麻煩&a…

在Xshell 6開NumLock時按小鍵盤上的數字鍵并不能輸入數字

小鍵盤問題 在Xshell 6上用vi的時候&#xff0c;開NumLock時按小鍵盤上的數字鍵并不能輸入數字&#xff0c;而是出現一個字母然后換行&#xff08;實際上是命令模式上對應上下左右的鍵&#xff09;。解決方法 選項Terminal->Features里&#xff0c;找到Disable application …

WebP 在減少圖片體積和流量上的效果如何?—— WebP 技術實踐分享

作者 | Jackson編輯 | 尾尾 不論是 PC 還是移動端&#xff0c;圖片一直占據著頁面流量的大頭&#xff0c;在圖片的大小和質量之間如何權衡&#xff0c;成為了長期困擾開發者們的問題。而 WebP 技術的出現&#xff0c;為解決該問題提供了好的方案。本文將為大家詳細介紹 WebP 技…

chrome 固定縮放比例_您如何調整Google Chrome瀏覽器的用戶界面縮放比例?

chrome 固定縮放比例Everything can be going along nicely until a program gets a new update that suddenly turns everything into a visual mess, like scaling up the UI, for example. Is there a simple solution? Today’s SuperUser Q&A post has some helpful …

樹莓派 Raspberry Pi 更換國內源

http://www.shumeipaiba.com/wanpai/jiaocheng/16.html轉載于:https://www.cnblogs.com/Baronboy/p/9185849.html

優雅告別 2022 年,2023 年主題:敢想,就敢做!

自從工作之后&#xff0c;每年春節我都會花一天時間&#xff0c;一個人待在一個小房間&#xff0c;思考自己今年做了什么具備階段性成果的事情。然后&#xff0c;寫下明年需要執行的計劃。會寫在一個 XMind 文件里&#xff0c;記錄每一年將要執行的計劃&#xff0c;且未完成的計…

純js上傳文件 很好用

<!DOCTYPE html> <html> <head> <meta charset"utf-8"> <meta name"viewport" content"widthdevice-width, initial-scale1.0"> <title>參數設置</title> <meta name"keywords&q…

買臺電腦,不行!去旅游一下,不行!論程序員怎么實現財務自由!

“最近讀了一本不是編程的程序員技能書《軟技能-代碼之外的生存指南》&#xff0c;全書分為 7 個篇章&#xff0c;分別是職業、自我營銷、學習、生產力、理財、健身和精神。在讀完職業、自我營銷和理財這三個篇章后&#xff0c;讓我感觸很深&#xff0c;也讓我很意外。本來以為…

java發送gmail_如何在Gmail中輕松通過電子郵件發送人群

java發送gmailMailing lists are an old tool in the email arsenal, but their implementation in Gmail isn’t immediately intuitive. Read on as we show you how to email groups using your Gmail account. 郵件列表是電子郵件庫中的一個舊工具&#xff0c;但是在Gmail中…

移動web開發相關筆記(三)

1.推薦以sublime插件的排名官網:https://packagecontrol.io/&#xff08;sublime插件官網&#xff09;2.時間算法【//總秒數var totalSecond 3671;//獲取里面的小時var hoursMath.floor(totalSecond/3600);//獲取剩下的分鐘var minuteMath.floor(totalSecond%3600/60);//獲取剩…

互聯網和IT行業越來越嚴峻,前景幾何?

楔子新冠疫情反反復復&#xff0c;互聯網和IT行業一路下滑。硅谷裁員高達10萬人。前景該何處何從呢&#xff1f;春江水暖豬先知IT行業如此的不景氣&#xff0c;自然是一些在風口上被吹起來的豬首先感受到了。他們進行的自救其實就一條:裁員&#xff0c;大量的裁員。裁員可以解決…

Asp.net MVC使用Model Binding解除Session, Cookie等依賴

上篇文章"Asp.net MVC使用Filter解除Session, Cookie等依賴"介紹了如何使用Filter來解除對于Session, Cookie的依賴。其實這個也可以通過Model Binding來達到同樣的效果。 什么是Model Binding? Model Binding的作用就是將Request請求中包含的散亂參數&#xff0c;根…

C++回聲服務器_4-UDP connect版本客戶端

針對UDP套接字調用connect函數不會與對方UDP套接字建立連接&#xff0c;只是向UDP套接字注冊目標IP和端口信息。 修改客戶端代碼 服務器代碼不需要修改&#xff0c;只需修改客戶端代碼。調用connect函數之后&#xff0c;可以調用write函數和read函數來發送、接收數據&#xff0…

如何在路由綁定中使用 IParsable

IParsable 是 .Net 7 中新增的接口&#xff0c;它可以將字符串轉換為對應的實體。在 Controller 的 Route 綁定中可以使用 IParsable 來綁定復雜的實體。實驗背景 假設有一個需要將 route "report/{month}-{day}" 綁定到 MyDate 對象上的場景。在 .Net 7 之前&#x…

火狐 新增標簽 一直加載_在Firefox的新標簽頁中加載最后標簽頁的URL

火狐 新增標簽 一直加載Yeah, you’re pretty sure that you’re the master of all things Firefox. I mean, why else would you be reading this article? So, we’ve got to ask, have you ever seen this one before? 是的&#xff0c;您很確定自己是Firefox的所有人。 …

ptyhon【遞歸練習】

轉載于:https://www.cnblogs.com/LTEF/p/9187287.html

Iterator 和 for...of 循環

本系列屬于阮一峰老師所著的ECMAScript 6 入門學習筆記 Iterator(遍歷器) JavaScript表示“集合”的數據結構&#xff0c;除了Array 、Object &#xff0c;ES6又新增了Map 和Set 。 遍歷器&#xff08;Iterator&#xff09;是一種統一的接口機制&#xff0c;用來處理所有不同的…

JAVA常量

2019獨角獸企業重金招聘Python工程師標準>>> 常量就是一個固定值。它們不需要計算&#xff0c;直接代表相應的值。 常量指不能改變的量。 在Java中用final標志&#xff0c;聲明方式和變量類似&#xff1a; final double PI 3.1415927; 雖然常量名也可以用小寫&…

基于Docker托管Azure DevOps代理

Azure DevOps非常好用&#xff0c;但是為代理準備單獨的服務器經常會顯得性價比不高&#xff1a;配置低了&#xff0c;前端構建時會教會你做人&#xff0c;配置太高又有點浪費資源&#xff0c;代理數量少了各團隊構建要打架。對于既想享受DevOps的美妙之處但是資源捉襟見肘的小…