HowDoiBecomeRoot2

format wiki

language en

A faster way to get root access on Nokia 770 (And no need for R&D mode)

Note: this has been tested on OS 2006.

(Update 23/Jan/07: Tried and tested on N800, works fine but obviously requires you to have dropbear SSH server and client as well as X terminal installed, you can't do it remotely you have do ssh the unit from itself, after that follow the instructions to modify getroot).

Step 1: Point your browser to Xterm DEB and then to Dropbear DEB and grab latest Dropbear version (if you have installed ssh or openssh, you will have to uninstall them first). Wait for the installation to complete and...

Step 2: Connect to your wireless lan;

Step 3: SSH from your computer to the 770:

ssh root@aaa.bbb.ccc.ddd <- change this to the ip address assigned to your 770

or from the 770 to itself:

dbclient root@127.1

if dbclient doesn't work, you can use:

ssh root@localhost

Step 4: When requested use "rootme" as password;

At this point you should have gained root access to your device.

One alternative now is to 'fix' the original /usr/sbin/gainroot script to not to check for R&D mode and allow root everytimes. You can edit line

MODE=`/usr/sbin/chroot /mnt/initfs cal-tool --get-rd-mode`

to be

MODE=enabled #`/usr/sbin/chroot /mnt/initfs cal-tool --get-rd-mode`

You can use vi editor for this, enter

# vi /usr/sbin/gainroot

position cursor at '=' character, press 'a' key, enter 'enabled #', press Esc key and save and exit with 'ZZ' command (shift + zz). The edited line may look garbled but it is OK. CTRL+L refreshes screen in vi so you can double check before saving.

From now you can use the intended way how to gain root on the device in R&D mode without having to set it.

$ sudo gainroot

Another alternative is below.

Set the password for 'user':

   passwd user

Note: when typing a password nothing will be shown on the screen.

Now, for the future, unless you want to keep SSH-ing from another machine, a clever move is to add "user" to sudoers:

   echo "user ALL = PASSWD: /bin/su" >> /etc/sudoers

this way your password will be asked in order to become root. Or

   echo "user ALL = NOPASSWD: /bin/su" >> /etc/sudoers

in order to become root without having to type your password. Please keep in mind that password will be cached, so you won't have to type it every time you need to sudo.

Note that if you require a password to become sudo, some built-in apps (notably Application Manager) will appear to not load while they wait silently in the background for the password to be entered. The can be avoided by running a command in the xterm with sudo prior to lauching the app, so as to appease sudo when the OS calls it.

Ok, from now on all you have to do, in your Xterm session, to get root is to write:

sudo su -

that's it? uh no it isnt...

You *****MUST***** change (or disable) your root password before continuing!! Else you will be walking around with a device that can be accessed using a TRIVIAL and well known password.

To change root password (as root user):

passwd

when asked input (twice) your new password.

To disable root login (highly suggested) after you gained access as root user:

passwd -l root

In this case, from now on you won't be able to login as root user, nor from ssh neither from local. To gain root:

sudo su -

comments and questions maddler


Disabling root login when using dropbear

If you are using dropbear as ssh server, you can disable root logins via ssh: just add the option "-w" to DROPBEAR_EXTRA_ARGS in /etc/default/dropbear:

DROPBEAR_EXTRA_ARGS="-w"

After that, restart dropbear:

/etc/init.d/dropbear restart

A remote root login via ssh is then no longer possible. So you have to use the "user" account (you should give the user a password beforehand).


For Windows users

Obviously the same trick works also in Windows, but you have to use a (free or commercial) SSH enabled client: (like Absolute Telnet,SecureCRT, PuTTY, etc...)