Linux


WARNING: Following this procedure will turn port 9925 into an open relay for your server and so is NOT recommended


Some ISPs block access to port 25 so that you have to send email using their SMTP server. This can be a real pain, so what do we do? The simple answer is to set up a proxy on your web server so that you access a different port. Your web server will forward the conversation to port 25. All we need is a piece of software to do this relaying. One is available from Gavin Stewart. Here is how to implement it so that you access your SMTP server via port 9925 instead of port 25.

  • Login to site using PuTTY
  • Create a directory to install to. I chose mkdir /var/www/myapps
  • Change to required directory (cd /var/www/myapps)
  • Download Gavin’s code (wget http://www.stewart.com.au/ip_relay/ip_relay-0.71.tgz)
  • Unzip the contents (gunzip -c ip_relay-0.71.tgz | tar -xv)
  • Edit the start up file (pico /etc/rc.d/inet.d/ip_relay)
  • Add line /usr/bin/perl /var/www/myapps/ip_relay-0.71/ip_relay.pl -d 9925:<yourdomain.com>:25
  • Exit editor (Control-X)
  • Create symlink (ln -s /etc/rc.d/init.d/ip_relay /etc/rc.d/rc2.d/S90ip_relay)
  • Change access rights for ip_relay (chmod 755 /etc/rc.d/init.d/ip_relay)
  • Restart rc daemon (restart). You should see something like

Killing mysqld with pid nnnnn
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
Resolving address (yourdomain.com)…..
…. determined as: xxx.xxx.xxx.xxx
Useing command line parameters:
local_port 9925
remote_addrs xxx.xxx.xxx.xxx
remote_port 25
bandwidth 0
forwarder 99 set.

ip_relay.pl Version: 0.71
Copyright (C) 1999,2000 Gavin Stewart

ip_relay 0.71 runs as a daemon and therefore allows restarting through the site manager.

All you now need to do is edit your Email client (Outlook, Thunderbird or whatever you use) to use port 9925 instead of 25. This is probably under advanced settings. If you want to check that this is working, just type telnet yourdomain.com 9925, in a command window on your pc. If you get connect failed, then you have made a mistake.

Bookmark this article

Use the following command to delete a directory and its files

rm -rf directory

or in a more complicated way

find dirname ! -type d -exec rm \{\} \;

where dirname is the root of the directory tree you want to delete.

Bookmark this article

You can get a colour display of directory listings by adding the options –color=tty to the command. If you want to make this permanent, then just add an alias to your start up file.

Adding the option -F and will add a single character to the end of the file name.

File Type Symbol Colour
Directory / Dark Blue
File, Hard Link None White
Symbolic Link @ Light Blue (Cyan)
Executable * Bright Green
FIFO file (Named Pipe) | Sage
Block Device None Orange
Character Device None Orange
Socket File = Cerise
Orphaned Link x Unknown
Broken Link x Unknown
Whiteout File % Unknown
Bookmark this article

If you want to list all active tasks (services) in Linux, use the ps command

Syntax Meaning
Process Selection
a select all processes on a terminal, including those of other users
g select all processes on a terminal, including those of other users, even group leaders
r restrict output to running processes
x select processes without controlling ttys
–deselect Invert selection
Output Formats
j Job control format
s Display Signal format
u Display User orientated format (CPU and Memory usage)
v Display Virtual Memory format
l Display Long format
w Wide output

Examples
ps au, ps ax, ps xgwl, ps auw, ps grxwu

Many Linux systems run a super-server, or a software server that handles the initial stages of connection requests on behalf of other software servers. Super servers typically handle connections for small (or seldom-used) servers, such as Telnet, FTP, POP, IMAP, SWAT, SANE, and VNC, just to name a few. This is why these servers may not appear in your process list. These servers can be run standalone without the benefit of a super server, but running a super server typically results in reduced memory load when the servers it proxies for aren’t being accessed, albeit with some overhead and lag during connection attempts. (Some servers cannot be managed by a super server.)
One big advantage of using a super-server is the extra layer of security it provides. A modern super-server, such as xinetd, includes built-in access control features that can limit access to subjugated servers.

Killing Processes
There are dozens of ways to control processes. The first thing you need to do is obtain the pid using jobs or ps. Here are a few common ways to kill a process:

kill -STOP [pid]
SIGSTOP (17,19,23) stops a process without killing it

kill -CONT [pid]
SIGCONT (19,18,25)restarts a stopped process

kill -KILL [pid]
SIGKILL (9) forces the process to terminate immediately and performs no cleanup

Jobs can also be stopped using Control-Z and then restarted using fg and bg. A list of active jobs can be obtained using jobs
fg [jobspec] – Resume jobspec in the foreground, and make it the current job.
bg [jobspec] – Resume the suspended job jobspec in the background, as if it had been started with &

Bookmark this article

There are basically two ways to search for files in Linux.

The first is locate <filename> which will search the whole file system.

The second way is using find. The simplest way to use this is find <start directory> -name <file to search for>. For case insensitive searches use -iname. You can also pass the output of the file to another command as follows:

$ find / – name ‘starttxt*’ -exec command {\}\ \;

This command would find all the files on your system that begin with the letters ‘starttxt’ and would then execute the command on those files.

The words following the -exec option are the command that you want to execute eg.. ls -l
{\}\ is basically an indicator that the filenames returned by the search should be substituted here.
\; is the terminating string, and is required at the end of the command

which can be used to output the full path of executables.

Try Edinburgh University‘s website if you are after the man files

Bookmark this article

« Previous Page