Name

login — provide convenient default login setup on the shared course accounts

Synopsis

exec ~isg/bin/login

Description

The last line of the file /u/csXXX/.login should be: exec ~isg/bin/login

login is designed to provide convenient setup for those new to Unix, including a personalized home subdirectory and a customized environment including a PATH that already includes the ISG tools.

This command sets up an environment on the course accounts where every user who logs in gets their own home directory (/u/csXXX/u/remoteuser), allowing for convenient, automatic personalized configuration. It also takes some courtesy steps such as executing the remote user's preferred shell. The PATH will be set, in order, to the course account's bin directory, the remote user's bin directory, and then the isg bin directory if each of these are readable and executable from the course account; after this, the search will fall back on the GNU and standard paths. The MANPATH will also be set such that the documentation for the GNU tools and the ISG scripts can be found by man.

The detection of the remote user's identity is done by examining the REMOTEUSER environment variable. This will be set automatically on the CSCF environment by the rsh command, but in cases where this variable has not been set (for example, when using ssh), the program will prompt for entry of the remote userid. If the response happens to be the empty string, then the home directory is set to /u/csXXX.

The login script also reads the remote user's default shell, and loads that on the course account to provide a familiar environment. It will attempt to symlink the remote user's .cshrc to the course account subdirectory's .cshrc, as well as the files .profile, .bashrc, and .vimrc.

The script also sets up the default path so programs like rst can be found. In addition to the ISG tools, it will also automatically include the remote user's bin directory, as well as the course account's bin directory. To prevent the CSCF default .cshrc from wiping out these changes to PATH, it also sets the environment variable DONE_ENVIRONMENT to the value "done."

.cshrc warning

Assuming the default shell of the course account is csh or tcsh, the file /u/csXXX/.cshrc will still have an impact upon login. This is not desired, as the remote users' home directories should contain any desired configuration beyond the default.

If a global .cshrc really is desired, then be sure to keep it minimal as a courtesy to other users of the shared course account.

bash warning

Most course accounts should run tcsh by default. However, it is possible to change the login shell to bash, which then will disregard the contents of .login. The solution is to create a .profile in the course account root directory, with no contents except the following: source /u/csXXX/.login

Specifying the remote user

The prompt that is given when REMOTEUSER is not set can cause problems for some ssh-based applications. Because of that, it may be desirable to provide some configuration on the course account for login.

.login-default-user

One way to set REMOTEUSER automatically is to place a userid in the file /u/csXXX/.login-default-user. If the REMOTEUSER environment variable has not been set, then the user specified in this file will be used as REMOTEUSER automatically. This allows ssh to be used without being prompted to enter the remote userid, but at the cost of losing automatic personal configuration for anybody but the default user who does not have REMOTEUSER set for them. As mentioned above, the default user can be the empty string, making the course account's root directory home.

Modifying .login on the course account

Another way to set REMOTEUSER is less clean, but it allows personalized configuration in certain circumstances. If there is a unique way to identify a remote user in the given term (for example, a server that only one staff member uses), then this check can be done in /u/csXXX/.login before the ISG account login is execed, and REMOTEUSER can be set as appropriate on success. For example,

if ( $REMOTEHOST == _my_personal_server_ ) then
        setenv REMOTEUSER _my_userid_
endif
            
Topic revision: r1 - 2016-01-11 - YiLee
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback