Linux下出现Permission denied解决

今天不想写前言,直接写解决办法


输入命令设置root密码

sudo passwd

得到的答复是

We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.
    [sudo] password for xxx: 

大意就是:
“我们相信您已经收到了本地系统管理员的例行讲座。通常可以归结为以下三个方面:

1)尊重他人隐私。

2)输入命令行前要想清楚。

3)强大的权限带来巨大的责任。”

反正就是叫你不要乱搞就对了,之后输入你的root密码即可。

设置好后,输入

su root

然后会发现命令行前的$都变成了#,[xxx@localhost]也变成了[root@localhost]

接下来设置权限,命令为

sudo chmod -R 777 目录名

其中

-R 是指级联应用到目录里的所有子目录和文件

777 是所有用户都拥有最高权限

在虚拟机下怎么样都无所谓。但在正式环境下的这里的设置,一定要谨慎!!!

在虚拟机下怎么样都无所谓。但在正式环境下的这里的设置,一定要谨慎!!!

在虚拟机下怎么样都无所谓。但在正式环境下的这里的设置,一定要谨慎!!!


不多BB,举个例子:切换到根目录后输入命令行开启usr目录下所有用户的权限

sudo chmod -R 777 usr

The End

原文地址:https://www.cnblogs.com/zilongmao/p/10304093.html