Syed Jahanzaib Personal Blog to Share Knowledge !

December 7, 2011

Mikrotik Howto Add Schedule to Run the Script

To add schedule to run any specific script at specific scheduled time, Follow the steps Below.

1) First create the script
2) Schedule it to run it at desired time.

SCENARIO # 1 | Allow user JOHN access to internet in Lunch Timings Only . . .

You have created a rule that blocks user John internet access all the time (In this example, we disable user id JOHN, it can also be done via creating firewall rule to block access, but for this example we will use disable strategy), but you want him to use internet from 1:00pm til 2:00pm. You have to create two scripts, first that will disable the “Block user john rule” at 1 pm and the second script that will enable the “Block user john rule” at 2 pm.

Here is the “Block user john rule

/ppp secret add caller-id="" comment="" disabled=no limit-bytes-in=0 limit-bytes-out=0 local-address= name=john password=123 profile=default routes="Testing ID" service=any

Here are the Scripts examples in following screenshots.

Now ADD the following Scheduler to Execute both scripts at desired timing.

# Enable-User-John-Script at 1PM (Interval 1d so it may run every day)
# Disable-User-John-Script at 2PM (Interval 1d so it may run every day)


[admin@MikroTik] > /system script export
/system script
add name=disable-user-john-script policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive source="/ppp secret disable john"
add name=enable-user-john-script policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive source="/ppp secret enable john"


[admin@MikroTik] > /system scheduler export
/system scheduler
add comment="" disabled=no interval=1d name="Enable User JOHN at 1pm" on-event=Enable-user-john-script policy=reboot,read,write,policy,test,password,sniff,sensitive start-date=dec/07/2011 start-time=13:00:00
add comment="" disabled=no interval=1d name="Disable User JOHN at 2pm" on-event=Disable-user-john-script policy=reboot,read,write,policy,test,password,sniff,sensitive start-date=dec/07/2011 start-time=14:00:00

Another example on howto disable Web Proxy Access Rule.

SCENARIO # 2 | Block Access to Facebook, and Allow only in Lunch Timings

You have blocked access to social networking web sites Facebook and you want that users can access it only in Lunch timings, which is from 1:00pm till 2:00pm. I assume you are using Mikrotik web proxy [transparent mode], (If not, you can block the access via ip pool + firewall filter, adjust it accordingly, its only an example)

For example you have created an rule in web.proxy to block Facebook, (BLOCK-FB rule) which blocks Face-book site , example below

/ip proxy access
add action=deny comment=fb disabled=no

(Don’t forget the ‘comments’ in rule) and Now you want to Allow access to FB from 1:00 pm till 2:00 pm,
You have to create two Scripts, one that will disable the BLOCK-FB rule,
and second that will enable the BLOCK-FB rule.

Disable-fb-rule Script

/ip proxy access disable [find comment="fb"]

Enable-fb-rule Script

/ip proxy access enable [find comment="fb"]

OR you can Add scripts via following code in TERMINAL.

/system script
add name=disable-fb-rule-script policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive source="/ip proxy access disable [find comment=\"fb\"]"
add name=enable-fb-rule-script policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive source="/ip proxy access enable [find comment=\"fb\"]"

Now add schedule to Run “disable-fb-rule-script” to run at 1:00 pm Daily,
Add another schedule to Run “enable-fb-rule-script” to run at 2:00 pm Daily,

/system scheduler
add comment="" disabled=no interval=1d name="Disable fb rule schedule" on-event="disable-fb-rule-script"  start-date=dec/08/2010 start-time=01:00:00
add comment="" disabled=no interval=1d name="Enable fb rule schedule" on-event="enable-fb-rule-script"  start-date=dec/08/2010 start-time=02:00:00

SCENARIO # 3 | Reboot RB daily in  night

Following script will create a schedule, which will reboot RB daily in night at 1:00am.

/system scheduler
add comment="Reboot every 1 day" disabled=no interval=1d name=Reboot1d on-event="/system reboot" policy=ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive start-date=Nov/14/2012 start-time=01:00:00

December 2, 2011

Ubuntu Howto change ROOT password after fresh installation


Howto Recover User Forgotten Password  [ UBUNTU  12.x ]

1. Reboot your ubuntu computer
2. Hold shift during boot to start GRUB menu
3. Highlight your image and press ‘e’ to edit
4. Find the line starting with linux and append init=/bin/bash at the end of that line
5. Press ctrl-x to boot.
6. Type in passwd username
7. Set your password.
8. Type in reboot

2# Howto enable ROOT access in Ubuntu after fresh installation

When you install fresh Ubuntu, you can login via normal user account , & root access is not enabled by default  . In Ubuntu , root ID is created without predefined password, it does not have a password, but it does not have an empty password either , ggrrrrrrr Although you can use sudo command (which is also a kind of failsafe to prevent accidentally execution of unwanted mistakes or commands) to execute any task that requires root access, but still if you are doing some administrative related work, its a bit annoying to use sudo before every command.

To assign/change  root password , use the following command at terminal

sudo passwd root

It will ask you to enter current user password, enter it and then it will ask you to enter new root password two times, enter your desired password. Now you can login to root by


It will ask you to enter root password, simply enter password that you set in above step.

… OR …

Alternate method is following …

Use below command to switch to shell world

sudo sh

It will ask you the default current user password, just enter your password and press Enter and you will be presented with # sign.

Now enter this command to change the root password.

passwd root

Now enter your new password for user root twice and now you can login to root by using your newly created password by using . . .

su root



Syed Jahanzaib

Howto solve Ubuntu 9/10 apt-get not updating error

Filed under: Linux Related — Tags: , , , , — Syed Jahanzaib / Pinochio~:) @ 11:03 AM

If you are STILL using UBUNTU 9.10 [Karmic Koala], in which updates are not supported anymore, & It will refuse to Update / install any new app using apt-get, BUT you can still use it by adding following repositories in /etc/apt/sources.list

Remove all older lines and add the following lines in /etc/apt/sources.list using nano or gedit whatever you like.

For Ubuntu Ver 9 Karmic koala

deb karmic main  restricted
deb-src karmic main  restricted
deb karmic-updates main restricted
deb-src karmic-updates main  restricted
deb karmic universe
deb-src karmic universe
deb karmic-updates universe
deb-src karmic-updates universe
deb karmic multiverse
deb-src karmic multiverse
deb karmic-updates multiverse
deb-src karmic-updates multiverse
deb karmic-security main restricted
deb-src karmic-security main restricted
deb karmic-security universe
deb-src karmic-security universe
deb karmic-security multiverse
deb-src karmic-security multiverse

After changing the sources list, first update apt.

apt-get update

then try installing any package , for example.

atp-get install openssh-server

It should work fine.



# deb cdrom:[Ubuntu-Server 10.04.3 LTS _Lucid Lynx_ - Release i386 (20110719.2)]/ lucid main restricted
deb lucid main restricted
deb-src lucid main restricted
deb lucid-updates main restricted
deb-src lucid-updates main restricted
deb lucid universe
deb-src lucid universe
deb lucid-updates universe
deb-src lucid-updates universe
deb lucid multiverse
deb-src lucid multiverse
deb lucid-updates multiverse
deb-src lucid-updates multiverse
deb lucid-old-releases main restricted
deb-src lucid-old-releases main restricted
deb lucid-old-releases universe
deb-src lucid-old-releases universe
deb lucid-old-releases multiverse
deb-src lucid-old-releases multiverse


« Newer Posts

%d bloggers like this: