简体   繁体   English

Ubuntu权限被拒绝错误

[英]Ubuntu Permission Denied Error

I get he following error running this command /etc/init.d/celerybeat start : 我得到他跟随错误运行此命令/etc/init.d/celerybeat start

chown: changing ownership of `/srv/project/logs': Operation not permitted
chown: changing ownership of `/var/run': Operation not permitted
chown: changing ownership of `/var/run': Operation not permitted
chmod: changing permissions of `/var/run': Operation not permitted
chown: changing ownership of `/srv/project/logs': Operation not permitted
chmod: changing permissions of `/srv/project/logs': Operation not permitted
Starting celerybeat...
ubuntu@ip-10-239-73-129:/etc/default$ LockFailed: [Errno 13] Permission denied: '/var/run/celerybeat.pid'

The user it runs under is ' celery '. 它运行的用户是' 芹菜 '。

I run this command after to create the user: 我在创建用户之后运行此命令:

adduser --system --no-create-home --disabled-login --disabled-password --group celery

But still get the permission denied error. 但仍然得到权限被拒绝错误。 Why? 为什么?

Add user 'celery' to the sudoers group for this u need to be root user First you can switch user to root 将用户'celery'添加到sudoers组,因为你需要是root用户首先你可以将用户切换到root

$ su root
$ adduser <username> sudo

Now switch back to 'celery' 现在切换回'芹菜'

$ su celery

Now try and execute the commands with sudo option. 现在尝试使用sudo选项执行命令。

Also to add celery to be the user of that folder you can use chown to change the owner of that folder (as root user) 另外要将celery添加为该文件夹的用户,您可以使用chown来更改该文件夹的所有者(以root用户身份)

$ chown -R celery:celery <foldername>

要更改权限并创建用户,您需要root权限,因此您应该使用root登录,或者如果用户存在于sudoers文件中,您可以使用sudo命令从普通用户进行登录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM