Howto: change default user

From andLinux

Jump to: navigation, search


How to change the default user

The andLinux startup scripts will eventually invoke a script at /usr/bin/X11/startwindowsterminalsession. The last lines of this script are

 termcommand=`cat /etc/winterm`
 sux - root ${termcommand}

The root user is the default user for launching programs on the andLinux VM. To change the default user, you need to replace the user name in this file, and restart andLinux. However, there is a catch. If you are replacing root with a non-privileged user, the daemon will not be able to open port 81 (the default, recall) for listening, because the first 1024 ports require super-user privileges to access.

So to replace root with some other privileged user simply requires changing the name, while replacing it with a non-privileged user requires more work. We'll create a user joachim for our example.

Step 1: Create the user

 root@andLinux:~# adduser joachim
 Adding user `joachim' ...
 Adding new group `joachim' (1001) ...
 Adding new user `joachim' (1001) with group `joachim' ...
 Creating home directory `/home/joachim' ...
 Copying files from `/etc/skel' ...
 Enter new UNIX password:
 Retype new UNIX password:
 passwd: password updated successfully
 Changing the user information for joachim
 Enter the new value, or press ENTER for the default
       Full Name []: Joachim von Paderborn
       Room Number []:
       Work Phone []:
       Home Phone []:
       Other []:
 Is the information correct? [y/N] y

If you are creating a privileged user, you'll need to do more than this--you'll want to override the userid, setting it to 0, or create an administrative group and add the new account to it. For the rest of us, it's probably enough to create a "plain old user" and then give them sudo privileges with visudo.

Step 2: Change the name used by andLinux

Now you'll need to edit the /usr/bin/startwindowsterminalsession file. Change the last lines from this:

 termcommand=`cat /etc/winterm`
 sux - root ${termcommand}

to this:

 termcommand=`cat /etc/winterm`
 #sux - root ${termcommand}
 sux - joachim ${termcommand}

Note that if you created joachim as a privileged user, you are done at this point. But you didn't, so keep reading.

Step 3: Change launcher port

Now you need to change the port number used by the launcher, because non-privileged logins cannot access port numbers below 1k. First, edit the /usr/local/sbin/ script. At or near line #10, you will see:

 $sock = new IO::Socket::INET(LocalPort => 81, Reuse => 1, Listen => 20) or die("Error creating local socket: $@\n");

Change the LocalPort from 81 to some other value. For this example, let's use 8181:

 $sock = new IO::Socket::INET(LocalPort => 8181, Reuse => 1, Listen => 20) or die("Error creating local socket: $@\n");

At this point, the script is fixed but nothing will happen until you restart the andLinux server. Just run reboot and let's fix up the Windows side.

Step 4: Change port used by Windows launcher apps

As documented here, the default andLinux configuration expects the andLinux VM to be at IP address and expects the script to listen on port 81.

From the Windows desktop, select Start → Run... then enter regedit in the Run dialog box. Browse the registry tree to open a registry key called HKEY_LOCAL_MACHINE\SOFTWARE.

At this point, you will have to right-click on the SOFTWARE entry, and select New > Key. Create a new key andLinux then right-click the andLinux key to create a new key Launcher beneath it. Finally, right-click to create two new entries below \HKEY_LOCAL_MACHINE\SOFTWARE\andLinux\Launcher:

 New > String Value
 Rename this value "IP"
 Double-click "IP", and set the "Value data" to ""
 New > DWORD Value
 Rename this value "Port"
 Double-click "Port" and set the "Value data" to 8181. Be sure and choose "Decimal" for the base.
 Exit the registry editor.

At this point, your Windows launchers will connect to andLinux using, instead of the default ...:81. Your VM should have finished rebooting, so start the andKonsole launcher as a test.

Seen a page that contains spam or objectionable material? Please report the link and/or login of the author to david @ andLinux . org (remove spaces)