incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Brosius <dbros...@mebigfatguy.com>
Subject Re: Failed to mkdirs $HOME/.cassandra
Date Fri, 16 May 2014 20:13:58 GMT
 

For now you can edit the nodetool script itself by adding 

-Duser.home=/tmp 

as in 

"$JAVA" $JAVA_AGENT -cp "$CLASSPATH" 
 -Xmx32m 
 -Duser.home=/tmp 
 -Dlogback.configurationFile=logback-tools.xml 
 -Dstorage-config="$CASSANDRA_CONF" 
 org.apache.cassandra.tools.NodeTool -p $JMX_PORT $ARGS

if you like you can add an issue to jira. 

On 2014-05-09 18:42, Bryan Talbot wrote: 

> 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 [1] 
> 
> 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> 
> ...
 

Links:
------
[1] https://issues.apache.org/jira/browse/CASSANDRA-6475

Mime
View raw message