Find the answer to your Linux question:
Results 1 to 3 of 3
So I am trying to block any SSH connection attempts on Saturdays and Sundays to be rejected. This is the command i have come up with. iptables -A INPUT -p ...
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Location
    Burlington, Canada
    Posts
    2

    [SOLVED] problem with rejecting ssh on weekends with iptables

    So I am trying to block any SSH connection attempts on Saturdays and Sundays to be rejected.
    This is the command i have come up with.

    iptables -A INPUT -p tcp --dport 22 -o eth0 -i virbr0 -days Sat,Sun -j REJECT

    I have also tried many different ways to do this but nothing is working, I am always getting Bad Argument: 'Sat,Sun' error, also when i try to use --days it says it doesnt recognize it. If anyone could let me know what I am doing wrong that would be great. Thanks.

  2. #2
    Linux User
    Join Date
    Nov 2009
    Location
    France
    Posts
    292
    From iptables man pages :

    [!] --weekdays day[,day...]
    Only match on the given weekdays. Possible values are Mon, Tue, Wed, Thu, Fri, Sat, Sun, or values from 1 to 7, respectively. You may also use two-character variants (Mo, Tu, etc.).


    EXAMPLES. To match on weekends, use:
    -m time --weekdays Sa,Su
    0 + 1 = 1 != 2 <> 3 != 4 ...
    Until the camel can pass though the eye of the needle.

  3. #3
    Just Joined!
    Join Date
    Mar 2010
    Location
    Burlington, Canada
    Posts
    2
    Thank you! Worked perefectly.

Posting Permissions

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