解決centos 刪除檔案夾 permission denied

來源:互聯網
上載者:User

解決centos 刪除檔案夾 permission denied

centos 刪除檔案夾 permission denied

用 tar 命令解壓出來的檔案夾卻帶了個鎖,無法刪除;

如:

使用 rm -rf 刪除輸出如下:

加 sudo 執行後發現關鍵資訊了:xxx is not in the sudoers file.

解決方案:

首先需要切換到root身份
$su -
(注意有 -,這和su是不同的,在用命令"su"的時候只是切換到root,但沒有把root的環境變數傳過去,還是目前使用者的環境變數,用"su -"命令將環境變數也一起帶過去,就象和root登入一樣)
然後
$visudo//切記,此處沒有vi和sudo之間沒有空格

1、“:$”移動游標,到最後一行
2、按a,進入append模式
3、輸入您的使用者名稱及後面的資訊
your_user_name ALL=(ALL) ALL
4、按Esc
5、輸入“:wq”(斷行符號,儲存檔案並退出)

這樣就把自己加入了sudo組,可以使用sudo命令了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.