Department of Computing Imperial College London
Q&A on Linux: login and environment

How do I reboot a Linux machine?
How do I change my password?
How can I set the window manager I use on login?
How do I ask X what the current screen size and resolution is?
What path should I use?
Can I change my shell?
How can I change my default editor?
How do I include the current directory in my path?
If I've gone over quota how can I log in to remove files?
Alarming message when I tried using ssh?
How can I make the imwheel process start automatically?
I am unable to start KDE from the KDM logon window.
What does Xauthority do?


How do I reboot a Linux machine?

First of all, there's no good reason for rebooting Linux-only machines. Contact the help desk if the machine appears to not be working.

If the machine is a dual-boot machine, assuming the system is asking you to log in, click the "System" menu on the login box and select "Reboot".

How do I change my password? Top of page

Type:

passwd
and follow instructions. Remember that your password must be a combination of upper case, lower case, numbers and punctuation characters. Simple, guessable, passwords are not allowed.

What path should I use?

If you're a taught student, meddling with your path is likely to cause highly undesirable effects, including not being able to submit lab exercises and other scripts not running as expected. You may want to prepend items to the front of your path... an incantation such as:

setenv PATH /homes/aaa99/private/bin:$PATH

...in your .cshrc is fairly safe.

Wholesale redefinition of the path is really not something we like to suggest though. Note that the systemwide /usr/local/etc/default.cshrc sets this (and many other things) up for you.

How do I include the current directory in my path?

The "." directory was withdrawn from the default path at the request of the Lab Organisers. If you want to restore it put:

        set wantdotdir
at the beginning of your .cshrc file.

Can I change my shell? Top of page

The default shell you use (tcsh) is defined in our user database. Software installed by the Lab Organisers, including the exercise and submit scripts, may not work with other shells. We will not be able to support any software problems you may have with other shells so if you ask us to change yours please be absolutely sure.

Alarming message when I tried using ssh? Top of page

If you use ssh to connect to a machine which you have not used in a while, it is possible the machine may have been re-installed in which case you would see the following message:

-----------------------------------------------------------------------
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@       WARNING: HOST IDENTIFICATION HAS CHANGED!         @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle
attack)!
It is also possible that the host key has just been changed.
Please contact your system administrator.
Add correct host key in /homes/username/.ssh/known_hosts2 to 
get rid of this message.
Agent forwarding is disabled to avoid attacks by corrupted servers.
X11 forwarding is disabled to avoid attacks by corrupted servers.
Are you sure you want to continue connecting (yes/no)?
-----------------------------------------------------------------------
The solution is to respond 'no', then delete the line referring to the computer name in your .ssh/known_hosts file. ssh will create a new record when you try again.

More.

How can I change my default editor?

In order to change your default editor, you need to add the following:

setenv VISUAL editor-name
setenv EDITOR $VISUAL

to the end of the file .cshrc in your home directory, replacing editor-name with the name of your desired editor.

More info here.

How do I ask X what the current screen size and resolution is?

You can try:

xwininfo -root
which returns the width, height and depth among others (and geometry), or
xdpyinfo | grep dim
which shows both the resolution and screen size in mm.

How can I set the window manager I use on login?

Create a world readable file called .wmrc in your home directory and put a single line describing the window manager you want to use. I've done this myself - have a look at ~dwm/.wmrc for an example.

How can I make the imwheel process start up automatically?

A good way to achieve this would be to add:

killall -9 imwheel
/usr/X11R6/bin/imwheel &
to your ~/.xsession file after the line:
if [ "$NTLOGIN" = "" ]; then

I am unable to start KDE from the KDM logon window. Top of page

I've seen this problem before - it looks like KDE is trying to restart a session that depends on files stored on another machine. The only way we found to clear the problem was to clear all the kde2 settings. Trying logging in in text mode (ctrl-alt-f2 to select the 2nd text console, ctrl-alt-f7 to return to X), and running 'mv .kde2 old-kde2'

When you next login in X, your KDE settings will be reset, and it should work again. If it works, and you've copied any files you want to out of the old-kde2 directory, you can remove the old settings.

What does Xauthority do? Top of page

It determines whether or not someone should be allowed to open X-connections onto a particular DISPLAY. Anyone can setenv DISPLAY to, for instance, picard:0 (my machine's display). But how does X check whether or not to grant an incoming X connection request to allow me on any machine to display X-apps on my screen but noone else to be able to pop up irritating windows on my screen, or screengrab my screen etc? Originally, X implemented a host-based access system, whereby the genuine logged-onto-the-console user could say xhost +shell1 to say "trust anyone on shell1", or xhost + to say "trust everyone everywhere". But that's really poor because it doesn't even attempt to track me on different machines, so they introduced the Xauthority file and xauth utility.

Basically, the X server allocates a random secret key string when it starts a new session, and arranges to place (DISPLAY, KEY) in the user's .Xauthority file (along with many other (DISPLAY,KEY) pairs). Then, ignoring ssh, if I remotely login (telnet or rlogin) to any other machine with a shared home directory, set my DISPLAY environment variable to the right value - eg. picard:0 (some telnet/rlogin apps set this automatically) and run a random X client program (xterm, say), then the X library will open the .Xauthority file, read the matching (DISPLAY,KEY) pair out of it, and will then include the KEY in the network communication it starts to make with the X server mentioned in the DISPLAY. The X server knows the secret key, and if the X client passes across the matching string then it must have read it from the .Xauthority file, ergo, permission should be granted. This does assume that NFS is robust with respect to file permissions and user authentication, which may or may not be wholly true these days.

ssh adds an extra layer of security by not only encrypting all the remote access traffic, and arranging to pass the DISPLAY string automatically, but setting up (when enabled) an encrypted separate connection for X traffic to be tunnelled through. It does this by changing the DISPLAY string from picard:0 to shell1:37 or some such, whereby the ssh daemon on shell1 knows that shell1:37 is an X tunnel to picard:0. But to do this, ssh has to modify the .Xauthority file, hence the possibility of race conditions, locking problems etc.

© CSG / 2003