smth
smth

Reputation: 662

celery user permission denied to /bin/celery

I am trying to daemonize a celery configuration on an aws instance.

Following the celery docs, I have:

/etc/init.d/celeryd
/etc/default/celerybeat

I've created both a celery user and celery group and set permissions like so:

sudo chown -R celery:celery /var/log/celery/
sudo chown -R celery:celery /var/run/celery/
sudo chown celery:celery /home/sfree/meampy/bin/celery

When I check the file's permissions, it looks good:

(meampy)[]$ ls -l /home/sfree/meampy/bin/celery
-rwxrwxrwx 1 celery celery 237 Sep 13 15:15 /home/sfree/meampy/bin/celery

But when I run the script:

sudo  sh -x /etc/init.d/celeryd start

...

Starting celeryd...
+ _chuid -f /var/log/celery/beat.log -l INFO --detach --pidfile=/var/run/celery/beat.pid
+ su celery -c '/home/sfree/meampy/bin/celery beat -f /var/log/celery/beat.log -l INFO --detach --pidfile=/var/run/celery/beat.pid'
bash: /home/sfree/meampy/bin/celery: Permission denied
+ exit 0

If I run the offending line solo, I get the same error.

meampy is the name of my virtualenv. Is the virtualenv the reason I am running into permission problems?

EDIT: the permissions on the virtualenv:

lrwxrwxrwx  1 sfree www-data      24 Sep  1 19:49 meampy -> /usr/local/python/meampy

I added the celery user to the www-data group, still same error

Upvotes: 1

Views: 1590

Answers (1)

Allen
Allen

Reputation: 11

Because virtualenv meampy is belong to sfree, you should modify your celery config file (/etc/default/celeryd)

set

CELERYD_USER="sfree"
CELERYD_GROUP="sfree"

and do not forget

sudo chown -R sfree:sfree /var/log/celery/
sudo chown -R sfree:sfree /var/run/celery/

Upvotes: 1

Related Questions