Monday, June 25, 2012

3 Ways to Automate Tasks on Linux


Linux is, and always was, one of the most powerful operating systems on the planet. From Android to Ubuntu, Linux’s versatility has made it quite popular with developers, system admins, hackers, and of course, end users. Though simple to use and learn, Linux’s untapped prowess can be used to accomplish many tasks in your daily life. From running a garden sprinkler to rocking a baby’s cradle, Linux is just about as awesome as Chuck Norris.

Don’t worry if you are not that adventurous, because the penguin can also help you save the time you spend on simple repetitive tasks by automating them. Tasks like backing up your important folders, rebooting your computer, and even downloading torrents. So, whether you’re a little lazy (as all geeks are) or just someone who doesn't have much time, this article will guide you in saving a few precious hours in your life by automating boring repetitive tasks for you.


Take Automatic Backups
If you’re worried about losing your data, then backing it up safely is the best solution. We've already listed some of the best backup tools for Linux; however, the shining newDeja Dup is our favorite these days. Its simplicity as well as its inclusion as the default backup application in Ubuntu has made it a reliable choice. Deja Dup, once set up, can allow you to take automatic backups of your data without you having to manually do it. To get started, simply open Deja Dup by searching for it using the launcher (Super key).

Now, once the application starts, go to the “schedule” tab and select the frequency that suits you best. Also, don’t forget to choose whether to keep backups forever or for a set period of time. You don’t want to have your hard disk or online account bloated with just backups.

Then, once you are set, go back to the ‘Overview’ tab and turn ‘Automatic Backups’ on. This will ensure that your data is safe even when you’re not using the computer. Of course, you’ll have to leave your computer on for this.


Reboot or Shutdown your computer
Using the ‘at’ command you can shutdown or reboot your Linux device even while you’re away from it. So, let’s say you want to shutdown your computer at 3 PM. To get started, open the terminal first (Ctrl + Alt + T), then punch in the following command:

at 3pm
Now, the command will take you to a prompt mode wherein you’ll instruct ‘at’ to do a particular job. There, simply enter the command ‘halt’ without quotes. Press Ctrl+D to exit.

Now, you've instructed the computer to halt (that is to shut down) at 3pm. You can, in the same way, add more commands to the list. To check on the current pending jobs, simply enter the ‘atq’ command without quotes. To remove a particular job, use the ‘atrm’ command.


Auto-start torrent downloads
If you’re sleeping or out of the house and wanted to auto-start a download at a specific time, then Linux can be your best friend. Say, you’re leaving your house at 10 AM, you can then schedule Linux to start Transmission (popular torrent client) at 2 PM using the following command.

sleep 4h && transmission-gtk
The above command will start Transmission exactly 4 hours after you've issued it. If you want Transmission to run after 3 and a half hours, simply enter this command:

sleep 3h && sleep 30m && transmission-gtk
This can be very useful for people who use data plans where in the ISPs provide unlimited downloading at night. Also, if you want to stop the download before you wake up, or at a specific time, you can issue the following command:

sleep 8h && pkill transmission-gtk

How to Use BitTorrent in Linux


Though file sharing is extremely widespread nowadays, it amazes me that lot of people still don't know how to use a BitTorrent client or perhaps don't know what to do with a ‘.torrent’ file. Just take a look at this data (Google Trends):

Because of this, I decided to make a quick and easy tutorial on how to start downloadingfiles via BitTorrent in Linux. Windows and Mac users can also learn from this, as the concept is basically the same on any platform. But before that, I would like to give you a brief intro about BitTorrent taken from Wikipedia:

BitTorrent is a peer-to-peer file sharing protocol used to distribute large amounts of data. BitTorrent is one of the most common protocols for transferring large files, and by some estimates it accounts for about 35% of all traffic on the entire Internet. The initial distributor of the complete file or collection acts as the first seed. Each peer who downloads the data also uploads it to other peers, even after they have dismounted the original seed. Because of this, BitTorrent is extremely efficient. One seed is needed to begin spreading files between many users (peers). The addition of more seeds increases the likelihood of a successful connection exponentially.

Now that you have learned a little about BitTorrent, let’s get down to business.
The first thing that you have to do is download a BitTorrent client. If you are using Linux, there are tons of free and open source BitTorrent clients to choose from. And, if you are using the latest versions of popular distributions like Fedora or Ubuntu, a BitTorrent client is already included out-of-the-box. For this tutorial, let’s use Transmission on Ubuntu.

Now that you have a BitTorrent client, it’s time to get a ‘.torrent’ file. We can use popular BitTorrent search engines (a.k.a. tracker) like isoHunt and The Pirate Bay to get what we want. As an example, let’s go to isoHunt and download the short movie Elephants Dream:

Suppose you like to get the first search result, just click on it to go to its download page.

Click on 'Download .torrent' then open it with Transmission.
You can set the destination folder or just use the default and click on ‘Add’. After that, the download will start…

The more peers or seeders you have, the faster the download. If the download is interrupted, it can be resumed anytime.

Free and Open Source P2P File Sharing Software

A peer-to-peer (P2P) computer network utilizes varied connectivity linking participants in a set of connections and the collective bandwidth of network members rather than the usual centralized resources where a fairly low number of servers provide the core value to a service orapplication. Peer-to-peer networks are usually used for connecting nodes via largely improvised connections. These networks are useful for many purposes: Sharing content files containing audio, video, data or anything in digital format is very common, and realtime data, such as telephony traffic, is also passed using P2P technology.

File sharing typically follows the P2P model, where the files are stored on and served by personal computers of the users. Generally, people who engage in file sharing on the Internet both give (upload) files and receive files (download).

There are plenty of excellent free and open source P2P file sharing software available today. Here are some of them:

GNUnet
*GNUnet is a framework for secure peer-to-peer networking that does not use any centralized or otherwise trusted services. A first service implemented on top of the networking layer allows anonymous censorship-resistant file-sharing. GNUnet uses a simple, excess-based economic model to allocate resources. Peers in GNUnet monitor each others behavior with respect to resource usage; peers that contribute to the network are rewarded with better service.


Torrentflux
*Torrentflux is a multi-user GUI for BitTornado. Unlike most BitTorrent clients, its main user interface is a web interface. It is scripted in PHP, with a MySQL database and runs on a web server. It can also be run from a hosting service, allowing very high download speeds for the enduser. The file host company runs Torrentflux on their server to download a torrent, while the enduser connects to the company via FTP to download the file. The advantage of this method is that hosting companies have much higher bandwidth compared with residential homes. This is also an advantage for people with traffic-shaped internetaccess which agressively decreases speed on P2P traffic protocols like bittorrent.


gtk-gnutella
*gtk-gnutella is a server/client for Gnutella. It runs on every Unix-like system which supports GTK+ (1.2 or above) and libxml. The GNOME desktop environment is not required. It is currently developed and tested under Linux (Debian) as well as NetBSD. It is known to run at least on Linux, FreeBSD, NetBSD, OpenBSD, Darwin, Solaris, Tru64 UNIX (OSF/1), SGI IRIX, BeOS whereas CPU architectures include x86, AMD64, PowerPC, SPARC, MIPS. gtk-gnutella is not finished yet, but it is fully functional: you may share, search, and download. And it is stable too, users usually just leave it run unattended for days.


KTorrent
*KTorrent is a BitTorrent client written in C++ for KDE using the Qt user interface toolkit. It is maintained in the KDE Extragear.
Features:
- Upload and download speed capping / throttling & scheduling
- Internet searching with torrent search engines using KHTML part.
- Support for UDP trackers.
- IP address blacklist plugin
- Port forwarding with UPnP (Universal Plug and Play)
- Protocol encryption
- DHT (mainline version), and support for trackerless torrents
- µTorrent peer exchange (PEX) support (as of 2.1 RC1).
- File Prioritization
-Ability to import partially-downloaded files
- Directory scanner to automatically watch directories for new torrents
- Manual addition of trackers to torrents
- RSS feed support


aMule
*aMule is a peer-to-peer file sharing application that works with the eDonkey2000 network and the Kad Network, but offers more features than the standard eDonkey client, including support for Kademlia. It is a fork of the xMule source code, which itself is a fork of the lMule project, which was the first attempt to bring the eMule client to Linux.


BitTornado
*BitTornado is a BitTorrent client. It is developed by John Hoffman, who also created its predecessor, Shad0w's Experimental Client. Based on the original BitTorrent client, the interface is largely the same, with added features such as
- upload/download speed limitation;
- prioritised downloading when downloading batches (several files);
- detailed information about connections to other peers;
- UPnP Port Forwarding (Universal Plug and Play);
- IPv6 support (if your OS supports it/has it installed);
- PE/MSE support as of version 0.3.18.
Super seeding mode and web seeding were originally developed by the BitTornado group. It is programmed using Python, for platform independence.


iFolder
*iFolder is an open source application, developed by Novell, Inc., intended to allow cross-platform file sharing across computer networks. iFolder operates on the concept of shared folders, where a folder is marked as shared and the contents of the folder are then synchronized to other computers over a network, either directly between computers in a peer-to-peer fashion or through a server. This is intended to allow a single user to synchronize his files between different computers (for example between a work computerand a home computer) or share files with other users (for example a group of people who are collaborating on a project).


LimeWire
*Limewire is a peer-to-peer file sharing (P2P) client for the Java Platform, which uses the Gnutella network to locate files as well as share files. Released under the GNU General Public License, LimeWire is free software. It also encourages the user to pay a fee, which will then give the user access to LimeWire PRO. Written in the Java programming language, LimeWire is able to run on any computer with Java Virtual Machine installed. Installers are provided for Microsoft Windows, Mac OS X, and Linux. For Linux users, check out how to install LimeWire on Linux post.


MLDonkey
*MLDonkey is an open source, free software multi-network peer-to-peer application. It is also the name of the peer-to-peer overlay network that the MLDonkey uses. Originally a Linux client for the eDonkey protocol, it now runs on many flavors of Unix-like, Mac OS X, Windows and MorphOS and supports numerous peer-to-peer protocols. It is written in Objective Caml, with some C and even some Assembly parts.


Azureus
*Azureus is a Java-based BitTorrent client, with support for I2P and Tor anonymous communication protocols. In 2003, the core developers of Azureus formed a company called Vuze, Inc. (formerly Azureus, Inc.) The program's logo is the Blue Poison Dart Frog (Dendrobates azureus). The Azureus name was given to the project by co-creator Tyler Pitchford, who uses the Latin names of poison dart frogs as codenames for his development projects. Azureus was first released in June 2003 at SourceForge.net, mostly to experiment with the Standard Widget Toolkit from Eclipse. It is now one of the most popular BitTorrent clients. Released under the GNU General Public License, Azureus is free software.


rTorrent
*rTorrent is a text-based ncurses BitTorrent client written in C++, based on the libTorrent libraries for UNIX (which is not the libtorrent library developed by Arvid Norberg), with a focus on high performance and good code. The library differentiates itself from other implementations by transferring data directly between file pages mapped to memory by the mmap() function and the network stack. On high-bandwidth connections, it is claimed to be able to seed at many times the speed of the official client. rTorrent packages are available for various Linux distributions and Unices, and it will compile and run on nearly every POSIX-compliant operating system, such as FreeBSD. rTorrent uses ncurses and is suitable for use with screen or dtach. It supports saving of sessions and allows the user to add and remove torrents. It also supports partial downloading of multi-file torrents. In the release of rTorrent-0.7.0 support for BitTorrent protocol encryption is also implemented. PEX and DHT was recently implemented in rTorrent.



Please share other free and open source P2P file sharing software that I failed to include here through comments.

How to Install LimeWire on Ubuntu Linux




LimeWire is a very popular peer-to-peer (P2P) file sharing software among (porn-loving) Windows desktop users :-) So it's no surprise that I receive emails every now and then from people who recently switched to Linux asking me worriedly how they can install and use LimeWire on their newly installed distro (mostly Ubuntu). To make the transition a lot easier for the complete newbies like them, I decided to share this extremely straightforward and quick tutorial on installing LimeWire on Ubuntu Linux:


1. You can start by going to the LimeWire for Linux download page HERE, and then click on the download link.


2. Open the .deb file with the GDebi Package Installer.



3. Complete the download, and then poceed with the installation.



4. If successful, installation should be finished in no time. You can open LimeWire by going to: Applications --> Internet --> LimeWire


5. You are done and as easy as that!



Now enjoy downloading those dirty files (whatever those are) but beware of those destructive PC viruses that could infect and harm your computer and can often lead to insanity.

Change or Reset Windows Password from a Ubuntu Live CD

If you can’t log in even after trying your twelve passwords, or you’ve inherited a computer complete with password-protected profiles, worry not – you don’t have to do a fresh install of Windows. We’ll show you how to change or reset your Windows password from a Ubuntu Live CD.
This method works for all of the NT-based version of Windows – anything from Windows 2000 and later, basically. And yes, that includes Windows 7.
Note: If you have files on your hard disk encrypted using built-in Windows encryption, they may not be available after changing the Windows password using this method. Exercise caution if you have important encrypted files.
You’ll need a Ubuntu 9.10 Live CD, or a bootable Ubuntu 9.10 Flash Drive. If you don’t have one, or have forgotten how to boot from the flash drive, check out our article on creating a bootable Ubuntu 9.10 flash drive.
The program that lets us manipulate Windows passwords is calledchntpw. The steps to install it are different in 32-bit and 64-bit versions of Ubuntu.

Installation: 32-bit
Open up Synaptic Package Manager by clicking on System at the top of the screen, expanding the Administration section, and clicking on Synaptic Package Manager.



chntpw is found in the universe repository. Repositories are a way for Ubuntu to group software together so that users are able to choose if they want to use only completely open source software maintained by Ubuntu developers, or branch out and use software with different licenses and maintainers.
To enable software from the universe repository, click on Settings > Repositories in the Synaptic window.

Add a checkmark beside the box labeled “Community-maintained Open Source software (universe)” and then click close.


 When you change the repositories you are selecting software from, you have to reload the list of available software. In the main Synaptic window, click on the Reload button.


The software lists will be downloaded.


Once downloaded, Synaptic must rebuild its search index. The label over the text field by the Search button will read “Rebuilding search index.” When it reads “Quick search,” type chntpw in the text field. The package will show up in the list.



Click on the checkbox near the chntpw name. Click on Mark for Installation.


chntpw won’t actually be installed until you apply the changes you’ve made, so click on the Apply button in the Synaptic window now.

You will be prompted to accept the changes. Click Apply.

The changes should be applied quickly. When they’re done, click Close.

chntpw is now installed! You can close Synaptic Package Manager. Skip to the section titled Using chntpw to reset your password.


Installation: 64-bit
The version of chntpw available in Ubuntu’s universe repository will not work properly on a 64-bit machine. Fortunately, a patched version exists in Debian’s Unstable branch, so let’s download it from there and install it manually.
Open Firefox. Whether it’s your preferred browser or not, it’s very readily accessible in the Ubuntu Live CD environment, so it will be the easiest to use. There’s a shortcut to Firefox in the top panel.

Navigate tohttp://packages.debian.org/sid/amd64/chntpw/download and download the latest version of chntpw for 64-bit machines.
Note: In most cases it would be best to add the Debian Unstable branch to a package manager, but since the Live CD environment will revert to its original state once you reboot, it’ll be faster to just download the .deb file.

 Save the .deb file to the default location.


You can close Firefox if desired. Open a terminal window by clicking on Applications at the top-left of the screen, expanding the Accessories folder, and clicking on Terminal.







In the terminal window, enter the following text, hitting enter after each line:












cd Downloads sudo dpkg –i chntpw*



chntpw will now be installed.
Using chntpw to reset your password
Before running chntpw, you will have to mount the hard drive that contains your Windows installation. In most cases, Ubuntu 9.10 makes this simple.
Click on Places at the top-left of the screen. If your Windows driveis easily identifiable – usually by its size – then left click on it.



























If it is not obvious, then click on Computer and check out each hard drive until you find the correct one.

The correct hard drive will have the WINDOWS folder in it. When you find it, make a note of the drive’s label that appears in the menu bar of the file browser.

If you don’t already have one open, start a terminal window by going to Applications > Accessories > Terminal.

In the terminal window, enter the commands
cd /media
ls
pressing enter after each line. You should see one or more strings of text appear; one of those strings should correspond with the string that appeared in the title bar of the file browser earlier.
Change to that directory by entering the command
cd
Since the hard drive label will be very annoying to type in, you can use a shortcut by typing in the first few letters or numbers of the drive label (capitalization matters) and pressing the Tab key. It will automatically complete the rest of the string (if those first few letters or numbers are unique).

We want to switch to a certain Windows directory. Enter the command:




cd WINDOWS/system32/config/
Again, you can use tab-completion to speed up entering this command.

To change or reset the administrator password, enter:


sudo chntpw SAM
SAM is the file that contains your Windows registry. You will see some text appear, including a list of all of the users on your system.


 At the bottom of the terminal window, you should see a prompt that begins with “User Edit Menu:” and offers four choices. We recommend that you clear the password to blank (you can always set a new password in Windows once you log in). To do this, enter “1” and then “y” to confirm.

If you would like to change the password instead, enter “2”, then your desired password, and finally “y” to confirm. 

If you would like to reset or change the password of a user other than the administrator, enter:











sudo chntpw –u SAM


From here, you can follow the same steps as before: enter “1” to reset the password to blank, or “2” to change it to a value you provide.


And that’s it!

Conclusion
chntpw is a very useful utility provided for free by the open source community. It may make you think twice about how secure the Windows login system is, but knowing how to use chntpw can save your tail if your memory fails you two or eight times!