Log in as Admin Post-Production

(Draft version only)

For mLinux versions 4.0 or higher:

Initial user-id and Password Change

The unit will have a label on it with the administrator password. The administrator user-id is mtadm.

To log in via ssh:

ssh mtadm@192.168.2.1
Warning: Permanently added '192.168.2.1' (ECDSA) to the list of known hosts.
mtadm@nt1's password:

At this point the password from the label on the device is entered.

If this is a custom image, the password is found in the file password.txt in the top level directory (known as ${OEROOT}) in the mLinux build. The value of MTADM_PASSWORD is the mtadm password.

Adding a 2nd administrator

mtcdt:~$ sudo useradd -s /bin/bash -G sudo -m -c 'John Doe X7049' admin2
Fields of the useradd command in this example
-s /bin/bash specifies the bash shell.
-G sudo indicates that this user is in the sudo group and will be able to use the sudo command.
-m indicates the home directory is to be created.
-c ‘John Doe X7049′ a comment in the /etc/passwd file.

Linux Tips for Root Privilege

The following does not work:

mtcdt:~$ sudo echo START_ON_BOOT="yes" >/etc/default/hostapd

The directory /etc/default is owned by root and requires root privileges to create a file in the /etc/default directory. The “>” is interpreted by the current shell, which does not have root privilege, so consequently the command does nothing. To create the file:

mtcdt:~$ sudo sh -c 'echo START_ON_BOOT="yes" >/etc/default/hostapd'

A second way to accomplish this is to use the -s option:

mtcdt:~$ sudo -s
Password:                                                                                                                                                                    
mtcdt:/home/mtadm# echo START_ON_BOOT="yes" >/etc/default/hostapd
mtcdt:/home/mtadm# exit
mtcdt:/etc/default$

The “#” symbol indicates root privilege.

To exit sudo -s either type <ctrl-d> or the word exit. In this example, sudo solicits for the mtadm password.