我一直试图在Ubuntu20.04lts下的linux上安装一个LAMP。
我是主要的sudo用户,在试图保存nano文件和在/var/www/html文件夹中创建目录时,我一直收到“拒绝权限”消息。
“文件”的计算机位置中的所有文件夹都具有灰色权限。我猜这意味着我不能添加或修改这些文件中的内容。
我已经安装了Apache2、MariahDB和PHP,无法创建或修改任何INI文件。
有时,我会收到这样一条消息:我没有访问权限,因为我不是根用户。我认为,作为拥有所有管理权限的主要Sudo用户,我应该是实际的Root用户,并拥有所有访问权限。
我做错了什么?
谢谢
发布于 2021-02-24 21:02:29
如果您想以root用户的身份执行一系列命令,而不必每次在每个命令前面加上sudo,我建议使用sudo -i作为root用户获取登录shell。从手册中:
-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。
https://askubuntu.com/questions/1319073
复制相似问题