使用sudo chown -R $ user授予用户权限:$ user /dir/ectory/

时间:2021-07-13 16:41:14

I am following this tutorial: How To Set Up Apache Virtual Hosts on Ubuntu 14.04 LTS.

我正在学习本教程:如何在Ubuntu 14.04 LTS上设置Apache虚拟主机。

I get an error on: Step Two — Grant Permissions which states the following:

我得到一个错误:步骤2 -授予权限,它声明如下:

Now we have the directory structure for our files, but they are owned by our root user. If we want our regular user to be able to modify files in our web directories, we can change the ownership by doing this:

现在我们有了文件的目录结构,但是它们是由根用户拥有的。如果我们想让我们的普通用户能够修改我们的web目录中的文件,我们可以这样做来更改所有权:

sudo chown -R $USER:$USER /var/www/example.com/public_html
sudo chown -R $USER:$USER /var/www/test.com/public_html

The $USER variable will take the value of the user you are currently logged in as when you press "ENTER". By doing this, our regular user now owns the public_html subdirectories where we will be storing our content.

$USER变量将获取当前登录的用户的值,就像您按下“ENTER”时一样。通过这样做,我们的常规用户现在拥有public_html子目录,我们将在其中存储我们的内容。

We should also modify our permissions a little bit to ensure that read access is permitted to the general web directory and all of the files and folders it contains so that pages can be served correctly:

我们还应该稍微修改一下我们的权限,以确保允许对通用web目录及其包含的所有文件和文件夹进行读访问,以便能够正确地提供页面:

sudo chmod -R 755 /var/www

Your web server should now have the permissions it needs to serve content, and your user should be able to create content within the necessary folders.

您的web服务器现在应该拥有为内容提供服务所需的权限,您的用户应该能够在必要的文件夹中创建内容。

I typed in the line in Command Line: sudo chown -R $USER:$USER /dir/ectory/ and then I get an error which says: chown: invalid group: ‘developer:developer’

我在命令行中输入:sudo chown -R $USER:$USER /dir/ectory/,然后我得到一个错误,上面写着:chown: invalid group: developer:developer:developer:developer

I have searched and found no working solutions to this problem. I am using Ubuntu 14.04. I'm both new to Ubuntu and * so I apologise for any stupid mistakes that I mightn't made while asking the question. Any help is grealy appreciated!

对于这个问题,我没有找到有效的解决办法。我正在使用Ubuntu 14.04。我对Ubuntu和*都不熟悉,所以我很抱歉在问这个问题的时候我可能没有犯过一些愚蠢的错误。任何帮助都是非常感谢的!

1 个解决方案

#1


9  

This worked:

这工作:

sudo chown -R username:usergroup /var/www/nameofdirectory

#1


9  

This worked:

这工作:

sudo chown -R username:usergroup /var/www/nameofdirectory