Skip to content

Category: User accounts

Where to set up Environment variables etc for ALL users on login

OUT OF DATE as of 2008-11-01.

Here is how to set the path or add to the path for all users when they log in. The procedure depends on whether the users’ shell is tcsh (usual case) or bash.  (To determine if your shell is tcsh, type ‘printenv SHELL’.)

———————

TCSH:

For tcsh users, the file to modify is /etc/csh.login. (Also note that other startup conditions can be set for all users in /etc/csh.cshrc).  To add an environment variable simply type

setenv JAVA_HOME /usr/java/1.3.1

To append to the Path in say YOUR OWN .cshrc, type:

setenv PATH “${PATH}:/path/to/be/added”

(This will append your new desired path to the path set for everyone in /etc/csh.login)

————————————————-

BASH:

For users that like bashrc, you can modify /etc/bashrc to add the necessary path or variable. To add a variable, for instance java’s home directory, simply type

export JAVA_HOME=”/usr/java/jdk1.3.1″

If you wanted to add an extra path to sys set up path in YOUR OWN bashrc, type:

export PATH=$PATH:path/to/be/added

add new user MUST BE ON THUBAN:


0. For all newusers:

  • MAKE SURE YOU ARE ROOT ON THUBAN.
  • Inform newuser that they are responsible for reading the document /docs/linux/ourhints/newusers which gives some hints and rules for users.
  • Ask their supervisor what principal group they should belong to. Otherwise the script defaults to giving them a principal group with the same name as their user name. JMW thinks this is useless though he might be wrong. A good choice for Joel’s students is “pulsar”.

Steps 1 through 4 are for adding a linux account for a Carleton user with a Carleton username and password. If the person in question is not a member of the Carleton Community, skip straight to step 5.

  1. At the sh prompt, type “useradd -g pulsar <username>”.
  2. Then type “edquota <username>which brings up a vi session, and set the block soft quota to 200000, and the block hard quota to 240000. To do this type ‘i’ (w/o quotes) to insert text into the file, change the values and hit <escape>. Then type “:wq” (w/o quotes) to save the file and exit vi. Do not change any other fields or numbers. Just replace the 0 under “soft quota” with 200000 and the 0 under “hard quota” with 240000.
  3. Then edit /etc/passwd, find <username>’s entry, and enter their full name in the 5th field and change their login shell to ‘/bin/tcsh’.
  4. Go to astro-server list, login, and add <username>@carleton.edu to the list. Then you are done. The user will need to wait 15 minutes for the changes to propagate to the other Astro machines. They should then be able to log in. If user has no carleton account, follow these directions instead of the above:

  5. Determine the alien user’s uid. By convention, Carleton reserves all uid/gid values of 15000+ for Carleton ldap authenticated user accts. So we must choose an unallocated uid for the new user with a value between 500 and 14999. Look at /etc/passwd to find the next available uid larger than 500 and less than 14999. Then open a shell as root on thuban and issue these commands:
  6. adduser <username> -g pulsar -u <uid>”, replacing <username> with the user’s id and <uid> with the uid you’ve just chosen.
  7. passwd <username>” to set the password to a password of your choice.
  8. Then edit /etc/passwd, find <username>’s entry, and enter their full name in the 5th field and change their login shell to ‘/bin/tcsh’.
  9. Then type “edquota <username>which brings up a vi session, and set the block soft quota to 200000, and the block hard quota to 240000. To do this type ‘i’ (w/o quotes) to insert text into the file, change the values and hit <escape>. Then type “:wq” (w/o quotes) to save the file and exit vi. Do not change any other fields or numbers. Just replace the 0 under “soft quota” with 200000 and the 0 under “hard quota” with 240000.
  10. Go to astro-server list, login, and add alien’s email address to the list.
  11. You will then need to wait 15 minutes for the changes to propagate throughout the system. Notify alien of new account and whatever password you set it to. The first thing s/he should do when logging in is change his password(using the passwd command ON THUBAN) to something s/he will remember.

Useful 1-line commands: repquota,lsraid,rpcinfo,du,clear

One-liners

  • repquota /home
    report on quota usage in /home directory
  • lsraid -A -a /dev/md0
    report on state of RAID array
  • rpcinfo -p
    To see what’s running
  • du -h max-depth=1 /home
    List space occupied on home
  • clear && tail /etc/secret/logs/*.log -n 3
    Show the last action taken on astro network machines