首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >登录Sudo用户不断收到拒绝权限的消息。

问登录Sudo用户不断收到拒绝权限的消息。
EN

Ask Ubuntu用户
提问于 2021-02-24 20:09:53
回答 1查看 581关注 0票数 0

我一直试图在Ubuntu20.04lts下的linux上安装一个LAMP。

我是主要的sudo用户,在试图保存nano文件和在/var/www/html文件夹中创建目录时,我一直收到“拒绝权限”消息。

“文件”的计算机位置中的所有文件夹都具有灰色权限。我猜这意味着我不能添加或修改这些文件中的内容。

我已经安装了Apache2、MariahDB和PHP,无法创建或修改任何INI文件。

有时,我会收到这样一条消息:我没有访问权限,因为我不是根用户。我认为,作为拥有所有管理权限的主要Sudo用户,我应该是实际的Root用户,并拥有所有访问权限。

我做错了什么?

谢谢

EN

回答 1

Ask Ubuntu用户

发布于 2021-02-24 21:02:29

如果您想以root用户的身份执行一系列命令,而不必每次在每个命令前面加上sudo,我建议使用sudo -i作为root用户获取登录shell。从手册中:

代码语言:javascript
复制
-i, --login
                 Run the shell specified by the target user's password database entry as a login
                 shell.  This means that login-specific resource files such as .profile,
                 .bash_profile or .login will be read by the shell.  If a command is specified,
                 it is passed to the shell for execution via the shell's -c option.  If no
                 command is specified, an interactive shell is executed.  sudo attempts to change
                 to that user's home directory before running the shell.  The command is run with
                 an environment similar to the one a user would receive at log in.  Note that
                 most shells behave differently when a command is specified as compared to an
                 interactive session; consult the shell's manual for details.  The Command
                 environment section in the sudoers(5) manual documents how the -i option affects
                 the environment in which a command is run when the sudoers policy is in use.

或者,如果您记得在安装过程中设置根密码( Ubuntu -通常禁用root帐户),则可以使用su root命令将用户更改为root。

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1319073

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档