Tuesday, November 13, 2007

"Wait" command in Windows

To make a basic "wait" command in windows we can do like this:

: ping 127.0.0.1 -n 5 -w 5000 > nul

this command will do a wait for 5 secs.

Could be usefull

Wednesday, August 1, 2007

Remove Sendmail

Here's how to remove sendmail from your system.

Use it "at your on risk"

- Check for sendmail in /etc/init.d/
# ls -la /etc/init.d
# chmod -x /etc/init.d/sendmail - remove the execute

- Find sendmail in your boot scripts. It's usually in either /etc/rc or
/etc/init.d/sendmail. It looks like
sendmail -bd -q15m
-q15m means that it should run the queue every 15 minutes; you may
see a different number. Comment out this line.

- Kill the sendmail daemon. You should first kill -STOP the daemon; if
any children are running, you should kill -CONT, wait, kill -STOP
again, and repeat ad nauseam. If there aren't any children, kill
-TERM and then kill -CONT.

- Check whether you have any messages in the sendmail queue,
/var/spool/mqueue. If you do, you will have to try flushing them with
sendmail.bak -q. If necessary, wait a while and run sendmail.bak -q
again. Repeat until the queue is empty. This may take several days.
or delete the messages :)
# rm /var/spool/mqueue/*
# rm /var/spool/mqueue-client/*

- Check the crons
# ls -a /etc/cron*
- check if there are any sendmail files
- and rename or delete them

- Remove the setuid bit on the sendmail binary, to prevent local users
from gaining extra privileges through sendmail's security holes. The
binary may be at several different locations:
# chmod 0 /usr/lib/sendmail
# chmod 0 /usr/sbin/sendmail
# chmod 0 /usr/lib/sendmail.mx

- Move the sendmail binary out of the way:
# mv /usr/lib/sendmail /usr/lib/sendmail.bak
# mv /usr/sbin/sendmail /usr/sbin/sendmail.bak

-
Check and remove the users if you want:
# more /etc/passwd -- check for smmsp, smmta
# userdel smmsp -- delete the user smmsp
# userdel smmta -- delete the user smmta

Monday, July 23, 2007

Basics of Cisco Switch

Log in

Before you can administer the switch you are going to need some basic information:

  • What is the switches IP address or DNS name?

  • What is the username/password you can use to login?

  • What Ethernet switch port is the device in question connected to?

One option to configure the switch might be a web-based administration interface. If this is the case, basic configurations aren’t going to be that difficult and perhaps you don’t need much more help. On the other hand, GUI interfaces aren’t always available, but on Cisco IOS switches, the Cisco IOS always is. Plus, in a GUI interface, you won’t be able to do every possible configuration. In the command-line interface you will be able to perform every possible configuration. For that reason, I encourage you to use the IOS command-line interface. I will be performing these common switch administration tasks on the Cisco IOS command-line interface.

Showing the switch configuration

Just like on a router, the most command-switch IOS command is to show the switch’s configuration. This will show you the configuration for the entire switch, including all the Ethernet ports on the switch. To see switch configuration, just type:
# show running-config



Showing interface port status

Most of the time you are going to a switch, you want to troubleshoot a switch port, or change a switch port configuration.
The quickest way to see the status of your switch ports is to use the:
# show interfaces status




This command shows each port: if the port is connected to the device, the VLAN the port is in, the port duplex, the port speed, and port type. This is an excellent quick way to see status for your switch ports.

Changing interface speed & duplex

Say that you see that interface Fa0/21 is set to auto (auto negotiate) for its speed but it needs to be set to 10Mb/sec. To change the speed of any port, you go to interface configuration mode and use the speed command, like this:




On this switch, the possible speeds for the 10/100 Ethernet ports are auto, 10, and 100. On the Gigabit Ethernet ports, you can only tell the switch to either negotiate port speed or not to negotiate port speed.

Once the speed is configured to 10Mb, you can verify it with the show interfaces fa0/21 status, like this:



As you can see, the speed is now set to 10.

To change the duplex of a port, you perform the same steps but use the duplex command. Duplex can be set to auto, full, or half.

Enabling and disabling interfaces

To enable and disable interfaces, you use the no shutdown and the shutdown command in interface configuration mode. Here is an example:


Notice how when the port was shutdown, console messages appear that told you the administrative state had changed to down, and the line protocol changed to down. When the port was enabled (no shutdown), the link went down, then the line when up, then the line protocol changed to up.

You could now do a show interfaces status to see the state of the interface.


Sunday, July 22, 2007

Tips and Tricks WinXp

Command "Netsh" on Winxp
The netsh command on windowsXP can be used to do many things, some examples

To create a simple batch file for starting/stoping winxp firewall
Example:

Run: cmd.exe
c:\copy con fire.bat
netsh firewall set opmode disable | or enable ----- start or stop the firewall
^Z and enter -- saves the batch


Other examples:
Run: cmd.exe
c:\
netsh firewall add portopening TCP 80 webserver ----- open port 80
c:\
netsh firewall delete portopening TCP 80 ---- delete the rule