0

I am following this tutorial that uses go ethereum tut

but when I run the following command I get a permission denied error

sudo bootnode --nodekey=new-node-1/nodekey --writeaddress > new-node-1/enode

this is the error

-bash: new-node-1/enode: Permission denied
John Bradshaw
  • 179
  • 1
  • 16
  • This might help: `sudo bootnode --nodekey=new-node-1/nodekey --writeaddress | sudo tee new-node-1/enode >/dev/null` – Cyrus Sep 07 '20 at 14:46
  • Thankyou I already tried a pipe in the end It ran with taking the > symbol out. tbh I dont what the > is in bash – John Bradshaw Sep 07 '20 at 19:44

3 Answers3

0

sudo runs bootnode with root privileges, but the > new-node-1/enode redirection will still attempt to write into the new-node-1/ with your user privileges. You might want to check if you have write permissions for new-node-1/, and give them to yourself if not.

If you don't care about new-node-1/enode belonging to root (as opposed to you), then you can switch to root to run the entire command:

sudo su -
bootnode --nodekey=new-node-1/nodekey --writeaddress > new-node-1/enode
j-hui
  • 63
  • 5
0

You can wrap your command in bash -c:

sudo bash -c "bootnode --nodekey=new-node-1/nodekey --writeaddress > new-node-1/enode"
Philippe
  • 20,025
  • 2
  • 23
  • 32
0
sudo bootnode --nodekey=new-node-1/nodekey --writeaddress new-node-1/enode

this is what got it working in the end. I just ran the same command without the '>'. I dont know what it did or why it worked.

John Bradshaw
  • 179
  • 1
  • 16