Results 1 to 8 of 8
  1. #1

    is there a autoexec.bat file for centos ?

    Hi, i need to run these commands every time the server reboots:

    /sbin/iptables -A INPUT -p tcp --dport 26 -j ACCEPT
    /sbin/iptables -A PREROUTING -t nat -p tcp --dport 26 -j REDIRECT --to-port 25

    in order to redirect port 26 to 25, where do i put the command so that it executes itself every time a reboot is made and not do it manually?


  2. #2

    obligatory 10 characters
    managed dns global failover and load balance (gslb)
    uptime report for

  3. #3
    Join Date
    Jan 2001
    Are you running a control panel? if so what kind is it?

    How did you get that this is what you need to do?

    run these in ssh/root what does it spit out if anything?

    # rpm -q iptables

    # lsmod | grep ip_tables

    # lsmod | grep ipchains
    eeeeeeeeeeeeeeeewwwww it's broke

  4. #4
    Didn't find the rc.init file on the server (using locate).

    I've been using that command to open port 26 as smtp since my ISP blocked port 25 and it's working fine problem is every time i do a reboot i have to use those 2 commands again to open port 26.

  5. #5
    Join Date
    Mar 2009
    Add your rules to iptables, then run :

    # service iptables save

    Better than Windows batch files
    ★ NinjaFirewall : Web Application Firewall for PHP and WordPress.
    ★ NinjaMonitoring : Monitor your website for suspicious activities.

  6. #6
    Join Date
    May 2008
    You can also place the rules in /etc/rc.local which is a script which runs at the very last of the boot process. But saving the iptables rules as mentioned above is suggested.
    Twitter :
    Contact Us : support[at]

  7. #7
    Join Date
    Nov 2001
    The South
    echo "/sbin/iptables -A INPUT -p tcp --dport 26 -j ACCEPT" >> /etc/rc.d/rc.local
    echo "/sbin/iptables -A PREROUTING -t nat -p tcp --dport 26 -j REDIRECT --to-port 25" >> /etc/rc.d/rc.local
    Or do the iptables save thing already mentioned.
    Gary Harris - the artist formerly known as Dixiesys
    resident grumpy redneck

  8. #8
    If you have saved these rules in your IPtables, it will not be lost even when you reboot.
    Windows VPS | Linux Hybrid Server | 99.9% Uptime ( USA DC) ( INDIA DC)

Similar Threads

  1. File Systems Supported on CentOS
    By damansk in forum Hosting Security and Technology
    Replies: 2
    Last Post: 10-31-2008, 12:17 PM
  2. CentOS & Automated File System Check
    By MrNiceGuy in forum Dedicated Server
    Replies: 3
    Last Post: 03-14-2008, 04:24 PM
  3. looking for CentOS kickstart file for cPanel servers
    By SoftDux in forum Dedicated Server
    Replies: 10
    Last Post: 02-27-2008, 01:33 AM
  4. which file i should edit on centos for exim configuration
    By darkink in forum Hosting Security and Technology
    Replies: 1
    Last Post: 10-19-2006, 10:59 PM
  5. yum.conf file for centOS 4.0 missing
    By cannibal in forum Hosting Security and Technology
    Replies: 3
    Last Post: 09-21-2005, 08:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts