What's new

How to remove wrong value from nvram?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Igor

Regular Contributor
RT-AX68U fw Merlin 386.4. I see wrong value in nvram
Code:
# nvram show | grep sshd
...
sshd_authkeysjBWlBI+BSlX7jHcj7qjg5sIp4sscfUfe1KWIF0bOucMq8AvwNiyDVwJdeXSTL4u2Npji1FCRPAAsHmOAtIxPZv0KQ2AqAOU/FxjOaa2DG20=garry@MyHomeAssistant
...

Trying to delete.
Code:
# nvram unset sshd_authkeysjBWlBI+BSlX7jHcj7qjg5sIp4sscfUfe1KWIF0bOucMq8AvwNiyDVwJdeXSTL4u2Npji1FCRPAAsHmOAtIxPZv0KQ2AqAOU/FxjOaa2DG20=garry@MyHomeAssistant
Not deleted.

Code:
# nvram savefile test
# nano test
(delete line)
# nvram loadfile test
# nvram commit
Not deleted.

I have a longer wrong value
Code:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCgFMsRSAXQj8s7JceAdX3DzGSjJzIa+wtMAFwpjoqqbIJHpHzyBbSO5t4hJmL4O8HNuGoCkv2L72Znt0h7HTOk2NjGAWYrHMFee/rwaO5KDkGfVIPBHFqsUH/QR2HDd12Ix++jZGgttMx3TuL8yXsS4Zebc0QTpzq/NMG9CQvsPgj7cP0iOP3KZll3n/H2WtLq1zDRDoSOksX+4MDjslQxskN90e34DLwsIbrGaRoi ...

How to remove wrong value from nvram?
 
Go to Administration > System > SSH section and install correct public (Authorized) key(s) then Save.
 
The GUI shows the correct keys. Same as "sshd_authkeys=" nvram section. I'm talking about the erroneous value of nvram. It has nothing to do with correct value "sshd_authkeys=".
 
Then set nvram variable to null and start over w/ GUI.

Code:
nvram set sshd_authkeys=''
nvram commit
 
Code:
nvram set sshd_authkeys=''
nvram commit
nvram show | grep ssh-
size: 78756 bytes (52316 left)
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCgFMsRSAXQj8s7JceAdX3 [skip]
 
Why grep ssh- ?? That could be from some other variable. Show me the variable.

Code:
nvram get sshd_authkeys
 
If grep'ing ssh- returned something, then it looks like you accidentally installed ssh-rsa as a variable (I don't have such a variable on my system). If that's the case, you can null it as well.
 
Code:
@RT-AX68U-92A0:/tmp/home/root# nvram get sshd_authkeys

@RT-AX68U-92A0:/tmp/home/root#
 
Code:
@RT-AX68U-92A0:/tmp/home/root# nvram get sshd_authkeys

@RT-AX68U-92A0:/tmp/home/root#

Then the Authorized Keys field on Administration->System->SSH should now be empty. Add your key(s) back there and Save.
 
I have two identical routers. One of them has entry which is like value. I can't delete it in any way.
 
Code:
nvram unset "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCgFMsRSAXQj8s7JceAdX3"
But include all the characters up to the = sign before garry. Do not include the equal sign.
 
Code:
nvram unset "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCgFMsRSAXQj8s7JceAdX3"
But include all the characters up to the = sign before garry. Do not include the equal sign.

Ah, finally realized the OP has created a variable by the same name as the key!

While it should be removed, I don't see why it should cause issues w/ getting the Authorized Keys field configured properly.
 
But include all the characters up to the = sign before garry. Do not include the equal sign.
Does not work. I put this long variable in double quotes - I can't delete it. Single quotes can't be removed either.
 
I would just reset to defaults and start over. or restore a good backup before this issue started.
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top