Root access
OK, first, the disclaimer:
~+**Doing whatever is stated on this page is not endorsed by Nokia in any way.
Warning: There have been reports of display failures (white with dim vertical stripes) after disabling rd mode and rebooting a new 770. If you get this, there is a hardware failure in your device and you need to return it and get a replacement.
Screenshot added: Cracked screen; Screen bug Post. --Aswarp 060802
Contents
|
The straightforward way
1 ) Install the becomeroot package.
Install the becomeroot package. I found this by searching http://gronmayer.com/it/ .
2 ) Run sudo gainroot
.
From the shell run sudo gainroot
. This will give you a root shell.
This package works in the simplest possible way: the application gainroot is added to /etc/sudoers to be run without prompting for a password, and all it does is set the path to something sensible and run /bin/sh.
(I don't know what all the other stuff on this page is for: this is simple and works easily.)
The 'easiest' way (install dropbear)
Step 1: Install Xterm and Dropbear
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: SSH to your Internet Tablet
Option A: Via LAN
ssh root@aaa.bbb.ccc.ddd <- change this to the ip address assigned to your Internet Tablet
Option B: Via Local Access
ssh root@localhost
When requested use "rootme" as password (this is the factory default root password)
Step3: You Have Root, BUT
At this point you should have gained root access to your device, and be looking at the root prompt:
#
However, if your wi-fi network is not password protected, so might anyone else near you who has Wi-Fi, SSH and a clue.
You still need to secure your own future root-level access.
You also still need to secure the root account -- "rootme" is a terrible password, and direct root log-in access is not necessarily required.
Step 4: Secure Future Root-Level Access
Option A
'Fix' the original /usr/sbin/gainroot script to not to check for R&D mode and allow root everytime.
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
Option B
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 -
Step 5: Secure the Root Account
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.
Option A: If you elect not to disable direct root logins
To change root password (as root user):
passwd
...when asked, input (twice) your new password.
It is still recommended to limit root logins to local console only in most cases.
Option B: To disable root login (highly suggested)
NOTE: Do not perform this step without having completed Step 4A or 4B.
After you gained access as root user:
passwd -l root
In this case, from now on you won't be able to login directly as root user -- not from ssh and not from the local console.
To get a root prompt:
sudo su -
comments and questions [/WilliamMaddler|maddler]
Step 6: Disabling root login when using Dropbear
This step is semi optional. Definitely recommended for most installations, though.
When 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).
Step 99: For Windows Users Only
Obviously the same trick works also in Windows, but you have to use a (free or commercial) SSH enabled client:
- Absolute Telnet
- SecureCRT
- PuTTY, etc...
The R&S way (Nokia 770 only) (Linux or Mac OS X needed)
You can enable the Research & Development mode (R&D or RD mode) on the 770, which enables you to execute sudo gainroot
to get a root shell.
NOTE: The currently availiable Nokia flasher version (as of 30 March 2006) assumes that usbfs is mounted on /proc/bus/usb, but usbfs is deprecated and has been dropped on most newer Linuxes. If you find that flasher doesn't recognise that the device is connected and you have a kernel version >= 2.6.15, this is probably the issue.
- Download the Linux or Mac OS X flasher from
- Ensure it's executable:
chmod a+x "flasher..."
- Switch off the Nokia 770
- Unplug it from a charger
- Connect it to your computer via USB directly (hubs can prevent the flasher from detecting the device)
- From your computer: As root, or using
sudo
, execute./flasher <del>enable-rd-mode </del>reboot
- "Suitable USB device not found, waiting" is displayed on the console
- Switch on the 770 using the power button while holding down the home button I did not touch the home button and proceeded successfully -- 2005-12-27 --RickHull It worked for me after disabling the device lock -- 05/04/06 Florian I did it without the home button as well and it worked OK for me too. -- 3/26/06 -- Bill B. Well, I just did it for the first time with my one-day-old tablet, and I did have to press the home button. Otherwise, the device booted normally, and no messages came from the flasher utility (from Mac OS X). When pressing home, you get the icon for the "system settings" (a wrench over a tablet) right under the big blue NOKIA logo at boot up. The USB logo appeared in the top-right corner of the screen on both boot-ups, the normal one and the one with the home button. -- [AlbertoGonzalezPalomo]
- Whilst it powers on you'll see additional debug information.
- The flasher program will now tell you something like: USB device found at bus 001, device address 004 Found board Nokia 770 (F5) NOLO version 0.9.0 The device is now in R&D mode I had to pull the USB cable at this point before the unit rebooted. -- 2006-03-29 -- [NealMcBurnett] Me too -- 2006-04-01 -- N7DR
- If not already done install an xterm on the 770
- Open the xterm and execute
sudo gainroot
You will probably get a scary message pointing you the possibility of breaking your device doing so. Ignore it ¿? - Try this if it doesn't work:
sudo /usr/sbin/gainroot
That's it. If you get the error, "Error claiming USB interface: Operation not permitted", it means you've forgotten to run the flasher as root. It is possible to encounter other errors (even if invoked as root) that may be caused by timing issues. For more information and a possible solution, go to the following maemo-developers thread.
Once becoming root, in order to easily become root without needing to be in R&D mode, modify the gainroot script (located in /usr/sbin/gainroot) to only invoke the shell (i.e. /bin/sh) or modify /etc/sudoers to make something like su sudo-capable. (IT'D BE NICE IF someone uploaded samples of the original and the modified file to the wiki at this point) Modifying gainroot is likely an easier option for novice users and should be accomplished by commenting out (i.e. prepending lines with a #) the check if R&D mode is enabled. More specifically, after the "PATH=..." line, comment out the following lines except for the /bin/sh line.
BEFORE
!/bin/sh -e
trap exit SIGHUP SIGINT SIGTERM PATH=/bin:/user/bin:/sbin:/usr/sbin MODE='/usr/sbin/chroot /mnt/initfs cal-tool --get-rd-mode if [ xMODE=xenabled]then'echo"Root'shell'enabled"/bin/sh'else'echo"Enable'RD'mode'if'you'want'to'break'your'device"fi</pre><del>AFTER</del><pre>#!/bin/sh-e'trap'exit'SIGHUP'SIGINT'SIGTERM'PATH=/bin:/user/bin:/sbin:/usr/sbin#MODE='/usr/sbin/chroot/mnt/initfs'cal-tool--get-rd-mode#if[xMODE = xenabled] #then # echo "Root shell enabled" /bin/sh #else # echo "Enable RD mode if you want to break your device" #fi
There are a couple of possibilities for modifying gainroot or /etc/sudoers, both of which require xterm: * The file can be copied to another system (via USB or scp as examples), modified on the system, and copied back. In order to use USB, it will first be necessary to copy the appropriate file to the memory card using something like: cp /usr/sbin/gainroot /media/mmc1
. A similar cp command (cp /media/mmc1/gainroot /usr/sbin
) would be used to copy a modified gainroot file back. MMC is disabled while USB cable is connected. I had to power down, disconnect, reboot and become root again to copy the file to the MMC. -- 3/26/06 -- Bill B. I just had to unplug the USB cable when using the MMC locally, and plug it back in to access it from my PC -- [NealMcBurnett] * An editor can be used on the 770 itself to modify the file, such as vim or joe. Novice users may find joe to be easier to use than vim. I couldn't get VIM or Joe to run -- they installed, but I could not find them. Maybe a newby thing? You can always email the gainroot file to yourself on another PC, edit it, and email it back. -- 3/26/06 -- Bill B. (_as with most user-installable utilities, make sure /var/lib/install/usr/bin is in your PATH-hczim_)*How''Do'I'Become'Root-without'using'a'text'editor(backing'up'gainroot'before'modification):<br/>`cp-p/usr/sbin/gainroot/usr/sbin/gainroot~&&sed-i1,/PATH=/!s/^/#/;/sh/s/#//' /usr/sbin/gainroot* How Do I Become Root - without using a text editor (by enabling sudo for all user commands):<br />
cp -p /etc/sudoers /etc/sudoers~ && echo user ALL = NOPASSWD: ALL >> /etc/sudoersOnce root access has been granted, it is recommended to disable R&D mode. This can be accomplished by following the same instructions as for enabling R&D mode but using
./flasher <del>disable-rd-mode </del>rebootinstead. - --- Spanish translation / Traducción al castellano (Skip for the rest of the english text, including "The hard way of gaining root")