Lost password after reboot



  • Hello.

    In my pfsense server I have wrote a cron script that change the ssh password for admin and root users every month, but for any reason every time I reboot the server, changes are lost, and the only way I have to access through  the ssh console is using the same password I use to access the web interface.

    The script uses next commands to change password:

    system "$echo $passwd |pw mod user root -h 0";
    system "$echo $passwd |pw mod user admin -h 0";

    Can anybody explain me how I can change ssh password and avoid lost changes when the server is rebooted ?

    Thanks a lot.


  • Rebel Alliance Developer Netgate

    Change the password for admin in the GUI and that changes it for admin/root in the shell. That's the way it's intended to work. Any change that causes a resync of the users, such as a reboot, will overwrite any manual modifications you have made to the accounts in the shell.



  • Thanks a lot for your reply Jimp,

    Perhaps could you explain me if there any way to use /usr/local/www/system_usermanager_passwordmg.php to change password  through shell console?

    Will be great if I could find any way to change  password from command shell.

    Thanks.


  • Netgate Administrator

    Somehow using the php/develper shell? Or via similar commands? The issue maybe that the password is held as a hash in the config file so you can't operate on it directly like you can with other settings in the file.

    https://doc.pfsense.org/index.php/Using_the_PHP_pfSense_Shell

    Steve


Log in to reply