Showing posts with label Unix. Show all posts
Showing posts with label Unix. Show all posts

Friday 28 July 2017

Reset Your Forgotten Ubuntu Password in 2 Minutes or Less





If you’ve ever forgotten your password, you aren’t alone… it’s probably one of the most common tech support problems I’ve encountered over the years. Luckily if you are using Ubuntu they made it incredibly easy to reset your password.
image
All it takes is adjusting the boot parameters slightly and typing a command or two, but we’ll walk you through it.
Reset Your Ubuntu Password
Reboot your computer, and then as soon as you see the GRUB Loading screen, make sure to hit the ESC key so that you can get to the menu.
image
Root Shell – Easy Method
If you have the option, you can choose the “recovery mode” item on the menu, usually found right below your default kernel option.
image[3]
Then choose “Drop to root shell prompt” from this menu.
image[6]
This should give you a root shell prompt.
Alternate Root Shell Method
If you don’t have the recovery mode option, this is the alternate way to manually edit the grub options to allow for a root shell.
First you’ll want to make sure to choose the regular boot kernel that you use (typically just the default one), and then use the “e” key to choose to edit that boot option.
image
Now just hit the down arrow key over to the “kernel” option, and then use the “e” key to switch to edit mode for the kernel option.
image
You’ll first be presented with a screen that looks very similar to this one:
image
You’ll want to remove the “ro quiet splash” part with the backspace key, and then add this onto the end:
rw init=/bin/bash
image
Once you hit enter after adjusting the kernel line, you’ll need to use the B key to choose to boot with that option.
image
At this point the system should boot up very quickly to a command prompt.
Changing the Actual Password
You can use the following command to reset your password:
passwd <username>
For example my username being geek I used this command:
passwd geek
image
After changing your password, use the following commands to reboot your system. (The sync command makes sure to write out data to the disk before rebooting)
sync
reboot –f
I found that the –f parameter was necessary to get the reboot command to work for some reason. You could always hardware reset instead, but make sure to use the sync command first.
And now you should be able to login without any issues.

Tuesday 26 July 2016

How to Use Microsoft Ready-Made VM Images for VMware and VBox

Microsoft Officially Offering Ready-Made VirtualBox And VMWare Images

Microsoft Offering ready made pre-installed windows operating system to test Internet Explorer  , virtual machine images are available for windows ,mac and linux virtualization solutions , for cross browser testing , so you can test your site in different operating systems .
IE versions being offered are:
  • IE7 on Vista
  • IE8 on Windows 7
  • IE9 on Windows 7
  • IE10 on Windows 8
Offered  VMs that will run on:
  • Windows
  • OSX
  • Linux
The VM software choices are specific to the OS you choose:
  • Windows – Hyper-V, Virtual PC, VirtualBox & VMWare Player
  • OSX- VirtualBox & VMWare Fusion
  • Linux – VirtualBox
Cross-browser testing  simplified
Cross-browser testing
simplified
You have to just download and open vbox files with virtualbox or vmx files with vmware and you will get all pre-installed windows operating system , and you are good to go ,
there is pre-installed windows 8 virtual image if you want to test drive windows 8 🙂
How to Install virtual images :
  1. Download Virtual Images
  2. extract it somehwhere
  3. open vmware player or workstation
  4. click on file >> open
  5. locate  ” somefile”.vmx
  6. it will load up virtual image component

Monday 19 August 2013

How To Install VMWare Tools v4 on Ubuntu 12.04 LTS Server



How To Install VMWare Tools v4 on Ubuntu 12.04 LTS Server and 12.10 Server

Written: March 13, 2012
Originally posted by: Justin Schier
Last Updated: October 24, 2012
Tested With: Ubuntu 12.10 Server, Ubuntu 12.04 LTS Server, Ubuntu 12.04.1 LTS Server, Ubuntu 11.10 Server

All the guides I found on the Internet, including VMWare’s website were outdated in some way, so I decided to write a guide of my own. I just went through these steps from start to finish on a fresh server and had no problems. In about 5 minutes, you will be able to install VMWare Tools on Ubuntu Server.
  1. Use Install VMWare Tools option in VMWare Client to attach media
    ubuntu vmware tools install 12.10 
  2. Update the server
  3. Create the mount point
  4. Mount the ISO

    You should see the message: mount: block device /dev/sr0 is write-protected, mounting read-only
  5. Change Directory
  6. Copy the tar file to your /tmp directory
  7. Install Build tools if necessary
  8. Change Directory
  9. Unmount the ISO
  10. Expand the tar
  11. Change Directory
  12. To prevent a potential error in the install script on Ubuntu 11.10+, create a special directory
    Unable to create symlink “/usr/lib64/libvmcf.so” pointing to file ”/usr/lib/vmware-tools/lib64/libvmcf.so/libvmcf.so”.
  13. Run the Install Script. The -d flag automatically answers the default to all questions. To customize it, just omit the -d.
  14. Reboot
Let me know if this worked for you!
Also, please follow me on Twitter: @justinschier

This is "How to do Computing" for everyday usage ...

Thursday 16 May 2013

Update script working with Backtrack 5

I could not find an update script working with Backtrack 5 so I decided to make a quick one.

Updated version: 2.0

Changelog Version 2.0
Code:
* Reviewed all tools.
* Compatible with Backtrack 5 R2/R3.
* Removed the menu.
Code:
git clone git://github.com/sickn3ss/backtrack_update.git
cd backtrack_update
chmod a+x backtrack5_update.py
./backtrack5_update.py
Screenshot:



If you know more tools I could add to the script in order to update them please feel free to post them here.
Also if you find any bugs or have any feedback feel free to contact me in this thread. I will update the thread with each update to the script.

NOTE: Please make sure you understand what the script does before running it.

Enjoy!

Saturday 23 March 2013

How to Setup Chroot Directory Structure ...



DebootstrapChroot



This article demonstrates a quick and easy way to create a chroot environment on an Ubuntu computer, which is like having a virtual system without the overhead of actual virtualization.
A chroot can be used for things like:
  • Running a 32-bit Firefox browser or a 32-bit Wine bottle on a 64-bit system.
  • Trying an older or newer Ubuntu release without reinstalling the operating system.
  • Trying a Debian release or other distribution derived from Debian.
  • Cross compiling and building packages for a different platform like Launchpad or Soyuz does it.

Example Configuration


In this example, we use a current Ubuntu 9.04 Jaunty system (the "host") to create a chroot for the older Ubuntu 8.04 Hardy release (the "target"). We are arbitrarily naming the new chroot environment hardy_i386 and putting it in the /srv/chroot directory on the host system.

Step 1: Install packages on the host computer.


First, install debootstrap, which is a utility that downloads and unpacks a basic Ubuntu system:

 $ sudo apt-get install debootstrap


Second, install schroot, which is a utility that wraps the regular chroot program and automatically manages chroot environments:

 $ sudo apt-get install schroot


Note: The debootstrap utility is usually backwards compatible with older releases, but it may be incompatible with newer releases. For example, the debootstrap that is bundled with Jaunty can prepare a Hardy chroot like we are doing here, but the debootstrap that is bundled with Hardy cannot prepare a Jaunty chroot.

If you have any difficultly with a debootstrap version mismatch, then visit http://packages.ubuntu.com/ to manually download and install the debootstrap package on the host system from the repository for the target release.

Step 2: Create a configuration file for schroot.


Choose a short name for the chroot, we use hardy_i386 in this example, and create a configuration file for it like this:

  sudo editor /etc/schroot/chroot.d/hardy_i386.conf


Note: In lucid the filename must not contain '.' , it should be lucid_i386_conf.
Put this in the new file:

  [hardy_i386]
  description=Ubuntu 8.04 Hardy for i386
  location=/srv/chroot/hardy_i386
  #personality=linux32
  root-users=bob
  run-setup-scripts=true
  run-exec-scripts=true
  type=directory
  users=alice,bob,charlie


Note: if you copy this example to your clipboard, be careful to start each line in column 1 before you save the new file! If you forget, the command schroot -l will fail with an error, e.g. 

E:/etc/schroot/chroot.d/hardy_i386.conf: line 0: Invalid line: “  [hardy_i386]”.

Note: for lucid use directory instead of location, e.g. directory=/srv/chroot/hardy_i386 .
Change these things in the example configuration file to fit your system:
  • location: This should be a directory that is outside of the /home tree. The latest schroot documentation recommends /srv/chroot.
  • personality: Enable this line if the host system is 64-bit running on an amd64/x64 computer and the chroot is 32-bit for i386. Otherwise, leave it disabled.
  • users: These are users on the host system that can invoke the schroot program and get access to the chroot system. Your username on the host system should be here.
  • root-users: These are users on the host system that can invoke the schroot program and get direct access to the chroot system as the root user.
Note: Do not put whitespace around the '=' character, and do not quote strings after the '=' character.

Step 3: Run debootstrap.


This will download and unpack a basic Ubuntu system to the chroot directory, similar to what the host system already has at the real root directory ("/").

 $ sudo mkdir -p /srv/chroot/hardy_i386
 $ sudo debootstrap --variant=buildd --arch=i386 hardy /srv/chroot/hardy_i386 http://archive.ubuntu.com/ubuntu/


This command should work for any distribution that is derived from Debian. Substitute the architecture "i386", the release name "hardy", and the repository address "http://archive.ubuntu.com/ubuntu/" appropriately. For example, do this to get the 64-bit build of Hardy instead of the 32-bit build:

  $ sudo debootstrap --arch=amd64 hardy /srv/chroot/hardy_amd64/ http://archive.ubuntu.com/ubuntu/


Note: Remember to change all instances of hardy_i386 to hardy_amd64 in the configuration file and on the command line if you actually do this.
Do something like this to get an upstream Debian release:

  $ sudo debootstrap --arch=amd64 sid /srv/chroot/sid_amd64/ http://ftp.debian.org/debian/


If trouble arises, debootsrap accepts a --verbose flag that may provide further insight.

Step 4: Check the chroot


This command lists configured chroots:tro
  $ schroot -l


If hardy_i386 appears in the list, then run:
  $ schroot -c hardy_i386 -u root


Note: This should work without using sudo to invoke the schroot program, and it should result in a root prompt in the chroot environment. Check that the root prompt is in a different system:

  # lsb_release -a


For the Hardy system that we just built, the lsb_release command should print:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 8.04
Release:        8.04
Codename:       hardy

We're done!

WARNING


For convenience, the default schroot configuration rebinds the /home directory on the host system so that it appears in the chroot system. This could be unexpected if you are familiar with the older dchroot program or the regular chroot program because it means that you can accidentally delete or otherwise damage things in /home on the host system.

To change this behavior run:
  $ sudo editor /etc/schroot/mount-defaults


And disable the /home line so that the file reads:

  # mount.defaults: static file system information for chroots.
  # Note that the mount point will be prefixed by the chroot path
  # (CHROOT_PATH)
  #
  # <file system> <mount point>   <type>  <options>       <dump>  <pass>
  proc            /proc           proc    defaults        0       0
  /dev/pts        /dev/pts        none    rw,bind         0       0
  tmpfs           /dev/shm        tmpfs   defaults        0       0
  #/home           /home           none    rw,bind         0       0
  /tmp            /tmp            none    rw,bind         0       0


The mount.defaults file is the /etc/fstab for chroot environments.

Hints


Install the ubuntu-minimal package in a new chroot after you create it:

  $ schroot -c hardy_i386 -u root
  # apt-get install ubuntu-minimal

If you get locale warnings in the chroot like "Locale not supported by C library." or "perl: warning: Setting locale failed." , then try one or more of these commands:

  $ sudo dpkg-reconfigure locales

  $ sudo apt-get install language-pack-en

  $ locale-gen en_US.UTF-8


If your preferred language is not English, then change "-en" and "en_US" appropriately.
As of Lucid, schroot has changed in these ways:
  • The file should be named: /etc/schroot/chroot.d/hardy-i386
  • The keywords in the file have changed and some have been deprecated. Additionally, keywords have to start at the beginning of the line. The file should read:
  [hardy-i386]
  description=Ubuntu 8.04 Hardy for i386
  directory=/srv/chroot/hardy-i386
  #personality=linux32
  root-users=bob
  type=directory
  users=alice,bob,charlie


As of Maverick schroot has further changed in these ways:
  • The configuration file should be stored in /etc/schroot/

TLDR


There's a much simplier way to get a basic chroot environment from an ISO image; if the text above seems TLDR, try this.

First of all, install Ubuntu Customization Kit:

  $ sudo apt-get install uck


Then set the directory in which you want to create the chroot environment:
  $ export BASEDIR=/path/to/chroot/directory/


Unpack the ISO image (this may take quite some time):
  $ sudo uck-remaster-unpack-iso /path/to/your/image.iso "$BASEDIR" && sudo uck-remaster-unpack-rootfs "$BASEDIR" && sudo uck-remaster-unpack-initrd "$BASEDIR"


You're done! Now, to enter the chroot environment, just execute
  $ sudo uck-remaster-chroot-rootfs /path/to/chroot/directory/


every time you wish to enter the chroot console. To leave it, type "exit".
To be able to run X applications, e.g. gedit, run

  # HOME=/root


in the chroot environment. 

How to Create a Ansible Lab on your Local Machine using Vagrant in 5 min using ChatGPT

This is an exciting experiment of mine as DevOps. As I am experimenting with the Tools available ... So, the quest is to " Vagrantfile ...