Reputation: 98961
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 `('
Upvotes: 3
Views: 3925
Reputation: 1085
Another method is to start your network in one window of PowerShell (if using windows) and then, in a new PowerShell window, execute
geth attach
and then use management APIs for various purposes, like:
> personal.newAccount()
Passphrase: //Type password here
Repeat passphrase:
<addressOfNewAccount>
or
> personal.newAccount("PasswordHere")
<addressOfNewAccount>
Here is the link to know more about management APIs
Upvotes: 2
Reputation: 537
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.
Upvotes: 2