Remotely change password for managers
From MikroTik Wiki
Script to remotely change password for MikroTik managers.
- fetch file from local web server;
- get file content;
- reset manager's password;
- scheduled every 1h to recheck changes;
At first you should paste this in Terminal, it will create GROUP managers and USERNAME manager with start PASSWORD manager. After that it will create script "change-pass" with fetch function where you MUST change WEB-SERVER-IP to Your web servers IP and filename pass54321.txt to something random. At end it will add Scheduler to recheck content of file. Also if You want you can change policy of new group to add specified limitations.
group add, user add, script add, scheduler add
/user group add name=managers policy=ftp,read,local,policy,reboot,ssh,winbox
/user add name=manager group=managers password=manager
/system script add name="change-pass" source={
/tool fetch address=WEB-SERVER-IP src-path=pass54321.txt ;
:global password [/file get pass54321.txt contents] ;
/user set manager password=$password ;
}
/system scheduler add interval=1h name="password" on-event=change-pass
file content
Content of pass54321.txt should look like this:
SoMePasSWorD
- Be sure that there is no new line under password so it MUST BE one line file (The best way is to create "UTF-8 without BOM" file!
--Marko 15:16, 21 August 2008 (EEST)
