using pfSsh.php to set user authorized_keys
teridon last edited by
I'm trying to set the admin user's SSH authorized keys via pfSsh.php but I'm only having partial success. The following recorded session seems to partly work, in that after I run it, the web GUI then shows the new authorized_keys text. However, it doesn't update the actual /root/.ssh/authorized_keys file on the system.
$config['system']['user']['authorizedkeys'] = "base64-encoded-string-here="; write_config();
I noticed that based on what's in system_usermanager.php, I needed to make a call to local_user_set(), so I tried this as a test:
require_once("guiconfig.inc"); $userent=$config['system']['user']; local_user_set($userent);
But that results in a "DNS Rebind attack detected" error.
Can someone please clue me in on how to get the system to update the system authorized_keys file from the command-line?
teridon last edited by teridon
Rubber-duck wins again; I need to load auth.inc, not guiconfig.inc:
require_once("auth.inc"); $userent=$config['system']['user']; $userent['authorizedkeys'] = "base-64-encoded-string-here"; write_config(); local_user_set($userent);