Unix for On-net Technical Support Associates


Accessing a Unix machine:
There are two ways to access an On-Net Unix system from your Windows-based workstation.

  • Telnet Application:
    Windows has a low-level terminal emulator application called telnet.exe. This can be launched from the Run option of the start menu.
  • SSH Application:
    Certain On-Net servers have extremely high security enabled or you may need to access the system from outside the On-net system. These require an Application to use a protocol known as SSH. SSH is supported by SecureCRT and Tera Term (known as ttssh). Additionally, it is available on most Unix systems.

Basic Unix Command Syntax:
Unix commands usually consist of 2 to 5 letters.

Commands are typed at a prompt: ~ $ and executed when you press enter. If a mistake is made with a command, the system should allow you to use the Backspace key to erase it. If this does not work and you receive output similar to lis^H your terminal emulator and Unix shell are not communicating keyboard mappings correctly. To solve this type the command stty erase ^H. If the entire line is messed up a simple Ctrl U will clear the entire input line.

Commands may also be “piped” to another command. For example the command ls is used to see the files in a directory. Suppose the file list took up more than one terminal emulation screen. The solution would be to “pipe” the output to a program called more. More is used to view large text files. The output of ls is text so more is able to receive output from ls. To send the output to more type: ls | more. The pipe bar “|” should be found on your “\” key. You must press shift to use it.

Any Unix command may be aborted by pressing Ctrl C.
Any command that is finished receiving input may be terminated by pressing Ctrl D.

Basic User Account Procedures:
Daily On-Net user account procedures are executed from On-Net’s Unix server sam.onet.net.

Checking Availability of User names:
A user signing up usually has an idea of what they would like for a user name. However, it may already be taken. To determine the availability of the user name the finger command is used. Finger queries the server for active accounts, just type: finger accountname. If the result is:
Login name: accountname In real life: ???
The account does not exist and is available for new users.

Changing User’s password:
Occasionally a user will call requesting a password change. Provided they know their current password and you are able to sign-on to the system with their username you can change their password by typing: passwd. The program will prompt for their old password and will give errors if their new password conflicts with On-Net’s password policies. If the user requires a password that does not confirm to standards a person with root access will be needed to change the password.

User E-mail Account Procedures:
On-Net’s email services are extensive and offer our users a variety of options.

Checking User’s E-mail while it is still on the Server:
Often a user will call in requesting that certain mail be deleted from their mailbox. Usually the message contains an obscenely large attachment that is not reasonably downloadable via a dial-up connection. It is also common for a user who told their mail client to keep the mail on the server to call to get it removed from the server. You must logon to the system as that user. You may run one of the two available Unix e-mail clients elm or pine (there exist more, but these two are the easiest). Elm is recommended for this because pine leaves a configuration message in the user’s mailbox and will confuse them. Elm is a simple interface and requires limited explanation. Simply tell elm to delete the message in question and then tell it to quit. If prompted, tell it you really want the message deleted and say No if it prompts to move current mail to the received folder. If the user is certain that all their mail currently on the server can be removed (i.e. they have checked their new mail, etc.), you may type rm /var/mail/username. This will delete all mail from the user’s profile and it will be lost.

Email Forwarding:
The most commonly requested service is e-mail forwarding from a user’s current On-net e-mail address to another. This can be enabled by logging unto the system as the user and creating a file called .forward. The “.” tells the system that the file is hidden and cannot be seen normally. It is wise to check and see if the user already has a .forward file enabled. Since it is a hidden file, to check for it you must type ls –a. This will show all files in the directory. To create the .forward use the text editor called pico. If you are familiar with other available Unix text editors feel free to use them, pico is used here for simplicity. The command to tell pico to create a forwarding file is: pico .forward. Once the pico screen has come up, type in the e-mail address the user wants their e-mail forwarded to and press Ctrl O to save the file then Ctrl X to exit. The bottom of the pico screen shows available commands. The letter with “^” shows the control key must be pressed with the letter to execute the command as shown above. Once you have exited pico you are back at the system prompt and may terminate the session if you wish.

Forwarding Email already on the server to another email address:
Usually when a user enables mail forwarding they will want all their mail they haven’t checked yet to go to their other account. To accomplish this logon to the system as that user and type: /usr/lib/sendmail -v emailaddress < /var/mail/username replacing emailaddress with the address the user wants the e-mail forwarded to and username with the user’s On-net Account name. The “<” tells the sendmail program to receive input from the user’s mail directory. The –v may be omitted it is for troubleshooting purposes in case the forward fails.

Business Email Hosting:
On-Net business costumers use On-Net’s email server to host their domain email. For example: mailto:joe@On-net.net could be equivalent to joe@joescompany.com. To determine if the business customer who is having issues with e-mail uses our server you can run nslookup. Nslookup tells extensive information about an Internet domain. We want to limit this to only query the mail exchanger so we type: nslookup –q=mx domainname and the resulting output is still quite extensive. The line we are looking for is: domainname preference = 10, mail exchanger = mail.on-net.net this may be in a list of several e-mail exchangers, but if mail.onet.net or mail.on-net.net holds the lowest preference number (i.e. 5, 15, etc) we handle their e-mail. If the server name listed is something to the effect of mail.domainname then they have their own e-mail server and are misguided about their Internet configuration. Additionally, there exists a virtual users table on the e-mail server. Therefore it is entirely possible for a sales@joescompany.com, support@joescompany.com, and webmaster@joescompany.com to all go to joe@onet.net or joe@joescompany.com. To determine all email aliases for joescompany.com type grep joescompany.com /etc/mail/virtusertable | sort | more. The last line of the output may say @joescompany.com joe this specifies any other email sent to that domain that does not specify a valid user will go to joe@joescompany.com therefore, ending up at joe@onet.net.

Grep, The Unix power tool.
The Unix grep command is used in a variety of situations pertaining to On-Net systems. Therefore, it requires it’s own procedural section. Grep is a program that searches text files for a certain word or phrase. In the majority of On-Net situations grep is used on system files that contain necessary information. The On-Net scripts gm and gc both use grep for their backbone.

Determining extensive User Name information:
Fingering a user is not always the best course when determining username availability or if a current user forgets their exact username. The simple solution is to grep the user file in /etc on the system: grep username /etc/passwd, if the list appears to be long simply type: grep username /etc/passwd | more. For efficiency you may also pipe it to the sort command so the output is in alphabetical order by username: grep username /etc/passwd | sort | more. Note the double use of the pipe character. You can also grep by their real name if you have it spelled correctly. For example (include quotes!!): grep “User’s Real Name” /etc/passwd | sort | more.

Determining which server a website is hosted on:
In the /etc directory in the system is a hosts file which contains moderately up to date information on which sites are hosted on which machine. For example if a user who’s site is www.mycompany.com is having issues you grep the host file: grep www.mycompany.com /etc/hosts | more. The result should be similar to the following: #nts1 192.168.0.3 www.mycompany.com mycompany.com the name after the # is the server the site is hosted on. If the site is on a server you do not have access to, please contact a supervisor with the necessary information (site name, user issue, and server the site is hosted on). The alternate way, if the host entry is not available is to use arp. Arp will tell you the hardware address of the server’s network card (called the MAC address). For example first you’d type: ping www.mycompany.com and ping nts1 to resolve their netbios attributes then you’d type: arp www.mycompany.com and it would return 0:50:4:6e:d1:e7 then you would type arp nts1 if it returns the same value the site is on that server.

On-Net grep based Scripts:
The scripts gm and gc should be located in the bin subdirectory of your home directory on the system. These scripts allow you to check the connection and mail history of a user.

The Heads and Tails of Unix:
The Unix commands head and tail present the output of the first few lines of a file and the last few lines of a file respectively.

Determining the last shell login of a user:
The last command will tell when the user last logged unto the system using telnet, ssh, or direct console login (not likely). The problem is last will give you every incident of a person logging in going back as far as the system logs are keeping track. For many users this list is quite large, therefore piping the command to head or tail will give you the last time the user has logged on or the first time. For example typing: last dasmith | head, you would reference the first line of the output: dasmith pts/12 brian Wed Apr 18 15:22 This tells the last recorded logon. However, if you typed last dasmith | tail you would reference the last line of the output: dasmith pts/18 brian Thu Aug 17 17:29 - 17:32 (00:02) which tells the first time a user logged in.

On-Net Custom tail scripts:
On-Net has several custom scripts that utilize tail. These can be found by typing: ls /usr/local/bin/tail* this will list every available tail script. The name of the script implies what it does; such as tail56 (shows last few users who have dialed in), tail.mail (last email sent), tail.pop (users who’ve checked mail), etc. To view how these scripts utilize tail type: cat /usr/local/bin/tail56.

Linking it all Together:
The ln command will allow you to create abbreviated shortcuts to files on the system.

Example: Creating a link to the User file:
To create a shortcut to the /etc/passwd file in your local directory type ln –s /etc/passwd users. Now instead of typing grep username /etc/passwd you can now just type grep username users and receive the same output. You may name the shortcut anything you’d like. Instead of linking /etc/passwd/ to users you could link it to customers, by typing ln –s /etc/passwd customers.

Further Reference:
Several Unix commands were left out of this documentation, because at present time they are not presumed to be needed for On-Net Technical Support operations. To obtain more information about a Unix command simply type man commandname. At the end of the online documentation it will state other commands that relate to the current command.