How to change root password

Hi,
I have Connect ME 9210 -C and I need to change root password from standard one to my defined. I cant change it in console because my SW use SPI. How can I do that?

I tried to run

rc = NAsetSysAccess(NASYSACC_DEL, “root”, NULL,NASYSACC_LEVEL_ROOT, NULL);

but it always fails.

Some ideas?

Jirka

Hi,

The root password is stored in the Non Volatile structure that holds the board parameters.

Look in the help system for the “Development Board Parameters” section for details.

You need to use “customiseReadDevBoardParams()” to read the complete structure into RAM, then update the right field in the structure and use “CustomizeWriteDevBoardParams” to write it back again.

The harder part is setting up a user interface to do this. If you do not have access to the serial interface, you should be able to do it over Ethernet using the Telnet CLI interface, or you could do it via a web pahge.

I gave up years ago on NetOS’s mixed up password system. I handle it myself and intercept the call:

// Handler for all passwords (NASYSACC_LEVEL_ROOT is a mask)
naSysAccessSetAuthHandler(_NaSysAccessExtHandler, NASYSACC_LEVEL_ROOT, (unsigned long)NULL);

 
 // bsp/common/sysAccess.c
//extern "C"
int _NaSysAccessExtHandler(char * username, char * password, 
							NAIpAddress_t * ip_addr_ptr, 
							unsigned int protocol, unsigned int level, unsigned long user_data)
{
	if( !bUserDBInit ) LoadUsers();
	//printf("Testing Login \"%s\":\"%s\"
", username, password);
	if( !strcmp(username, "root")  )
	{
		if( !strcmp(password, "myrootpassword") )
			return NASYSACC_PASSWORDOK;
		return NASYSACC_INVALID_PASSWORD;
	}
		
	int i;
	for(i = 0; i < NASYSACC_MAX_ACCOUNTS; ++i)
	{
		if( (Users\[i\].capability & level) == level )
		{
			if( !strcmp(Users\[i\].username, username) )
			{
				if( !strcmp(Users\[i\].password, password) )
				{
					return NASYSACC_PASSWORDOK;
				}
			}
			return NASYSACC_INVALID_PASSWORD;
		}
	}
	return NASYSACC_INVALID_USERNAME;
}



I didn’t bother with my user database because it is obvious.

-Erik

P.S. One of these years, the code insert bugs in this forum need to be fixed.

Hi I trying
to set password via this

devBoardParamsType params;

rc =customizeReadDevBoardParams(&params);
strcpy(params.rootPassword, “heslo”);
rc = customizeWriteDevBoardParams(&params);

In second read is the rootPassword is set to “heslo”.
but after reset the first read is again the old password. Booth rc is zero.

So what is wrong?

Jirka

Have you tried:

rc = NAChangePassword("root", newPassword);

Hi,
this

devBoardParamsType params;

rc =customizeReadDevBoardParams(&params);
strcpy(params.rootPassword, “heslo”);
rc = customizeWriteDevBoardParams(&params);

is working well. The problem was simply. Before debugging your app the IDE ask you for load default settings (yes/no) and some time before I hit yes and dont show again. So it always rewrites the NVRAM params…

Jirka