University of California at Berkeley Department of Electrical Engineering & Computer Sciences Instructional Support Group /share/b/pub/xwindows.help /share/b/pub/exceed.help Sep 13 2013 XWINDOWS ON UNIX COMPUTERS CONTENTS: What is XWindows? XWindows Security <---- IMPORTANT! XWindows from Home XWindows on PCs: Xming and Exceed XWindows on Macs: X11, XQuartz XWindows on UNIX: CDE, XDM/TWM, .xsession, Gnome XWindows Fonts XWindows Troubleshooting: 'locale', Magic, IRSim, Exceed Vista 64: Xming, Exceed, and Cygwin's Xwin don't work Exceed Campus License and non-UCB Students What is XWindows? ----------------- XWindows is the windowing system common to UNIX computers. You can run a program on a UNIX computer and display its windows on another computer. It allows programs running on the UNIX computer to pop up interactive windows on a remote computer screen. The remote computer just needs to be running an XWindow server, which is sometimes called a "manager". Some XWindows managers include Xming and Exceed on MS Windows, CDE and XDM on Solaris, XFree86 and KDE on Linux, and X11 on MacOSX. Some XWindows programs that you can run on UNIX include "xterm", "xclock", "xfig", "xemacs", etc. Applications such as "emacs", "matlab" and "hspice" also use XWindows. XWindows Security <---- IMPORTANT! ----------------- XWindows servers require attention to network security. They can allow hackers to connect to your computer through unprotected network connections, and the hackers then can take control of your mouse and keyboard and record all of your keystrokes, including passwords that you may type. To prevent this on a Microsoft Windows: 1) Configure the firewall on your PC to block all access to XWindows ports. 2) Start Xming (no additional security saettings are needed). OR In Exceed, set access to "no host access", then start Exceed. 3) Login to the remote UNIX computer using Putty with tunneling. 4) Run the X11 commands in that Putty terminal window. The PC thinks the command is coming from the Putty progam on the PC and allows it, despite the firewall on the PC. To prevent this on a Mac, Linux or other UNIX system: 1) Configure your computer to allow only secure connections ('xhost -'). 2) Login to the remote UNIX computer with tunneling ('ssh -X'). 3) then run the X11 commands on your computer. For details about this, please read John Kim's (UCB IS&T) excellent article at http://kb.berkeley.edu/kb1185 For information about the .Xauthority file and the commands "xhost" and "xauth", please see /share/b/pub/security.help XWindows from Home ------------------ Here are basic instructions for displaying the graphics output from a UNIX program to your PC or Mac: 1) Login to the UNIX computer using Putty or SSH with "X11 forwarding" enabled. (Don't use the telnet or xstart programs that come with Exceed.) 2) Start a XWindow manager on your computer. 3) Type an XWindows command like "xterm" in the UNIX window. A new window should appear on your screen. For more information about connecting to our computers, please see http://inst.eecs.berkeley.edu/connecting.html XWindows on PCs: Xming and Exceed --------------------------------- Microsoft Windows computers do not have an XWindows manager by default, but all of the EECS Instructional UCB Microsoft Windows computers have an XWindows manager called Xming. You can download and install Xming on your own PC for free from http://sourceforge.net/projects/xming. You should install 2 packages: xming and xming-fonts For additional help, please see https://inst.eecs.berkeley.edu/cgi-bin/pub.cgi?file=doc/UnixRemoteLogin_Putty.pdf http://www.straightrunning.com/XmingNotes/ Exceed is another common XWindows manager for Microsoft Windows computers that we used until June 2008. But Exceed is overly complicated for our needs, so we now prefer Xming. Exceed is available for free to UCB students and staff from http://cab.berkeley.edu/ and http://software.berkeley.edu. To make Exceed secure, you must alter its default settings. To prevent other people from connecting to your computer through Exceed, open the Exceed "Xconfig" window, select "Security", click on "no host access" and save that (click on "validate"). Then, if an external connection is attempted, Exceed pops up a window asking if you want to allow the connection. However, connection requests from the SSH-based UNIX sessions (with X11 tunneling) pass through because Exceed sees them as coming from the local, internal SSH client program and not from the external UNIX server. More instructions for using Exceed are on-line at: http://inst.eecs.berkeley.edu/cgi-bin/pub.cgi?file=pdf/SSH_EXCEED.pdf http://inst.eecs.berkeley.edu/cgi-bin/pub.cgi?file=pdf/Exceed-USER-dir.pdf Documentation is built in and also can be purchased through Hummingbird. For information about add fonts for Exceed, see: http://www.hummingbird.com/support/nc/jump/ju2000014.html To fix a problem with Exceed, see the Troubleshooting section below. XWindows on Macs: X11, XQuartz ------------------------------ On newer versions of MacOSX, XQuartz replaces the previous X11 package for displaying graphical windows that use the X11 protocol. It can be verified on your Mac by running 'X11' - it will point you to the XQuartz site. You will need to download XQuartz from http://xquartz.macosforge.org/landing/ and run it once (to initialise the XAuthority file) before trying to run 'ssh -X'. Snow Leopard: X11 is now pre-installed under Snow Leopard. By default, X11 server will start when you initiate an X11 client from the terminal. Apps to take a look at /Applications/Utilities/Terminal /Applications/Utilities/X11 Leopard: You will have to install the X11 bundle from the installation DVD. Here is a URL that describes what you need to do. http://www.simplehelp.net/2006/10/22/how-to-install-x11-in-os-x/ XWindows on UNIX: CDE, XDM/TWM, .xsession, Gnome ------------------------------------------------ UNIX computers typically have an XWindows manager by default. XWindows can usually be downloaded for free for older versions of the operating system. The EECS Instructional UNIX workstations have a choice of XWindows managers, with unique windowing features. The "window manager" is the most important choice you have before you login. "CDE" is our standard Motif-style window manager; "twm" is our standard MIT X11-style manager. Here is how they generally appear: 1) CDE has a control panel across the bottom of the screen with a mailbox icon, etc. (Is enabled by the lack of a "SESSIONTYPE=xdm" line in your .dtprofile file) 2) XDM/TWM starts with a single window with the title "Exit from this window to logout" (Is enabled by the existence of a file in your home dir called .xsession and a "SESSIONTYPE=xdm" line in your .dtprofile). Some programs are written for one type of windowing system and work better there. If the documentation for the program does not specify which window manager, then it probably does not matter. Here is a summary of the options on our systems; see below for details. Note that the default files (.dtprofile, .xsession, .twmrc) can be copied from the /share/b/default-named-account directory on EECS Instructional systems. Workstn To get this Type window manager Do this... ======== =============== ================================================= Solaris CDE remove "SESSIONTYPE=xdm" from your .dtprofile Solaris Java Desktop remove "SESSIONTYPE=xdm" from your .dtprofile Solaris twm "SESSIONTYPE=xdm" in .dtprofile; use .xsession Solaris mwm,piewm, etc "SESSIONTYPE=xdm" in .dtprofile; edit .xsession ======== =============== ================================================= These are the alternate window managers available on our systems that can be started from your .xession file: /usr/sww/bin/blackbox -- Blackbox, a small window manager /usr/openwin/bin/olwm -- OPEN LOOK window manager /usr/openwin/bin/twm -- Tab window manager (the EECS default) /usr/dt/bin/dtwm -- CDE window manager /usr/sww/bin/qvwm -- Win95-like window manager /usr/sww/GNUstep/bin/wmaker -- WindowMaker (like NEXTSTEP) /usr/sww/kde/bin/kwm -- K Desktop Environment (on SolX86 only) Selecting your XWindow Manager: On CDE systems, CDE runs first and starts the Motif-style interface by default. CDE has a control panel across the bottom of the screen with a mailbox icon, etc. You can add entries to your .dtprofile to customize the XWindows features you get. Alternative XWindows managers can be started by invoking the XDM session manager instead of the CDE manager. Unlike CDE, the XDM manager reads the file .xsession in your home directory and starts the window manager that ycu specify in .xsession. To run XDM (and .xsession) instead of CDE when you login: 1) Add the line "SESSIONTYPE=xdm" in your .dtprofile 2) Update the .xsession file in your home directory: cp /share/b/default-named-account/.xsession ~/.xsession chmod 755 ~/.xsession 3) Logout and login again. Our default .xsesion file will start the TWM window manager, and you will see a single, simple command line window with the banner "Exit this window to logout". To make that your current window, move the mouse pointer onto the window and click on the left mouse button. To open more windows, move the mouse pointer onto the screen background area and hold down the left mouse button. You can select "xterm" and other options from that menu. The menu is defined in your .twmrc file. To go back to CDE, undo step (1) above. CDE Window Manager: The Common Desktop Environment ("CDE") is a Motif-style window manager that has been adapted as the default window manager for most UNIX systems. You can identify it easily by the "CDE" logo on the login screen. One common feature of CDE under all operating systems is that it reads a file called .dtprofile in your home directory as you log in, and it stores information about your window preferences in a directory called .dt in your home directory. Once you have logged in, CDE often displays a "dashboard", which is a long thin window at the bottom of the screen. The dashboard has icons and pull-up menus which you can click on to start up an editor, a mailer, a tutorial and other programs. It has many configurable options. There a configuration file for the Common Desktop Environment where you can change settings like window borders, fonts, etc. By default, CDE uses the system default config file, which is located in /usr/dt/config/C/sys.dtwmrc You can install a copy for your own UNIX account with the command cp /usr/dt/config/C/sys.dtwmrc ~/.dt/dtwmrc and the ~/.dt/dtwmrc version will be used instead. Then you can edit the ~/.dt/dtwmrc file to change settings. For more information, read the on-line manual page for "dtwm" and related files. You can read the man pages with the UNIX command: man -M /usr/dt/man dtwm XDM Session Manager: The X11 system is also installed on our systems. It allows for user choice, by running a master manager called XDM. Type "man X" for more information. XDM executes a user's .xsession file and starts the window manager and other commands that are found there. "twm" is our preferred X11 manager, although there are others that you can use. Using the .xsession file, a user may run twm or any of a number of other managers, including the Motif-based "mwm". If you are using the default Instructional .xsession file that is installed in new accounts, the "twm" command is executed automatically as you login. The twm command starts the "Tab" window manager. You can bring up a menu of options by pressing the left mouse button. "twm" sets itself up by reading a file called .twmrc if it exists in your home directory. Otherwise, it uses /usr/lib/X11/twm/system.twmrc. You can copy that to ~/.twmrc and edit it - but be careful! - errors are difficult to debug. (Run twm without the "&" to see error messages.) When you first log in using XDM, a single window will appear on the screen. The "xterm" command opens another window on your display. Select a window by moving the mouse pointer to it. Remove a window by typing "exit" in the window. The "&" character puts the process in the background. Backgrounded jobs can be identified using the command "jobs -l". They can be killed using the command "kill -9 %1". "%1" kills the first job, "%2" kills the second, etc. There are many options to these commands. For more information, type "man twm", "man xterm", "man kill" or "man csh" (for information about "&" and "jobs"). Sample .xsession file: Here is a .xsession file that starts "twm". This file would go in your home directory. New accounts are created with a default .xsession file like this, and it can be copied from /share/b/default-named-account/.xsession #----------------------------------------------------------- #!/bin/csh -u # /share/b/default-named-account/.xsession # sample .xsession file for EECS Instructional UNIX accounts # file must be executable; # make executable using "chmod u+x .xsession" /usr/sww/X11/bin/twm & xclock -digital -geometry -50+0 & /usr/sww/X11/bin/xbiff -geometry -250+0 & exec /usr/sww/X11/bin/xterm -geometry 80x24+260+220 -ls \ -sb -title "Exit this shell to log out." #----------------------------------------------------------- See "man twm", "man xterm", etc for details about those commands. This file must be executable by you, so after you create a .xsession with an editor, you must modify the permissions on the file. This is done with the "chmod" command: chmod u+rwx .xsession This gives you, the owner of the file, read, write, and execute permission on .xsession, while revoking all privileges for .xsession from anyone else. See "man chmod" for more details. The last step is an optional one. TWM uses a configuration file named ".twmrc" to deside how to setup your X environment (colors, menus, etc). You can live with the system defaults, or you can create one of these files yourself. On HP systems, the related default configuration files are: /usr/vue/config/Xsession /usr/lib/X11/xdm/sys.xsession /usr/lib/X11/twm/system.twmrc Gnome window manager: Gnome is common on the Linux workstations. ALT+PRINTSCREEN+K kills/reloads Gnome (gdm) CTRL+ALT+BACKSPACE kills/reloads Gnome (gdm) in versions < 2.30 XWindows Fonts -------------- Different font sets are stored in files in various locations, under the sub- directories for X11 and other application programs. The files have normal UNIX filenames, but X11 uses a code called the "X Logical Font Description" ("XLFD") to identify the charateristics of a font. The XLFD codes are stored within the font files. Many X servers maintain a "font path", similar to your command search path, except that this is a list of directories that it will search for fonts. These are useful UNIX commands for identifying the available fonts on your system and for adding them to your font path: "xlsfonts" lists all the fonts available on your system, in XLFD format; you can list a subset using the "-fn_ option, for example: xlsfonts -fn '-*-courier-medium-r-normal--*-100-*-*-*-*-*-*' "xfontsel" displays a sample of a font and lets you modify the XLFD. For example, taking an XLFD description of a font as listed by "xlsfonts": xfontsel -fn '-*-courier-medium-r-normal--*-100-*-*-*-*-*-*' "xfd" displays all the characters in a given font, for example: xfd -fn '-*-courier-medium-r-normal--*-100-*-*-*-*-*-*' "xset q" to examine your current font path; it will show you all the X server parameters which can be changed; the Font Path is one of the last things shown. You can add additional font directories to your X server's font path with the command: xset fp+ [,....] The EECS department Software Warehouse (/usr/sww) has many X fonts installed. The font directories are subdirectories within /usr/sww/X11/lib/X11/fonts. Not all fonts will be compatible with all servers. It is best to add only the directories you really need. Adding unnecessary directories wastes memory and increases the startup time of your X server. If you have access to a special font set of your own, you can create a private font directory for it. The "man X" man page explains how. "/usr/sww/X11/bin/cxterm" is an xterm program that diplays Chinese fonts. Before you run it, set the font path with the command xset fp+ /usr/sww/share/fonts/Chinese See these man pages for more information: man X man xset man xlsfonts man xfontsel XWindows Troubleshooting: 'locale', Magic, IRSim, Exceed -------------------------------------------------------- Can't login at UNIX workstation: Error reports related to logging in with Xwindows can be found in the file .xsession-errors in your UNIX home directory. If you cannot login at a workstation, it may just be because the windowing system is confused. Sometimes a file called .Xauthority is left behind when you log out, and that prevents the windows from starting again. Another common problem is that a file called .xsession, if you have one, is not executable. You can remove the .Xauthority or fix the .xsession permissions by yourself, which often clears the problem. If you can login (using 'ssh') from another computer account, just run these UNIX commands: rm .Xauthority chmod 755 .xsession If you are at a PC running UNIX in 277 Soda: 1) At the workstation login screen, select "no windows" from the "Options" menu before logging in. Then login. This logins without using the window manager files. You'll get a single, simple window on the screen. 2) Type "rm .Xauthority". 3) Type "chmod 755 .xsession" (if you have a .xsession file). 4) Logout. 5) Login again the normal way, ie without doing step (1) above. If you are at a Sunray (in 271+273+275 Soda, 199 Cory, HFA), there is option for "no windows" logins, so you will have to either go to 277 Soda or login from another account using 'ssh' to reset those permissions. If resetting the permissions does not work, you may need to update some of the other configuration files in your home directory. This is especially true if you have modified them. You can reinstall any of the default files that we provided, using the "cp" (copy) command. These files are stored in /share/b/default-named-account and /share/b/default-class-account: .Xdefaults .login .profile .xsession* .cshrc .mailrc .twmrc "couldn't set locale correctly": The UNIX workstations and SunRays have an option for setting different character sets before logging in. If you get the error "couldn't set locale correctly" when you type commands such as 'xterm', the setting is incorrect for your needs. You can correct it yourself. Before you login, make sure the locale is set to "C" (on the Options submenu of the login screen). Other users sometimes change it, and it often reuses the last setting. Magic: To run magic on a remote system and display it on a local workstation, you must invoke magic as "magic -d XWIND my_layout.mag" IRSim: There is a command "Xdisplay" that you must use in IRSim to set the location of your display. Read the man page for details. Exceed: If you find that your XWindows program displays colors badly on a PC via Exceed, it may be caused by one of these problems: 1) The .Xdefaults file in your UNIX account may have bad color settings. If you have a line like one of these *background: #bffffffffc00 *background: black you can comment it out by prepending a "!" !*background: #bffffffffc00 !*background: black and re-starting the program ('xterm', 'awaves', etc) on UNIX. 2) Another possibility is that it is an Exceed configuration problem on the PC. You can try configuring Exceed video to use "PsuedoColor" instead of "Auto Select". To do this, start Exceed, then right-click on the "Exceed" box at the bottom of the screen. This brings up the "Exceed" menu. Select Tools\Configuration\Screen Definition and change the "Server Visual" field. If the PC is in an Instructional lab, let us know which one and we will update Exceed. Otherwise, you may need to get the ask the sys admin of the PC you are using. Vista 64: Xming, Exceed, and Cygwin's Xwin don't work ----------------------------------------------------- (Sep 2009) Xming, Exceed, and Cygwin's Xwin all fail to work properly in Vista-64. Xming starts and dies with no messages. Exceed starts but Xwindows don't forward. Xwin's base server process starts, but all subsequent windows fail to start. Xming does run on 64 bit Windows 2003 and 64 bit Windows 2008, so it's something exclusive to Vista-64 that prevents X from working. So Vista-64 is not supported by Instructional Support. An XWindows manager on Windows is essential for many classes that want to run programs remotely from our servers. Xming is our preferred solution. Exceed Campus License and non-UCB Students ------------------------------------------ The licensing for Exceed is controlled by the UC Berkeley Office of Software Distribution. Only students who have valid UCB student IDs can obtain Exceed for free from UCB. If you are enrolled in a UCB class through UC Extension, Concurrent Enrollment, the National Technical University (NTU) or etc, you may not be allowed to download Exceed from software.berkeley.edu. For Exceed, the alternatives for the non-UCB students include: - register at http://connectivity.hummingbird.com/products/nc/resources.html and download the 30-day free evaluation copy of Exceed 2006 - purchase it from http://www.dcsi.com/Hummingbird.asp (about $390) - ask your sponsoring program to purchase it - run Linux or MacOSX (which have XWindows) instead of Windows - on Windows, install Cygwin/X (free from http://www.cygwin.com/xfree/) Non-UCB students who are taking UCB classes should see http://inst.eecs.berkeley.edu/cgi-bin/pub.cgi?file=calnet.help for information about obtaining a CalNet ID that will provide limited access to UCB services. EECS Instructional Support 378/384/386 Cory, 333 Soda inst@eecs.berkeley.edu