Home Research Personal activity Linux & Security Link

 Linux administration notes   (updated: 04/22/03)

1. Using Netscape and Pine to check email conveniently

2. Setup Apache Ftp mode

3.  Setup sendmail relay access control list

4.  Setup mail list on sendmail

5.   Install IMAP+SSL on email server

6.   Using Latex to generate viewable Pdf file

7.   Convert general image files to ".eps" format for Latex

7.  RedHat 7.x sendmail can not receive email problem

8. Add new user on NIS Linux server

9. Add hosts entry under Windows 2000

10. Most useful RPM package installation and management commands

11. Common usage of tar/gzip in Linux

12. Set up filter for sendmail

13. Remove "auto-logout" feature for SSH connection


Using Netscape and Pine to check email conveniently.

    You can use Netscape and Pine to check email in the same way from anywhere. There are many free SSH programs for windows, you can use SSH and then use Pine to check email. From your own laptop, home Windows, or Linux/Windows inside the lab, You can aslo use Netscape Messenger to check email in the email server inside lab. The email server uses IMAP+SSL to provide secure email connection. The following steps will setup Netscape without local email folder. In this way, all emails are on the email server, so you can check email in the same way from anywhere.

1. remove mbox from user home dir, or just rename it (to prevent Pine move all new email from Inbox to the mbox).
2. run pine to let pine set up ~/mail/ directory under user's home dir.
3. setup netscape messenger on your Linux, laptop or home computer:
"mail server properties" panel:
1). use SSL connection. Select "mark it as deleted" in "when I delete a message".
2). Select "clean up expunge email when exit" and "empty trash when exit".
"Advanced" panel:
1). unselect "Show only subscribed folder".
2). select "server surport folders that contains sub-folder".
3). In "IMAP server directory", input "mail/".
4). unselect "allow server to override these namespace" and clean up the content in
"public" "other users".
4. when delete some messages and want to delete them immediately from server, either exit netscape or
select menu "file"==> "compact this folder".
5. Final notice:
1). Don't pay any attention to "local mail" under the "tennis" server in the left panel of
netscape. Now all your emails and saved email folders are on server.
2). You can refresh your folder list on server by double click tennis and double click it again.
3). you can create an email folder on server by right-click tennis and select "create a new folder";
then you can drag and drop your email in inbox to this folder.

Setup Apache Ftp mode

    If I setup Ftp mode on our Apache Web server, then I don't need to setup insecure Ftp server anymore. If you need to let your friend to upload files, you can setup a temporary account and let your friend to use sftp through SSH program to upload files.

1. Use Linuxconf. You can download the Linuxconf RPM.  
2. on Apache configuration part, from "basic" panel, open "use indexes" ( and also change the root dir).
3. on "sub-directory specs", add "/home/html", which is the dir you want to use ftp mode, then select the "use indexes" option.
4. restart httpd.

Setup sendmail relay access control list

    Sendmail by default does not access relay. If the user need to use Netscape to send email from home, we need to open relay for the ISP IP address.

1. Edit /etc/mail/access, put the domain or subnet IP into it (like ``128.119    RELAY" ), one domain per line.
2. Restart sendmail (e.g., type /etc/rc.d/init.d/sendmail restart ).

Setup mail list on sendmail

    We can use Majordomo to manage email list, but it's a little bit complicated. If you just want to setup a simple mail list without adding or removing email addresses frequently, you can use the following way to setup the simple email list.

1. create a maillist containing all users' email address and save it as /etc/mailist-name.
2. edit /etc/aliases to add one line as:
nameYouWant: ":include:/etc/maillist-name"
3. run newaliases command to refresh aliases.db

The emaillist address is nameYouWant@email.server

Install IMAP+SSL on email server

1. first install IMAP+SSL rpms.
2. cd /etc/xinetd.d, edit imaps to enable it. Restart /etc/rc.d/init.d/xinetd.
3. cd /usr/share/ssl/certs/
3. openssl req -new -x509 -nodes -out imapd.pem -keyout imapd.pem
to generate a new certificate.

Using Latex to generate viewable Pdf file

Instead of using:
dvips -o psfilename.ps texfilename.tex
we should use:
dvips -P pdf -G0 -tletter paper.dvi

The -P pdf will generate viewable Pdf; the -G0 option is used because sometimes the Latex will generate some weird characters (e.g., the "fi" will become one weird character). -tletter will use US letter paper size. 

Convert general image files to ".eps" format for Latex

    When you write your paper, you may need to copy pictures from other people's papers or Web pages. These pictures are usually in .jpg .bmp .png or PDF format. But in Latex, we often use .eps format. 

    You can use the "gimp" program to convert easily. It's free and it can be used both under Linux and in Windows.

1.  Save the image into file. If the image is in gif format, you can use another picture software to change it into .bmp or .jpg format.

2.  Use gimp to open this image file. Right click on the image and select "file" ==> "save as", type the file name as "filename.eps". Then the gimp will convert the image to correct eps format.

    If your image is in a PDF paper, you can use Acrobat Reader to first select the picture and copy it to clipboard ( by selecting menu toolbar "Graphic Select Tool"). Then paste it into Windows Paint program and save it into a .bmp file.

    Notice: I tried Adobe Photoshop before to convert the eps format. But sometime it can't generate correct "Boundbox" in the eps image file.

RedHat 7.x sendmail can not receive email problem

Edit /etc/sendmail.cf to comment out the following line:
O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA
Then restart the /etc/rc.d/init.d/sendmail

Add new user on NIS Linux server

1. cd /var/yp/src
2. edit passwd file, add one line like:
user namw::User ID:Group ID:Full Name:Home directory:Login in Shell
3. cd ..
4. make to update yp database
5. use ypcat passwd to check change
6. use yppasswd -p username to set password for the new user
7. creat user home directory on one of our machine, change ownership of the
directoy : chown user.group dir
8. Try login in as the new user

Add hosts entry under Windows 2000

The hosts file under windows is c:\WINNT\System32\drivers\etc\hosts. It has the same format as linux /etc/hosts file.

Most useful RPM package installation and management commands

(1). rpm -Uvh iptables-1.2.5-3.rpm

Install a rpm package. It will upgrade the program if your linux machine has an older version of the program.

(2). rpm -qa | grep table

Query all installed rpm packages, then list all packages that contain the text "table". This is very useful when you don't know whether you have installed a particular rpm package or not.

(3). rpm -qil iptables-1.2.5-3

List all installed files and their location by rpm package iptable-1.2.5-3. Usually it is the next step after you use "rpm -qa | grep iptable" to get the full name of the rpm package. From this command you can know where the program is installed, where the binary files or its configuration files are.

(4). rpm -e --nodeps iptables-1.2.5-3

Uninstall a rpm package without checking dependency. Sometimes several RPM packages form a circle dependent relationship that you can't remove them by simply "rpm -e" command.

Common usage of Tar/Gzip in Linux:

(1). tar czvf  my-backup.tar.gz  ~/myfile/

This will tar and gzip the directory ~/myfile/ into file my-backup.tar.gz

(2). tar xzvf my-backup.tar.gz

This will extract the previous compressed file back into its original, which is the dir ~/myfile/ in this example.

(3). tar tzvf my-backup.tar.gz

This will list all files compressed in the tar.gz file. the option "v" will show the complete information of each file.

(4). tar  xzvf  my-backup.tar.gz  myfile/source/simulator.cpp

If there is a file simulator.cpp under the compressed dir myfile/source/, then this command will only extract this file only. Remember that you need to provide the directory information.

This command is useful when you want to restore some files from your big backup tar.gz file.

Set up filter for sendmail

1. For the user "username", to set up sendmail to send an additional copy to for example "user2@sprintpcs.com" for every received email, edit .forward in the user's home dir and add:

    \username
    user2@sprintpcs.com

The backslash is important to keeps a local copy and doesn't do a circular forward. The configurations are two lines, not one line.  This is useful when the user travels but has no laptop with him.

There is a very good explanation webpage on how to set up filter for sendmail(procmail) at:

http://www.columbia.edu/acis/email/delivery/procmail/

Remove "auto-logout" feature for SSH connection

The SSH connection will automatically log out if you do not use it after one hour. To remove this feature, add "unset autologout" in your shell configuration file, such as .cshrc or .tcshrc under your home directory.

The reason for the auto-logout is: When the shell program doesn't think that you are connected directly to a screen, i.e. the DISPLAY variable isn't set, it will close the shell after one hour.