Syed Jahanzaib Personal Blog to Share Knowledge !

November 25, 2009

*niX+WIN: Howto Remotely Shutdown Pc’s using *niX+WIN

Filed under: Linux Related — Syed Jahanzaib / Pinochio~:) @ 3:08 PM

*niX:

Using this command, you can remotely shutdown any windows/domain pc  from linux.

net rpc shutdown -t 30 -f -C “must not be empty” -W yourdomain.com -U “administrator%yourpass” -I 192.168.0.1
From windows to windows :

*WIN 2k3 / xp:
shutdown /s /f /t 0 /m \\192.168.0.234

*WIN 2k:
tsshutdn.exe /POWERDOWN /DELAY:1 /SERVER:192.168.0.235

November 22, 2009

DOS: Howto add delay to your file

Filed under: Microsoft Related — Syed Jahanzaib / Pinochio~:) @ 6:50 AM

 

ping -n 2 -w 1000 127.0.0.1 > NUL

 

Where as -n defines how many seconds it should wait.

November 16, 2009

niX* # Setting the time of your system

Filed under: Linux Related — Syed Jahanzaib / Pinochio~:) @ 7:24 AM

Follwing are the commands to set your linux base OS time , SOftware & Hardware clos, both.

date -s "2 OCT 2006 18:00:00"
hwclock --set --date='08/18/07 21:08:40' --localtime

November 14, 2009

MYSQL: Howto Change root password!

Filed under: Linux Related — Syed Jahanzaib / Pinochio~:) @ 6:45 AM

Mysql Password Recovery

Short References for Mysql Passwords related issues:

 

Mysqladmin command to change root password

If you have never set a root password for MySQL, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows:

mysqladmin -u root password NEWPASSWORD

However, if you want to change (or update) a root password, then you need to use following command

mysqladmin -u root -p'oldpassword' password newpass

For example, If old password is abc, and set new password to 123456, enter:

mysqladmin -u root -p'abc' password '123456' 

HOWTO CHANGE MYSQL ‘FORGOTTEN’ ROOT PASSWORD

If you dont know the old mysql ROOT password and want to reset it, follow these steps !

First of all you will need to ensure that your database is stopped:


/etc/init.d/mysql stop

ps -A | grep mysql

Now you should start up the database in the background, via mysqld_safe syntax

sudo mysqld_safe --skip-grant-tables &

Now that the server is running with the --skip-grant-tables flag you can connect to it without a password and complete the job:

mysql

Use the following commands to change the password of mysql root user

UPDATE mysql.user SET Password=PASSWORD(‘new_password’) WHERE User=’root’;
FLUSH PRIVILEGES;
exit

sudo pkill mysql*

Now start the MYSQL

service mysql start

Now everything should be done and you should have regained access to your MySQL database(s); you should verify this by connecting with your new password:

mysql -u root -p

If you’d like to automate this process you could start by looking at this simple shell script which will allow you to reset a password with one command.

MYSQL: Howto create new Database Entry!

Filed under: General IT Related, Linux Related, Microsoft Related — Syed Jahanzaib / Pinochio~:) @ 6:35 AM

On a default settings, mysql root user do not need a password to authenticate from localhost. In this case, ou can login as root on your mysql server using:

$ mysql -u root

If a password is required, use the extra switch -p:

$ mysql -u root -p
Enter password:

Now that you are logged in, we create a database:

mysql> create database zaibdb;
Query OK, 1 row affected (0.00 sec)

We allow user root to connect to the server from localhost using the password 123456:

mysql> grant usage on *.* to root@localhost identified by ‘123456’;
Query OK, 0 rows affected (0.00 sec)

And finally we grant all privileges on the zaibdb database to this user:

mysql> grant all privileges on zaibdb.* to root@localhost ;
Query OK, 0 rows affected (0.00 sec)

And that’s it. You can now check that you can connect to the MySQL server using this command:

$ mysql -u root -p’123456′ zaibdb
Your MySQL connection id is 12
Server version: 5.0.38-Ubuntu_0ubuntu1-log Ubuntu 7.04 distribution

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql>

Disable the Shutdown Event Tracker

Filed under: Microsoft Related — Syed Jahanzaib / Pinochio~:) @ 6:28 AM

Disable the Shutdown Event Tracker

If the event tracker is of no use to you then you can disable it. To do this, open the Group Policy Object Editor Console.
Go to Start > Run…, type gpedit.msc and press OK.

Navigate to Computer Configuration > Administrative Templates > System and in the right hand pane, select the “Display Shutdown Event Tracker” setting.

Double Click this setting to open the Properties page. You are now given the option to leave it in a default state of Not Configured, set it to Always Enabled, Enabled for Servers/Workstations (Windows XP Pro) or Disabled completely (as the image below demonstrates).

Note:
When you enable the Group Policy for Server only, the Shutdown Event Tracker appears when you shut down a computer running Windows 2003, whereas for Workstation only, the Shutdown Event Tracker appears when a computer running Windows XP Professional is shut down.

After you make the change to the Group Policy, open the Command Prompt and run the gpupdate /force command to refresh the policy and have your settings be applied straight away. Alternatively you can just restart the machine.

When you next attempt to shutdown or restart the machine, the Shutdown event tracker will no longer be visible and the normal shutdown prompt will appear (as seen in the image below).

Fix Windows MBR (remove *niX GRUB)

Filed under: General IT Related, Linux Related, Microsoft Related — Syed Jahanzaib / Pinochio~:) @ 6:21 AM


Using Windows XP

In Windows XP, you can uninstall GRUB as follows:

Boot from the Windows XP CD and
Press the “R” key during the setup in order to start the Recovery Console.

Select your Windows XP installation from the list and enter the Administrator Password.
At the input prompt, enter the command “FIXMBR” and confirm the query with “y“.
The MBR will be rewritten and GRUB will be uninstalled. Press “exit” to reboot the computer.

The MBR will be rewritten and GRUB will be uninstalled.

*nix- Howto Change IP Address from CLI

Filed under: Linux Related — Syed Jahanzaib / Pinochio~:) @ 6:07 AM

Today, i just installed a new OS on a computer. i installed fedora 11, n i have to change my ip adress, Originally when i installed the os, i set it to DHCP, but now i want to change it to a static ip. so if you are in the same situation as i am, maybe you can learn from this on how you can change your ip address ..

these are the steps i took to make it happen

1. login as root

2. get your current IP address with this command:

ifconfig

The OUTPUT will look someting like this:

[root@host ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:D0:BC:08:09:BC
inet addr:70.238.17.69 Bcast:255.255.255.255 Mask:255.255.255.248
inet6 addr: fe80::2d0:b7ff:fe08:9bb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:7174 errors:0 dropped:0 overruns:0 frame:0
TX packets:2305 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:5339910 (5.0 MiB) TX bytes:170109 (166.1 KiB)

 

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:34 errors:0 dropped:0 overruns:0 frame:0
TX packets:34 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4275 (4.1 KiB) TX bytes:4275 (4.1 KiB)

OR you can also get the ip from the network configuration file wit this command:
COMMAND to show configuration:

cat /etc/sysconfig/network-scripts/ifcfg-eth0

THe OUTPUT will look like this (i have it set to DHCP)

DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:D0:B7:08:09:BB
ONBOOT=yes

OUTPUT for static IP (example)

#
# File: ifcfg-eth0
#
DEVICE=eth0
IPADDR=192.168.1.100
NETMASK=255.255.255.0
BOOTPROTO=static
ONBOOT=yes
#
# The following settings are optional
#
BROADCAST=192.168.1.255
NETWORK=192.168.1.0

3. Ok, on step 3 we are going to change from DHCP to static ip. so send this command to edit the /etc/sysconfig/network-scripts/ifcfg-eth0 file: (im using nano, but you can use vi if you want)

nano /etc/sysconfig/network-scripts/ifcfg-eth0

Change from this:

# Intel Corporation 82557/8/9 [Ethernet Pro 100]
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:D0:B7:08:09:BB
ONBOOT=yes

TO this:

# File: ifcfg-eth0
#
DEVICE=eth0
IPADDR=192.168.1.100
NETMASK=255.255.255.248
BOOTPROTO=static
ONBOOT=yes

4. now save your changes and reboot your server.

How to reset a root password!

Filed under: Linux Related — Syed Jahanzaib / Pinochio~:) @ 6:04 AM

Entering Recovery Mode

While you system is starting up, hold down the Ctrl key or Esc to see the boot loader menu. After you see the menu:

  • Use the arrows to select the boot entry you want to modify.
  • Press e to edit the entry.
  • Use the arrows to go to kernel line.
  • Press a or e to append this entry.
  • At the end of the line add the word single or the number 1.
  • Press Enter to accept the changes.
  • Press b to boot this kernel.

A series of text messages scrolls by and after a short time, a root prompt appears awaiting your commands (#).

As root, changing password does not ask for your old password. Run the command:

# passwd

November 12, 2009

XP WINNT.SIF (Unattended Installation Sample File)

Filed under: Microsoft Related — Syed Jahanzaib / Pinochio~:) @ 10:49 AM

;SetupMgrTag
[Data]
AutoPartition=0
MsDosInitiated=”0″
UnattendedInstall=”Yes”

[Unattended]
UnattendMode=FullUnattended
OemSkipEula=Yes
OemPreinstall=No
TargetPath=\WINDOWS

[GuiUnattended]
AdminPassword=e4f7b0b2946809c726f8092a33daaf056714422d775abe4da1db92691efb8889
EncryptedAdminPassword=Yes
AutoLogon=Yes
AutoLogonCount=10
OEMSkipRegional=1
OemSkipWelcome=1
TimeZone=-2147483570
OemSkipWelcome=1

[UserData]
ProductKey=QW4HD-DQCRG-HM64M-6GJRK-8K83T
FullName=”SYED JAHANZAIB”
OrgName=”N.A.E.I (Pvt) Ltd.”
ComputerName=KHIA-PCX

[Display]
BitsPerPel=16
Xresolution=800
YResolution=600
Vrefresh=60

[TapiLocation]
CountryCode=92
Dialing=Tone
AreaCode=92

[RegionalSettings]
LanguageGroup=1
SystemLocale=00000409
UserLocale=00000409
InputLocale=0409:00000409

[Branding]
BrandIEUsingUnattended=Yes

[URL]
Home_Page=http://192.168.0.3
Help_Page=http://192.168.0.3
Search_Page=http://www.google.com

[Proxy]
Proxy_Enable=1
Use_Same_Proxy=1
HTTP_Proxy_Server=192.168.0.3:8080
Proxy_Override=<local>

[GuiRunOnce]
Command0=\\192.168.0.4\softwares\Antivirus\NOD32\setup.bat
Command1=\\192.168.0.4\softwares\OFFICE2003\setup-lg.bat
Command2=\\192.168.0.4\softwares\mspclient\setup.bat
Command3=\\192.168.0.4\softwares\tools\winrar.exe
Command4=\\192.168.0.4\softwares\GRAPHICS\acrobat5.exe
Command5=”\\192.168.0.4\softwares\GRAPHICS\ABLE2EXTRACT\Able2Extract V3.exe”
Command6=\\192.168.0.4\softwares\Antivirus\PATCHES\CONFIKER_WORM_XP_PATCH\WindowsXP-KB958644-x86-ENU-CONFIKER.exe

[Identification]
JoinWorkgroup=WORKGROUP

[Networking]
InstallDefaultComponents=No

[NetAdapters]
Adapter1=params.Adapter1

[params.Adapter1]
INFID=*

[NetClients]
MS_MSClient=params.MS_MSClient

[NetServices]
MS_SERVER=params.MS_SERVER

[NetProtocols]
MS_TCPIP=params.MS_TCPIP

[params.MS_TCPIP]
DNS=No
UseDomainNameDevolution=No
EnableLMHosts=Yes
AdapterSections=params.MS_TCPIP.Adapter1

[params.MS_TCPIP.Adapter1]
SpecificTo=Adapter1
DHCP=No
IPAddress=192.168.0.131
SubnetMask=255.255.255.0
DefaultGateway=192.168.0.3
DNSServerSearchOrder=192.168.0.1,192.168.0.3
WINS=No
NetBIOSOptions=0

Older Posts »

Blog at WordPress.com.

%d bloggers like this: