FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

12671 questions

15052 answers

24115 comments

47054 members

0 votes
515 views 1 comments
by

Hello,

I would like to automate the configuration of the Teltonika RUT955 using a Python script. I am using UCI commands to retrieve the session token, get information, set configurations. The only problem I'm facing is setting the default password.

I'm aware that you can edit the pass_changed value in etc/config/teltonika to "skip" setting the default password, but I would like to set it myself. As I've heard, there isn't an option for setting this value using UCI commands, but you can set this password using the passwd command via ssh. Another option I'm considering is using Selenium to set the administrator password.

So, is there any other way for setting the default administrator password, and what method do you recommend?

Thanks in advance!

3 Answers

0 votes
by

Resolved this by executing a ssh-command in Python:

username = 'admin'

ip = '192.168.1.1'

options = '-o StrictHostKeyChecking=no'

cmd = 'passwd'

ssh_cmd = 'ssh %s@%s %s "%s"' % (username, ip, options, cmd)

os.system('ssh-keygen -R '+self.ip)

child = pexpect.spawn(ssh_cmd, timeout=30) 

child.expect(['[pP]assword: '])                                      

child.sendline(current_password)  

child.expect(['[nN]ew [pP]assword: '])              

child.sendline(new_password)  

child.expect(['[rR]etype [pP]assword: '])                        

child.sendline(new_password)  

child.expect(['passwd:'])

child.close()

Best answer
0 votes
by

Hi Peetha,

I have been also working on automating the configuration of the the device I am using which is the RUT240.

I normally set all the configurations(including the password) I want to have on one of the devices and generate a backup file from it.

Then to automate the configurations of the devices, I just ssh to each device and apply this backup file which will update all the configurations including the password. To apply a backup file, you can use:

sysupgrade -r <BACKUP_FILE>

That is the way I am using so far and it works well for me.

by
Hi Jk_AllTheWay,

Thanks a lot for the response! The solution you have is a great idea, but not that well suited for my situation. I have several configuration values that are dynamically given, so different per router.

Using the backup file got me thinking about using a combination of a backup file and some UCI commands.

Thank you!
0 votes
by

Hello.

As I can see you already received a lot of different examples of what can be done via different methods.

From our side, we can offer any other solution than the ones incorporated in the built in firmware, as any other methods are reserved or simply blocked by the security built in the device.

A method that is often used by our customers is to use the Free RMS credit that all of our devices have from factory and then use the RMS API to automatize some setups.

I will leave you with some useful links

https://wiki.teltonika-networks.com/view/RMS_API

https://www.youtube.com/watch?v=J3HSM2LP-k0