Archive for the ‘Linux’ Category

Check your mail using telnet

January 10, 2008

At work we have pop access to the state shared email system. Every so often I have to check a users box to see if the box is jammed with a huge message or just to make sure the account is active. The easiest way for me to do this is using telnet. Below are some basic commands to get you going. If you want to know more lookup RFC 1725.

 

telnet pop3.mailserver.com 110 <– or what ever port your pop server is on

Commands

USER –this one is pretty straight forward. For a valid user you should get “+OK Password required for <account name>.”

PASS — again pretty easy. Reply after authentication should be: “+OK <account name> has <n> message(s) (MMMMM) octets”, where <n> is the number of messages in the mailbox (MMMMM) is the total size of all messages.

LIST — Lists all the messages by number as well as the size

RETR — this command along with the message number will display the message in text format. ex. retr 3

DELE — delete the message. ex. dele 3

Linux For An Old Laptop

July 23, 2007

Don’t throw away that old hardware. You might find that a minimal Linux distro will work just fine on that old piece of equipment.

read more

rm goodness

March 14, 2007

You will never regret being careful when you use the ‘rm’ command…

(more…)

Tip – Escaping Script w/ CTRL-C

March 9, 2007

Recently I ran into a problem where a shell user would have a script run automatically when they logged in. I set this up in this manner because the only reason this person would log into this server would be to run this one script. But I realized anyone could use “CTRL-C” and escape the script and be in that shell…..

(more…)

cisco PIX DST update

February 20, 2007

Cisco PIX and ASA Platforms

You can change the DST configuration parameters for a system that runs the Cisco PIX or ASA OS with a single configuration command. You can run this command at any time and on any device in order to change the current default settings of the given device.
clock summer-time zone recurring [{week} {day} {month} {hh:mm}
{week | day | month | hh:mm} [offset]]

In order to comply with the 2007 DST time change, use this command on any device that runs the Cisco PIX or ASA OS:
clock summer-time EDT recurring 2 Sun Mar 2:00 1 Sun Nov 2:00

cisco DST update command

February 20, 2007

Cisco IOS Software Platforms

You can change the DST configuration parameters for a system that runs Cisco IOS with a single configuration command. You can run this command at any time and on any device in order to change the current default settings of the given device.
clock summer-time zone recurring [{week} {day} {month} {hh:mm}
{week | day | month | hh:mm} [offset]]

In order to comply with the 2007 DST time change, use this command on any device that runs Cisco IOS:
clock summer-time EDT recurring 2 Sun Mar 2:00 1 Sun Nov 2:00

crontab syntax

February 13, 2007

Crontab syntax :-
A crontab file has five fields for specifying day , date and time  followed by the command to be run at that interval.
*     *   *   *    *  command to be executed
-     -    -    -    -
|     |     |     |     |
|     |     |     |     +—– day of week (0 – 6) (Sunday=0)
|     |     |     +——- month (1 – 12)
|     |     +——— day of month (1 – 31)
|     +———– hour (0 – 23)
+————- min (0 – 59)

selinux

January 19, 2007
Q: How do I turn enforcing on/off at boot?
A: You can specify the SELinux mode using the configuration file /etc/sysconfig/selinux.


# This is a comment field in /etc/sysconfig/selinux
#
# Allowable values are:
#     enforcing  -  enables enforcing mode
#     permissive -  enables permissive mode
#     disabled   -  disables SELinux
SELINUX=<value>

Yum

January 9, 2007

Applying updates and patches to a Fedora Core box is very straight forward.

First, log in as root:

$ su
password:

After you are logged in as root, then you will execute the yum command.

# yum update

The following is an overview of some more yum commands:

  • yum list [List all available packages.]
  • yum check-update or yum list updates [See if there are updated packages available.]
  • yum update [Update all installed packages that have a newer version available]
  • yum install
    [Install specific packages and their dependencies.]
  • yum search [Search all known packages entries (descriptions etc) for word.]
  • yum info
    [Show basic information about a package.]

For more information on yum, man the command:

# man yum

Modify A User

December 18, 2006

There are several ways to modify a user account:

  • Change the user’s password
  • Change the user’s home directory
  • Change the user’s shell
  • Change the user’s group

For the purpose of what we are teaching here, the most important items will probably be changing the user’s password or changing the user’s shell.

Why would a sys admin want to change the password?

Sometimes users request that their password be changed. Sometimes you want to reset the password for a user because they forgot their password, and you have to assign them a new password. My rule of thumb w/ passwords is that I assign passwords that are letters or numbers or a combination of both, more than 5 characters, and all lowercase.

To change the password of a user, you simple type:

# passwd username

The passwd command will ask you to retype the new password of the user, and if successful it will output a success message to you like this:

passwd: all authentication tokens updated successfully.

Why would a sys admin want to change a user’s shell?

When you first create a user, the default shell the user receives will be bash. That is the “Bourne Again Shell”, named after the man who created it, Bourne. If the user is just being created for the purpose of having an email account, the user does not need a bash and really shouldn’t have one for security reasons. So, to change the user’s shell you do this command:

# usermod -s /bin/fakeshell username

NOTE: You have to have the /bin/fakeshell installed on the system for this to work properly.