Home-> Nokia N810->Command Line

(DGH) updated Wed Aug 20 14:11:34 2008

At some point, you'll likely want to do something that requires command-line access. This page is about making that easier.

Root Account

Consider installing the rootsh package. This will allow you to sudo gainroot to temporarily acquire root privileges as needed, when logged in as a normal user. This is generally considered to be nicer than logging in as root directly. (If you are using an xterm on the device itself, there is no way to log in as root directly; you always start as user "user".)

SSH

In the application manager, you'll see three installable packages: openssh-client, openssh-server and openssh. The last one is what you want; it'll drag in both client and server as prerequisites.

The openssh-server install will ask you for a root password. Pick a strong one; you will not have to type it on the N810 keyboard after this once.

The installation process takes a long time (10min?) due to CPU-intensive key generation, I think. Do not think it has gotten stuck or interrupt it, even if it looks like the progress bar is going nowhere. It will eventually finish. (Okay, if it's been half an hour and it still isn't done, then maybe it's stuck.)

Now you can SSH in to your device as user root with whatever password you chose earlier. If you are on a UNIX-alike, you already have OpenSSH or maybe Dropbear. For Win32, try PuTTY instead.

Note that your N810 does not have a sensible hostname yet (even though it looks like you set one during the initial setup wizard). We'll fix that in a minute, so you'll be able to use your DHCP-pushed DNS updates to talk to your device by name. For now, use Settings->Connection manager then from the menu, choose Internet Connection->IP address to get your IP. Sample command line (for openssh):

ssh root@192.168.12.123
(replace 192.168.12.123 with the N810 IP you discovered above).

Hostname

Now that you can get to a command line as root, fix your device hostname by editing /etc/hostname and /etc/hosts. Replace the default hostname (which is something like Nokia-N810-32-37) with your choice.

Remember that on many networks, your device hostname will be used as a DNS name. This is extremely useful, so choose a hostname which is a valid DNS name; if you don't, you'll either not get a DNS entry, or you'll get an invalid one, or you'll be denied a DHCP lease.

[WARNING]DNS names have to start with a letter, end with a letter or digit, and contain nothing other than letters, digits and dashes. Underscores are right out. See RFC 1034 section 3.5 if you need convincing.

Remember that the /etc/hostname file is read at boot time, so you'll need to reboot before it takes effect. Use the hostname command from the command line (as root) to make an immediate change that'll last until next boot.

User Account

Right now, your N810 has two accounts for interactive users: root and user. The user account is a special role account for a user in physical posession of the device using the local console. So, it is probably a good idea to create another non-root, non-special user for routine ssh logins. Example commands (to be run as root):

useradd -g users -d /home/joe joe
passwd joe
mkdir /home/joe
chown -R joe.users /home/joe

After doing the above, you should be able to ssh in as the new user. If you installed the rootsh application, you probably want your new user to be able to sudo gainroot. To accomplish this, find the line in /etc/sudoers that controls the use of /usr/sbin/gainroot, and add your new user to the comma-seperated list at the start of the line. (Example: original "user" becomes "user,joe" -- all without the quotes, and with no spaces.) When I installed OS2008 Feature upgrade (4.2008.30-2), it overwrote my /etc/sudoers file and I had to do this step again.

Finally, once you have tested that you can log in and gain root as the new user, it may make sense to disable root logins via SSH. Edit /etc/ssh/sshd_config and change the PermitRootLogin from yes to no. To have this change take effect, kill -HUP the /usr/sbin/sshd process.