[Ethereum] Failed to read genesis file: open genesis.json: permission denied

blockchaingo-ethereumprivate-blockchain

First of all I have to say that all this things will work on my windows machine. Today I started to do the same things on a ubuntu machine (with ssh and private key authentication). I've created a genesis.json file and a "blockchain" dir (that will be the location for my private chain data). But when I try to initiate (with my genesis file) the Blockchain, I recive this error:

Failed to read genesis file: open genesis.json: permission denied

. I've also performed the command chmod 777 genesis.json, but nothing's changed.
The comand, that in windows will work, is: geth --datadir blokchain init genesis.json. I've also tried to put the path of the dir and the file, but nothing.

Any idea? Thanks!

By the ways, this is my genesis.json file:

{
  "coinbase"   : "0x0000000000000000000000000000000000000001",
  "difficulty" : "0x20000",
  "extraData"  : "",
  "gasLimit"   : "0x8000000000",
  "nonce"      : "0x0000000000000042",
  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00",
  "alloc": {},
  "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0,
        "EIP150Block":0,
        "ByzantiumBlock":0
    }
}

Best Answer

This is more of a question for the ubuntu stackexchange.

You have two options:

  1. Execute with sudo. This will work for sure: sudo geth --datadir blokchain init genesis.json
  2. There might be a problem with permission (chmod set incorrectly). Try setting it on the entire folder. sudo chmod -r 777 myFolderThatContainsEntireChain. This isn't the best solution but it may well be worth to try and see if it fixes your problem.

EDIT: If it doesn't help consider this.

I realized you spelled blokchain instead of blockchain are you sure this is correct?

Otherwise it seems like geth can't find the genesis.json. Are you sure you are currently in the folder where your genesis.json resides? Furthermore make sure that the datadir folder exists as well (and with the correct path).

I hope this helps.

Related Topic