incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Talbot <bryan.tal...@playnext.com>
Subject Failed to mkdirs $HOME/.cassandra
Date Fri, 09 May 2014 22:42:50 GMT
How should nodetool command be run as the user "nobody"?

The nodetool command fails with an exception if it cannot create a
.cassandra directory in the current user's home directory.

I'd like to schedule some nodetool commands to run with least privilege as
cron jobs. I'd like to run them as the "nobody" user -- which typically has
"/" as the home directory -- since that's what the user is typically used
for (minimum privileges).

None of the methods described in this JIRA actually seem to work (with
2.0.7 anyway) https://issues.apache.org/jira/browse/CASSANDRA-6475

Testing as a normal user with no write permissions to the home directory
(to simulate the nobody user)

[vagrant@local-dev ~]$ nodetool version
ReleaseVersion: 2.0.7
[vagrant@local-dev ~]$ rm -rf .cassandra/
[vagrant@local-dev ~]$ chmod a-w .

[vagrant@local-dev ~]$ nodetool flush my_ks my_cf
Exception in thread "main" FSWriteError in /home/vagrant/.cassandra
        at
org.apache.cassandra.io.util.FileUtils.createDirectory(FileUtils.java:305)
        at
org.apache.cassandra.utils.FBUtilities.getToolsOutputDirectory(FBUtilities.java:690)
        at
org.apache.cassandra.tools.NodeCmd.printHistory(NodeCmd.java:1504)
        at org.apache.cassandra.tools.NodeCmd.main(NodeCmd.java:1204)
Caused by: java.io.IOException: Failed to mkdirs /home/vagrant/.cassandra
        ... 4 more

[vagrant@local-dev ~]$ HOME=/tmp nodetool flush my_ks my_cf
Exception in thread "main" FSWriteError in /home/vagrant/.cassandra
        at
org.apache.cassandra.io.util.FileUtils.createDirectory(FileUtils.java:305)
        at
org.apache.cassandra.utils.FBUtilities.getToolsOutputDirectory(FBUtilities.java:690)
        at
org.apache.cassandra.tools.NodeCmd.printHistory(NodeCmd.java:1504)
        at org.apache.cassandra.tools.NodeCmd.main(NodeCmd.java:1204)
Caused by: java.io.IOException: Failed to mkdirs /home/vagrant/.cassandra
        ... 4 more

[vagrant@local-dev ~]$ env HOME=/tmp nodetool flush my_ks my_cf
Exception in thread "main" FSWriteError in /home/vagrant/.cassandra
        at
org.apache.cassandra.io.util.FileUtils.createDirectory(FileUtils.java:305)
        at
org.apache.cassandra.utils.FBUtilities.getToolsOutputDirectory(FBUtilities.java:690)
        at
org.apache.cassandra.tools.NodeCmd.printHistory(NodeCmd.java:1504)
        at org.apache.cassandra.tools.NodeCmd.main(NodeCmd.java:1204)
Caused by: java.io.IOException: Failed to mkdirs /home/vagrant/.cassandra
        ... 4 more

[vagrant@local-dev ~]$ env user.home=/tmp nodetool flush my_ks my_cf
Exception in thread "main" FSWriteError in /home/vagrant/.cassandra
        at
org.apache.cassandra.io.util.FileUtils.createDirectory(FileUtils.java:305)
        at
org.apache.cassandra.utils.FBUtilities.getToolsOutputDirectory(FBUtilities.java:690)
        at
org.apache.cassandra.tools.NodeCmd.printHistory(NodeCmd.java:1504)
        at org.apache.cassandra.tools.NodeCmd.main(NodeCmd.java:1204)
Caused by: java.io.IOException: Failed to mkdirs /home/vagrant/.cassandra
        ... 4 more

[vagrant@local-dev ~]$ nodetool -Duser.home=/tmp flush my_ks my_cf
Unrecognized option: -Duser.home=/tmp
usage: java org.apache.cassandra.tools.NodeCmd --host <arg> <command>
...

Mime
View raw message