Sunday, February 24, 2013

How to encrypt a partition with Cryptoloop

http://how-to.linuxcareer.com/how-to-encrypt-a-partition-with-cryptoloop


1. Introduction

This article will describe how to encrypt entire partition with a Cryptoloop. Cryptoloop is a disk encryption module for Linux. It was first introduced in the 2.5.x kernel series. Cryptoloop has an ability to create an encrypted file system on a single partition or within a regular file, which can later simply be mounted by the mount command. Cryptoloop uses so called loopback device, which needs to be called with any file system request. Currently there are many alternatives for Cryptoloop usage and the most common is Loop-AES. This article will explain a simple usage of the cryptoloop module for partition encryption and mounting within a Linux Operating system.

2. Prerequisites

As it was already mentioned the cryptoloop module was introduced to Linux with the 2.5 kernel series. Therefore, the chances are that this module is already available on your system. To confirm that the cryptoloop module is available on your system run:
# lsmod | grep cryptoloop
cryptoloop             12671  1
If no output has been produced that means that the module is unavailable and you will need to load it with:
# modprobe cryptoloop
Another tool, which we are going to need is losetup, which should be already a variable on your system.

3. Setting up a loopback device

Cryptoloop can be used to create an encrypted filesystem within the entire partition or single file. The procedure is the same for both of them. The only difference is the supplied argument either to be a path to a regular file or to block the device. As an example in this tutorial we will encrypt a block device /dev/sdb1.
First, we can make sure to overwrite entire partition with some random data. This step is optional but recommended.
WARNING: note that the below command will physically erase any data you may already have on your partition:
# dd if=/dev/urandom of=/dev/sdb1 bs=1M
Disregard any possible error message about a full disk space.
In the next step we need to choose a type of encryption. A list of encryption algorithm available on your system can be seen by the following command:
 # cat /proc/crypto
We will use AES encryption algorithm. In the next step we use the losetup utility to attach our /dev/sdb1 block device to the system's loopback device /dev/loop0.
# losetup -e aes -k 256 /dev/loop0 /dev/sdb1
Password:
You will be prompted to enter a password, which will be used to mount and unmount your partition. Choose a strong password right from the beginning as there is no easy way to change this password later.

4. Create a filesystem

Linux Career Jobs and AdsAt this point we should have our /dev/sdb1 partition attached to /dev/loop0 with AES 256 bit encryption. Next we use the /dev/loop0 device to create a filesystem. Feel free to use any type of filesystem you deem it to be worthy. I will use ext4:
# mkfs.ext4 /dev/loop0

5. Mounting Loopback device

To mount a loopback device in this case is as simple as mounting any other block devices. First, we need to create a mount point:
# mkdir /mnt/cryptoloop
Once ready, we use the mount command to mount /dev/loop0 as ext4 filesystem:
# mount -t ext4 /dev/loop0 /mnt/cryptoloop/
At this point we are able to navigate to /mnt/cryptoloop/  and store some data. For example, let's create a new file foo.txt:
# echo LinuxCareer.com > foo.txt
Once you finish using your new encypted filesystem you simply unmount it and detach it from a loopback device:
# umount /mnt/cryptoloop/
# losetup -d /dev/loop0
After executing the above commands your data ( foo.txt ) will no longer be available.

6. Cryptoloop permanent mount

Once the new /dev/sdb1 file-system was created and encrypted with use of cryptoloop and the loopback device we can mount it again without use of the pseudo loopback device /dev/loop0.
# mount -t ext4 /dev/sdb1 /mnt/cryptoloop/ -o encryption=aes
# cd /mnt/cryptoloop/
# cat foo.txt
LinuxCareer.com
To be able to mount off our encrypted partition easily with the simple mount command we need to add the following line into the /etc/fstab file:
/dev/sdb1       /mnt/cryptoloop        ext4       noauto,encryption=aes
Now, we are able to mount this partition with:
# mount -a
OR
# mount /mnt/cryptoloop

7. Conclusion

You can find many other crypto utilities available on your Linux system. One worth to mention in conjunction to cryptoloop is its successor dm-crypt. Cryptoloop is part of Linux Crypto API since the kernel version 2.6.
Make sure you tune in to our RSS and Linux IT jobs portal to stay informed about the latest opportunities in the field. Also visit our Linux Forum if you want to share your Linux experiences with us or require additional help.

51 Must-Have Android Apps

http://www.datamation.com/mobile-wireless/51-must-have-android-apps-1.html


As the latest Android devices hit the shelves, Google Play, formerly called the Android Market, must keep pace. The Google app store now offers about 675,000 mobile tools. You'll find apps for everything from looking up health symptoms to scanning barcodes of products on a store shelf in order to look up reviews. Here we highlight an eclectic mix of apps to load on your Android device.
1. Advanced Task Killer
With some Android apps not allowing users to close them, Advanced Task Killer provides a way to force-kill tools and clean the device's memory. Just click the box next to the apps you want to shut down. Free.
2. Avast Mobile Security
Avast Software's Mobile Security app provides a remote cell phone tracker and locator as well as malware protection. It also lets you scan apps on your phone, as well as scanning your memory card content for viruses. Free.
3. Beautiful Widgets
If you're looking for a slick way to view a clock, weather animations and temperature readings, install Beautiful Widgets. Free.
4. Brightest Flashlight Free
A flashlight tool comes in handy during disasters such as Hurricane Sandy. This app uses the light of a smartphone camera's LED flash. It also features timers and audio effects. Free.
5. Cab4me Taxi Finder
Need help tracking down a taxi? Cab4me Tax helps you find local companies in your area and also indicates types of payment they accept. Free.
6. Catchnotes
This app is a convenient space to compile to-do lists, videos and sketches. You can use #tags to find your notes later. Free.
7. Chrome for Android
Experience the speed of Google's Chrome OS on your Android device. Like on the desktop, you can browse in Incognito mode without websites collecting or sharing your search history. Free.
8. Cisco WebEx
Trying to keep up with your meetings on the go? You can log in to a Web meeting on your Android smartphone or tablet using Cisco WebEx. Free but requires an account to use the application.
9. Citrix Receiver Beta
Companies can test features of this remote log-in app before they become part of the standard product. IT can use Citrix to manage, control, lock or wipe business apps remotely. Free.
10. Cloud Print
Need to print from your mobile device? Cloud Print allows you to send files from your phone to your printer. You can share printers with friends and send commands using SMS. Free.
11. Craigslist Mobile
Want to post an ad for an apartment? Craigslist Mobile provides a way to do so from your Android device. A mobilizer algorithm fits the popular site to an Android mobile screen. Free.
12. Documents to Go
This productivity app lets you view Word, Excel and PowerPoint files and attachments. Free; the full version unlocks editing capabilities for $14.
13. Dropsync
A fan of Dropbox? This app lets you keep your account with the cloud storage site synced with your phone or tablet. Free.
14. First Aid - American Red Cross
Prepare for hurricanes, earthquakes and other emergencies with this app from the American Red Cross. It offers videos, quizzes and step-by-step guidance on first aid scenarios. Free.
15. FCC Mobile Broadband Test
This app from Ookla allows you to test the download speed, upload speed and latency of a mobile broadband connection. Free.
16. Flipboard
Swipe through your favorite news sites and social media feeds using Flipboard. You can have a National Geographic news feed next to a Twitter timeline, which sits against videos from Facebook. Free.
17. Fontly
Check out Fontly if you're into typography. Explore type from the past, as well as add pictures of stylish lettering you come across. Free.


18. GateGuru
If you're headed to the airport and need to know about possible wait times and amenities, try GateGuru. You can sync the app with Kayak and TripIt flight details as well as view maps of airports to find ATMs, gift stores and coffee shops. Free.
19. G Cloud Backup
This app from Genie9 lets you back up SMS messages, contacts, music and videos to a secure cloud location. Free for 1GB of space; $0.99 per month for 10GB.
20. Gmote
With Gmote, your Android device becomes a remote control for your PC's media player. You can also control PowerPoint presentations and slide shows from your phone. Free.
21. Go Keyboard
Go Keyboard provides another option for input on an Android device. The app features more than 60 themes and incorporates a "smart" engine to predict where your fingers will strike. Free.
22. Google Earth
Travel the world in 3D on your mobile device, as Google Earth lets you view layers of roads, borders, places and photos. You can view earthquakes in real time, as well as hiking trails, city tours and the path of planes. Swipe gestures allow you to move the globe, zoom in or out, or tilt your view. Free.
23. Google Wallet
Store your credit, debit and reward card info in Google Wallet, so you can check out at the store by tapping your phone to a contactless point-of-sale terminal. The app transmits payment information using near-field communication. Free.
24. Groupon
This popular coupon site lets you buy and redeem deals for restaurants, fitness classes or travel from your mobile device. Groupon also lets you track coupons you've purchased and avoid having to print deals. Free.
25. History Eraser
Try History Eraser to wipe your phone of all your history in one place. The app from InfoLife allows you to clear areas such as the call log and text messages, as well as your search history in Google Search, Gmail and YouTube. Free.
26. iHeartRadio
Clear Channel Digital offers this popular all-in-one digital radio service to let you choose among more than 1,500 live stations. A scan button allows you to browse stations within formats such as pop, country, urban, rock and talk. Free.
27. iTriage
An app from Aetna, iTriage allows you to look up symptoms and health facilities as well as view your personal health records stored in Microsoft HealthVault. Free.
28. LogMeIn Ignition
Like Gmote, LogMeIn lets you control your PC from your Android device. You can remotely run Salesforce customer relationship management (CRM) applications from your handheld. $29.99.
29. Medscape
Need to look up information on drug interactions and diseases? Medscape can help, along with providing medical news, informative videos and dosing calculators for medical professionals. Free.
30. mSecure Password Manager
Try mSecure if you're looking for a place to store your passwords and personal information, such as usernames and account numbers, with 256-bit encryption. $9.99.
31. MyBackUp
You can back up various data, such as contacts, call log, SMS text messages and browser music playlists and browser bookmarks, on your Android. Free for a 30-day trial; MyBackUp Pro costs $4.99 thereafter.
32. Nexercise
A social fitness game, this weight loss tool lets you earn rewards for meeting fitness challenges. Free.
33. NQ Call Blocker
Tired of the growing calls from telemarketers that seem to get around the Do Not Call list? This app lets you block unwanted calls and spam SMS ,as well as back up your contacts. Free.
34. Pedometer Plus
An app from JcsmSoft, Pedometer Plus allows runners to keep track of their distance, number of steps, calories and speed. Then you can integrate your routes with your account in Google Drive, formerly Google Docs. Free.


35. Pinterest
A social networking site growing in popularity, Pinterest lets you post videos and images from a favorite article, destination or recipe. Pin items according to your personal interests. Free.
36. Pocket
Need a place to store sensitive data such as bank account info and passwords? Pocket provides that service in this encrypted Android app. It even stores contact lens prescription info. Free.
37. Pinger
Wonder how to make calls on a smartphone without a call plan? Pinger lets you send and receive calls and texts through the free app. One caveat: Emergency calls are not supported. Free.
38. PrinterShare Mobile Print
This app lets you print using Wi-Fi, Bluetooth or USB without a PC. PrinterShare supports multiple files on your phone, using SMS texts, emails, PDFs and photos. Free for 20 pages; $12.95 for unlimited printing.
39. Pulse News
From Alphonso Labs, this app creates a mosaic of news from your favorite sources, along with summaries of articles. Free.
40. Quill
If you own an Android tablet with a digitizer pen—say a Lenovo ThinkPad or HTC Jetstream—Quill enables handwritten note-taking with a fountain pen mode. Apply more pressure to produce thicker lines. $1.
41. ShopSavvy Barcode Scanner
Billed by Google Play as "the original barcode scanner for Android," this app lets you aim your phone's camera at a barcode, then get a list of online and local prices. Free.
42. Spotify
A popular free radio tool, Spotify, lets you save playlists and share music with others. Free; a premium version lets you save music offline and stream it over a WiFi connection.
43. TEDAir
This app lets you watch archived speeches by people such as Bill Gates and former President Bill Clinton. Technology, Entertainment, and Design (TED) is a renowned conference series that dates back to 1984. Free.
44. TripAdvisor
A handy travel resource, TripAdvisor offers millions of photos, reviews, and maps for potential destinations. The NearMeNow feature lets you search a ZIP code for nearby restaurants and hot spots. Free.
45. Tumbler
The Android version of the blogging platform allows you to post, view and reply to messages. Free.
46. Twitter
Despite the third-party Twitter apps available, it's a safe bet to go with the official one. Track the activity of your contacts and check out interactions in an easy-to-view interface. Options include posting text, photos, links and videos. Free.
47. Vevo
This app provides access to a leading music video and entertainment platform. The service lets you use a voice control feature to search for artists or songs. Free.
48. WebMD
Need to look up what that rash might be or what medication to take for that bug bite? WebMD offers a symptom checker to find information about the cause of conditions and to find out how to treat them. You can also search listings of hospitals, physicians and pharmacies. Free.
49. Where's My Droid
If you're worried about losing your Android device, the Where's My Droid app lets you find your phone using GPS and direct it to vibrate and ring. WheresMyDroid.com allows you to control the device remotely and activate a Stealth Mode to hide incoming texts. Free.
50. Yammer
Yammer is an enterprise social network that lets you collaborate with your coworkers and share ideas. Microsoft recently purchased the private, secure social network and integrates the application with its Dynamics CRM platform. The Android app allows you to access company updates, messages and notifications. Free.
51. Xplore File Manager
A dual-pane view into your Android device, this app from Lonely Cat Games provides a way to copy, rename and create folders. It lets you view data on cloud storage services such as Google Drive and Dropbox. Free.

Git tips and tricks

http://www.openlogic.com/wazi/bid/268619/git-tips-and-tricks


You only need a basic command of Git to make the source code management utility incredibly useful. But Git offers a range of commands and options that can make your workflow run even more smoothly. Here are a few Git tips and tricks to make this tool even greater than you already thought it was.

Aliases in git

There are undoubtedly a few Git commands that you use regularly – git checkout, git commit, and git status, for example. You can reduce the number of keystrokes you type to invoke them by using Git aliases. Git stores its aliases (and some other config options; see below) in the file ~/.gitconfig. You can edit this file to add alias lines:
[alias] 
    st = status 
    co = checkout 
    cm = commit 
Or you can add them with a command like this:
git config --global alias.st "status"
To see what aliases and other config options you have set, run the command git config -l. Aliases are particularly handy for some longer commands, such as some of the commands discussed below. One useful alias is ds = diff --stages, which shows you a diff of the changes you're about to commit to the repository – once they're added, but before you commit. It's good practice to cast a quick eye over those before you commit.

Visualising and managing git branches

If you have lots of branches, it can be useful to see a graphical representation of your Git history. One option for this is gitx, either in its standard version (which should be included in your Git install by default) or using this improved fork. However, if you just want to see a graphical representation of your history on the command line, try
 
git log --graph --simplify-by-decoration --pretty=format:'%d' --all
simplify-by-decoration shows only commits referred to by a branch or tag, and the only output here is a ref name (%d; see the PRETTY FORMATS section of the git log manpage for more format info). A more verbose version shows all commits, with their subject lines, author, date, and abbreviated commit hash, in pretty colors:
 
git log --graph --pretty=format':%s %Cblue%an, %ar %Cgreen(%h)%Creset'
Add --simplify-by-decoration to that last version to get a cross between the two – simplified, with only certain commits, but with more commit info.
Once you've had a look at a tree, you may notice that you have a lot of branches that seem to have already been merged. This is especially true if your workflow makes a lot of use of Git branches. To find out which branches have been merged into other branches, try git branch --merged, or use git branch --no-merged to show the unmerged branches. You can then manually delete merged branches with git -d. (Thanks to Chris Kelly for this tip.)

See more Git log history

git log is useful for reviewing your commit history, but it's quite basic. It shows only commit ID, author, date, and commit message. I often want to also know which file was changed. You have a few options for doing this:
  • git log --stat: gives pretty output showing which files changed and how many changes were in each (additions and deletions). Unfortunately, though, it does not show added files.
  • git log --name-status: shows files changed and whether they were added, modified, or deleted, but doesn't show the nature of changes or the number of changes overall.
  • git log --name-only: just shows commit info and names of files involved, but not what happened to them.
Using these you should be able to get the information you want.
You can also use the git whatchanged command, which shows the commit logs and diff output for each commit. The default diff output is Git's internal format; for a textual diff, which is more useful to a human reader, try git whatchanged -p, though this is usually overkill if all you want is to check which files were changed.

Ignoring files

To ignore files globally across all your git repositories; edit ~/.gitignore:
git config --global core.excludesfile '~/.gitignore'
If you accidentally add a file you'd rather have ignored, you can unstage it from the commit with git rm:
git rm --cached unwantedfile.txt
You can then add it to the local or the global .gitignore file to ignore it in future.

Amending and reversing changes

You may sometimes commit something you didn't want to, or commit too early. Try running git rebase -i if you wind up making multiple commits that should have been all in one, or if you wish to consolidate a bunch of commits for code review. Make sure your changes are up-to-date and that you're on the branch you've been working on, then type git rebase -i master to squash the commits you've made on that branch into one commit on the master branch. You'll see a screen that looks a bit like this:
 
pick afa7532 Array handling methods 
pick b860afa Reading from notebook file into array  
pick df1af7b Setting up notebook file methods

# Rebase cb44197..df1af7b onto cb44197
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.
You can reorder the lines if you like, so for example you could edit the above file like so:
 
pick afa7532 Array handling methods 
squash df1af7b Setting up notebook file methods 
pick b860afa Reading from notebook file into array 
This leaves you with two commits (array handling and notebook file methods, and reading from file into array). Or edit it like this:
 
pick afa7532 Array handling methods 
squash b860afa Reading from notebook file into array  
squash df1af7b Setting up notebook file methods
to squash all three into a single commit. Once you save the file and exit the editor, the changes are committed to the master. If you change your mind before that, delete all the lines and nothing will happen. You can also of course rebase against another (non-master) branch.
You can amend a commit with git commit --amend. Make changes in the local copy of the codebase that you would like to commit (for example, maybe you forgot to add foo.rb, so type git add foo.rb), then type git commit --amend. foo.rb will then be included in the last commit (along with everything that was already there), and you'll have a chance to edit the commit message. If you make no local changes and just type git commit --amend, you get a chance to amend the commit message. Alternatively, if you want to keep your commit message and just amend the commit, use git commit --amend -C HEAD.
To undo a commit altogether, use git reset --soft HEAD^. This undoes the last commit but leaves the changes staged. git reset --hard HEAD^ undoes the commit and deletes all your changes locally; use this with caution!
A slightly different way to approach an individual commit is git cherry-pick. This command enables you to pick a specific commit and add it to your branch, without also taking all the other commits with it. This can also be useful if the branch you're cherry-picking from is so out of date that it would be hard to merge it all in with your own branch. Check out the branch you wish to add the commits to, find the commit ID from the other branch, and use:
git cherry-pick COMMIT_ID
If you run into conflicts, you need to fix them in the normal way.

Patches, or adding changes in bits

Sometimes you might be working on several unrelated changes, and wish to commit them separately. You can do this on a per-file basis either by using git add this.file and working through the list, or git add -i to go into the interactive version of git add, which allows you to pick changes and stage untracked files.
You can also use the patch functionality to commit individual chunks of changes to a file. Type git add -p myfile.rb to be walked through the various chunks of changes that you've made to myfile.rb, and be given the option to add each to the commit. ? gives you help on the command options once you're in there. (Again, thanks to Chris Kelly for this one.)
Check out the Git man pages for yet more options and tricks!