日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux用户的根目录_为什么Linux允许用户删除根目录?

發(fā)布時間:2023/12/6 linux 47 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux用户的根目录_为什么Linux允许用户删除根目录? 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

linux用戶的根目錄

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.

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

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.

今天的“問答”環(huán)節(jié)由SuperUser提供,它是Stack Exchange的一個分支,該社區(qū)是由社區(qū)驅(qū)動的Q&A網(wǎng)站分組。

問題 (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.

第一次在計(jì)算機(jī)上安裝Linux時,我總是喜歡使用root,因?yàn)椴恍枰看螆?zhí)行需要root級權(quán)限的命令時都添加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.

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

Why does Linux allow users to remove the root directory?

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

答案 (The Answer)

SuperUser contributor Ben N has the answer for us:

超級用戶貢獻(xiàn)者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).

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

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.

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

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.

顯然,人們不小心運(yùn)行了命令,以至于添加了安全功能。 rm -rf /在大多數(shù)系統(tǒng)上不執(zhí)行任何操作,除非還提供了–no-preserve-root ,并且您不可能無意間輸入該內(nèi)容。 這也有助于防止編寫不良但意圖良好的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.

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

Image Credit: Wikimedia Commons

圖片來源: Wikimedia Commons

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

linux用戶的根目錄

總結(jié)

以上是生活随笔為你收集整理的linux用户的根目录_为什么Linux允许用户删除根目录?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。