Wednesday, December 18, 2013

Expanding a FREENAS ZFS volume by drive replacement

Freenas is a great NAS solution especially given the price and the hardware of other NAS solutions; Freenas offers the best performance, expandability, value and flexibility in a NAS solution.  Freenas can provide NFS, Samba and Apple shares so the platform you want to use really doesn't matter what the client machine is.

Just reciently I've found my self down to 100GB of my 6.4 TB NAS and decided it was time to upgrade my storage space.  Now upgrading storage space on freenas isn't as simple as just replacing a bunch of drives; you must replace them one at a time and you wait for the drive to be completely replaced (resilvered) before replacing another drive otherwise you risk data corruption or loss.  By default the auto grow is set to off so if you want to grow the space on your nas you must enable the auto expand feature in freenas.  As always you should have another backup of this data.

So on your FreeNAS server you want to login via SSH or use the shell console provided in the web interface.  Type the following command.

zpool set autoexpand = on {your volume name}

Once that is enabled you may now grow your freenas storage by replacing drives.  As for myself I've replaced 4 320GB drives with 4 1TB drives moving my NAS from 6.4 GB to 8.3GB of storage space and to replace the drives it is a daily process with replacing a drive once a day until they are done.

Thursday, December 12, 2013

Backing up your Android Phone's Stock Rom and Recovery

Backing up your Android Phone's Stock Rom and Recovery

Have you ever wanted to mod your new android phone but wanted a way to get back to the factory settings without having to mod the phone first?  It is possible to do but you need a few things, the Android Dev tools, fast boot, and some command line know how.  For this example I will be using a HTC One X on the Telus Network.

With HTC you have to get a developer token which can be obtained from http://www.htcdev.com.  You will have to sign up as a dev to get your developer token.  HTC has a great tutorial on how to unlock your bootloader on the htcdev site.
Once your bootloader is unlocked you can now download a 3rd party rom manager (don't worry we are just going to boot off it; were not installing it yet - also make sure you have enabled USB Debugging in the developer tools).  I used TWRP, it is more compatible with my device then clockworkmod is.  Once downloaded (I renamed the downloaded rom manager to recovery.img) and moved it into my fastboot directory on my computer.


Here is a look at the fastboot directory on my computer

Now the fun can begin; make sure you have all the files you need in the directory your working out of, in my case the fastboot directory.  Your phone should be plugged in via usb to your computer then I used adb to reboot my phone into the bootloader

C:\fastboot>adb reboot bootloader

Then I booted off the recovery.img file in my fastboot directory.

C:\fastboot>fastboot boot recovery.img


Then your phone should boot off the custom recovery rom without installing it.  Then you can make a backup using the recovery rom.  Once done reboot into the phone's system and load a file manager like ES File Explorer to get the files off using dropbox or some other means.

Now you have a backup of your stock phone and you can now mod your phone to your heart's content.

Update:  I forgot to mention that with HTC you also have to update your boot.img file using the commandline interface.  To get the boot.img file you can get it by extracting it from your backup or the zip file from your thrid party rom like cyanogenmod.

C:\fastboot>fastboot flash boot boot.img

Thursday, November 21, 2013

Freenas Format Error: Operation Not Permitted

Freenas Format Error

If your trying to erase a drive in freenas and you get an error "Can't Erase Drive /dev/: Operation not permitted it is happening because of GEOM's protection of the MBR of the disk drive.

To solve this turn off the sysctl variable from the console.

sysctl kern.geom.debugflags=0x10


Wednesday, November 13, 2013

Connecting A Mac To A Windows Share

Connecting A Mac to a Windows Share



With the exception of mobile devices we still live in a "Windows World" and with the latest version of OS X comes an update on how to connect to a windows share using SMB2 instead of SMB.

On Mac OS X (Pre Mavericks or 10.9) we connected to a windows share using smb.

From the Finder press the "Command" + "K" keys or go to the "Go" menu and select Connect to Server.  In the server address field put in either smb for pre 10.9 or cifs for 10.9

On a workgroup it looks something like this:

smb://thecomputer/sharedfolder

On an active directory the samba setup it looks more like this

smb://domain.ext/dfs/sharedfolder on a domain using a DFS Share

Now on OS X Mavericks we use cifs to connect to the windows shares.

cifs://thecomputer/sharedfolder on a workgroup and 

cifs://theremotecomputer/sharedfolder$ on a domain using a DFS Share

If you are not logged into the domain or if the share doesn't have anonymous access it will prompt you for a username and password.

Friday, November 08, 2013

How to ssh into a Linux/Unix System without a password

Login to a Linux/Unix System without a password 



Setting up SSH/RSH Keys for Remote Administration Under Linux/Unix can be one of the most time saving things you can do.  I've set this up because I am managing a dozen Linux based kiosks based Lubuntu Linux and Mozilla FireFox on that need to remotely shutdown and startup.

For managing the kiosks I am using Ubuntu 12.04 LTS, on a VLAN network.  This server also remotely shuts down some Windows based stations and is used for Imaging using the FOG project.  I need to update the RSH Public and Private Key because I have replaced the server.

Setting up RSH Public and Private keys are trivial but this allows me to control the systems without having to enter a password every time I want to do something to the computer (besides something that requires root privileges).

The first thing I do on the computer I want to control the other computers with is generate a public and private key.  I've done this in a .ssh directory using the Terminal

$ mkdir -p $HOME/.ssh
$ chmod 0700 $HOME/.ssh
$ ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P ''

This should create two files, $HOME/.ssh/id_dsa (private key) and $HOME/.ssh/id_dsa.pub (public key).

In my case I'm using a script called dafturn-ofris which is kind of a steady state script for linux which prevents users from making changes to the system and rebooting restores the system to the state it was frozen in.  So I unfreeze the client system (the system I want to control remotely) and copy the public key from the "Server" to the client; I used SCP to accomplish this.

On the computer you created the key on open the Terminal move to the directory you generated the public key.  In my case it is the .ssh folder in the $HOME directory of the user I'm logged in as.

$ scp id_dsa.pub username@remotehost:directory/to/save/it/in/

Enter in your password and this will complete the file copy.

Then login the remote client move into the directory where you saved the public key and run the following commands.

$ cat id_dsa.pub >> $HOME/.ssh/authorized_keys2
$ chmod 0600 $HOME/.ssh/authorized_keys2

Depending on the version of OpenSSH your using the following commands may also be required.

$ cat id_dsa.pub >> $HOME/.ssh/authorized_keys
$ chmod 0600 $HOME/.ssh/authorized_keys

An alternative is to create a link from authorized_keys2 to authorized_keys; your choice.

$ cd $HOME/.ssh >> ln -s authorized_keys2 authorized_keys

Now you should be able to remote into the client computers you want to control from the server computer without being prompted for a password; with the exception of root access.  I use this for running rsh command that remotely shuts down client stations when its closing time.

Source Credit: http://csua.berkeley.edu/~ranga/notes/ssh_nopass.html

Tuesday, February 26, 2013

Creating A Secure Password

Creating a Secure Password

Password security is critical to your online life. If you don't have a secure password you will be easily hacked, many passwords are set to be 12345 or password.  



The best passwords have upper and lower case, numbers and alternate characters like underscores, dashes, asterix and are long typically over 8 characters; 8 characters would be a minimum length for a password today. Try remembering this password created by Data on Star Trek The Next Generation.

Creating a good password is hard, and making one you can remember is even harder but not impossible. 

Elements Every Password Should Have: 

  • Be longer then 8 characters should be more like 20
  • Not be a dictionary password 
  • Should have at least 2 numbers
  • Should have at least 2 capitals 
  •  It should have at least one alternate character
  • Should not be the SAME PASSWORD on every site.

Here is a form to help you create a good password; please fill out the following:

Favorite Animal/Colour/Activity: ______________________________________ 

 Favorite Object/Word/Family Member: ________________________________

Select one of the or more of the following characters: ! @ # $ % ^ & * ( ) _ - + = | ? / 

Put down your favorite Number ____________________ 
(if your favorite number is a single digit please put a 0 in front of it. Ie. 01) 

Example: 

Favorite Animal/Colour/Activity: __cat

 Favorite Object/Word/Family Member: _orange

 Select one of the or more of the following characters: ! @ # $ % ^ & * ( ) _ - + = | ? / Put down your favorite Number ______24_______ 

Your password can be OrangeCat@24 or other variants can be used what ever is easiest to remember.


Password Testers

Password Generators

Crazy Password Generators 

For the regular user expecting them to change their password every two weeks for all their online services is pretty crazy.  However for them to have a tiered password system or create a good password that is related to the site you are visiting but not obvious using the rules shown above.  For example if I create a hotmail account I might make my password something like MyOrang3h0tM@!lAcc0unt24

And in case your wondering it would take an average desktop over 18 trillion years to crack my password.  How about yours, try it out on http://howsecureismypassword.net/

Creating A Secure Password

Creating a Secure Password

Password security is critical to your online life. If you don't have a secure password you will be easily hacked, many passwords are set to be 12345 or password.  

Here is an example of a bad password. https://www.youtube.com/watch?v=a6iW-8xPw3k



The best passwords have upper and lower case, numbers and alternate characters like underscores, dashes, asterix and are long typically over 8 characters; 8 characters would be a minimum length for a password today. Try remembering this password created by Data on Star Trek The Next Generation.

Creating a good password is hard, and making one you can remember is even harder but not impossible. 

Elements Every Password Should Have: 

  • Be longer then 8 characters should be more like 20
  • Not be a dictionary password 
  • Should have at least 2 numbers
  • Should have at least 2 capitals 
  •  It should have at least one alternate character
  • Should not be the SAME PASSWORD on every site.

Here is a form to help you create a good password; please fill out the following:

Favorite Animal/Colour/Activity: ______________________________________ 

 Favorite Object/Word/Family Member: ________________________________

Select one of the or more of the following characters: ! @ # $ % ^ & * ( ) _ - + = | ? / 

Put down your favorite Number ____________________ 
(if your favorite number is a single digit please put a 0 in front of it. Ie. 01) 

Example: 

Favorite Animal/Colour/Activity: __cat

 Favorite Object/Word/Family Member: _orange

 Select one of the or more of the following characters: ! @ # $ % ^ & * ( ) _ - + = | ? / Put down your favorite Number ______24_______ 

Your password can be OrangeCat@24 or other variants can be used what ever is easiest to remember.


Password Testers

Microsoft Password Checker
http://www.passwordmeter.com
http://howsecureismypassword.net

Password Generators

http://www.testyourpassword.com/ 

Crazy Password Generators 

https://www.grc.com/passwords.htm 
https://www.grc.com/ppp.htm 


Top 500 Worst Passwords 

For the regular user expecting them to change their password every two weeks for all their online services is pretty crazy.  However for them to have a tiered password system or create a good password that is related to the site you are visiting but not obvious using the rules shown above.  For example if I create a hotmail account I might make my password something like MyOrang3h0tM@!lAcc0unt24

And in case your wondering it would take an average desktop over 18 trillion years to crack my password.  How about yours, try it out on http://howsecureismypassword.net/

How to fix CURL call imporitng an RSS feed on a site blocking CURL calls

There is a 3rd party service provider that my organization uses called bibliocommons.  They have these nice book carousels.  However the car...