geth account new - password on command line

Viewed 2960

I'm trying to use a password on the command line instead of keeping it on a text file using geth:

geth --password mYp@ssw0rd account new

but the above throws:

Fatal: Failed to read password file: open mYp@ssw0rd: no such file or directory

Which makes sense since --password expects a "Password file to use for non-inteactive password input".
Is there any way to provide the password directly on the command line using geth? Something like:

geth --password mYp@ssw0rd account new

I've seen an article on go-ethereum wiki using:

geth --password <(echo -n mYp@ssw0rd) account new

But this throws another error on CentOS:

-sh: syntax error near unexpected token `('

2 Answers

There are two ways to create your account from command line.

geth account new --password <(echo $mypassword)
geth account new --password [arg] 

[arg] = the name of a file containing the password and not the password itself.

Related