[SATLUG] Monitor res in Ubuntu 10.04

Bruce Dubbs bruce.dubbs at gmail.com
Sun Jan 9 20:41:53 CST 2011


Robert Pearson wrote:

> [CLI (Command Line Interface) Tips & Tricks]
> As a general rule I always either use "sudo" in front of all commands
> or, for extended sessions, I do "sudo su -" for a "root" window any
> time I am working outside of my "echo $HOME" directory. "root" will
> then own all changes. If there is a conflict you can always "sudo" and
> change "root" ownership and permissions to individual ownership. I
> find this saves me a lot of grief and confusion.

As an aid, you may want to change ~/.bashrc for each user, including 
root, to add:

NORMAL="\[\e[0m\]"
RED="\[\e[1;31m\]"
GREEN="\[\e[1;32m\]"

if [[ $EUID == 0 ]] ; then
   PS1="$RED\u$NORMAL@\h$RED [ $NORMAL\w$RED ]# $NORMAL"
else
   PS1="\u$GREEN@\h$GREEN [ $NORMAL\w$GREEN ]\$ $NORMAL"
fi

or some variation of that.  It highlights the prompt when you are root 
as a reminder.

> Ctrl-Alt-BackSpace - Will kill the X server process in an orderly
> fashion. This is a quick, easy, legitimate way to restart X. Note it
> does not restart the display manager (if used) -- just X itself.

For newer systems this is not set by default.  You may need an xorg.conf 
file to set it.

Section "ServerFlags"
   Option "DontZap"  "No"
EndSection

> Ctrl-Alt-Fx - where "x" corresponds to a valid tty number (typically
> 1-6). This is typically used to jump to a text console login, while X
> remains running. To get back to X, then it is "Alt-Fx". In this case,
> "x" represents one plus the last tty (e.g. Alt-F7 if there are six
> available ttys).

The number of consoles is normally 6, but you may want less in some 
cases for security.  For an sysvinit based system, it is set in 
/etc/inittab:

1:2345:respawn:/sbin/agetty tty1 9600
2:2345:respawn:/sbin/agetty tty2 9600
3:2345:respawn:/sbin/agetty tty3 9600
4:2345:respawn:/sbin/agetty tty4 9600
5:2345:respawn:/sbin/agetty tty5 9600
6:2345:respawn:/sbin/agetty tty6 9600

Just remove the lines you don't want.  Your system may have a different 
getty, e.g. mingetty.

On ubuntu, each virtual console is in a separate file: /etc/event.d/tty?

> [Does Logout restart X?]
> Re: Is a logout/login the same as restarting X?

Depends on the run level.  Generally run level 5 will not restart X, but 
restarts the graphical login manager.  I prefer run level 3 which starts 
at the command line.  X is started with the startx command.  In this 
case, X is restarted upon logout and login.

> Logging out does not restart X. To restart X you have to
> ctrl+alt+backspace or "sudo killall gdm", for example. Conversely
> though, killing X will log out all users who have logged in through
> GDM. (gdm/GDM=Gnome Display Manager)
> [End Does Logout restart X]
> 
> Both "Reboot (init 6)" and "Shutdown (init 0)" perform a "Logout"
> before stopping all the system processes.
> 
> [A Really Interesting Use of X Display Managers]
> 3.2. Display Managers
> The other, more common, approach is the "GUI log-in", where X is
> running before log-in. This is done with the help of a "display
> manager", of which there are various implementations. XFree86 includes
> xdm (X Display Manager) for this purpose, though your distribution may
> use one of the others such as gdm (GNOME) or kdm (KDE).
> 
> Display managers really do much more than enable GUI style log-ins.
> They are also used to manage local as well as remote "displays" on a
> network. We won't get into details on this here, but it is nicely
> covered in the Remote X Apps Mini HOWTO and the XDMCP HOWTO (see the
> links section). For our purposes here, they provide similar services
> to getty and login, which allow users to log into a system and start
> their default shell, but in a GUI environment.

Note that XDMCP is a security problem.  A password goes on the network 
unencrypted.  I recommend ssh.  If you need to run a graphical program 
over ssh, that can be configured, but both the client and server need to 
be enabled.

   -- Bruce


More information about the SATLUG mailing list