How to configure access permissions for Cassandra on Linux Ubuntu

user3870315 picture user3870315 · Oct 9, 2015 · Viewed 13.6k times · Source

Thank-you for reading this. I am stuck at step three on this tutorial pertaining to installing Cassandra: http://wiki.apache.org/cassandra/GettingStarted#Step_3:_Start_Cassandra

I can only run this software as root. (shouting this over fictional helicopter noise) This seem like a terrible way to run the software.

When starting the Cassandra server as my normal user I receive the following errors:

1.) 15:46:00,147 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - openFile(/var/log/cassandra/system.log,true) call failed. java.io.FileNotFoundException: /var/log/cassandra/system.log (Permission denied)

2.) ERROR 20:46:00 Doesn't have write permissions for /var/lib/cassandra/data directory

I tried changing the permissions several times and nothing has worked. I tried changing the /var/log/cassandra/system.log permissions for read/write for the cassandra group on the operating-system (OS). The command I used to do this was, sudo chmod 664 /var/log/cassandra/system.log. I found this page helpful in determining how to change the permissions:http://www.linux.org/threads/file-permissions-chmod.4094/

Then, I added my user-name to the cassandra group. From my understanding running the /usr/sbin/cassandra -f command as my user should allow me to access the /var/log/cassandra/system.log file, which would solve one of the errors, error number 1 above.

Respectfully,

user

Answer

phact picture phact · Oct 10, 2015

Give the user you want permissions to the data and commitlog dirs.

sudo chown -R cassandra:cassandra /var/lib/cassandra/data


sudo chown -R cassandra:cassandra /var/lib/cassandra/commitlog