Sunday, February 16, 2014

rm command not freeing disk space SOLUTION

I ran into a very frustrating problem in ubuntu, where when I used the rm command from the command line the disk space would not be freed. The files didn't appear in the trash bin and I emptied it for safe measure but still the disk space was the same. It turns out that files I deleted were being stored in ~/.local/share/Trash/files To actually empty the trash what I had to do was...
rm ~/.local/share/Trash/files
rm ~/.local/share/Trash/info

"Bropages" a supplement to man pages

Manpages are useful but it seems that often times man pages can be long and confusing. This is where "bropages" comes in. "Bropages" are simple to understand documentation pages that get strait to the point by giving you common examples of how a command can be used. These examples can then be either up or down voted in a reddit like style. I've found  bro pages extremely useful when I just need a quick reminder of how to execute a command like "tar". Below I have two screen shots; one of "man ifconfig" and the other of "bro ifconfig" (click each pic to expand). As you can see bro is awesome of giving you the practical information you actually need.

man ifconfig

bro ifconfig


 Users can submit their own examples and thus the more people who use bropages the better it becomes. The bropages website is at http://bropages.org/.

To install bropages you will need to have Ruby installed on your system as well as the package management system RubyGems http://rubygems.org/pages/download. Installing Bropages and Rubygems takes about 5 minutes. Using bropages is extremely simple and something that both linux newbs and linux gurus will find useful.


Note: On my system I had to add the rubygems installation directory to my path for me to be able to execute bropages. After install rubygems you can find the installation directory by running "sudo gem environment".

Sunday, October 06, 2013

What to install after installing Linux


GUI & Desktop & Menu Bar Tweaks

Guake - Drop down terminal, hotkey activated
Calendar-indicator - Integrated Google calendar
Conky-manager - manage cocky desktop widgets easily
Elementary-tweak - Tweaking tool for elementary OS
Indicator-stickynotes - Widget sticky notes for desktop
Indicator Sensors  - monitor cpu/fan/hard-drive temps
Jupiter  - cpu power management

Terminal programs

htop - process monitor
vim - text editor for cool kids
tmux - terminal multiplexer
ranger - File manager with an ncurses frontend

GUI programs

Mendeley Desktop  - Research organization tool (every student should use this)
Firefox - web browser
Chromium - web browser
Kingsoft 2013 - word editor (Microsoft office 2013 clone)
Plex - Media system with both server and frontend
Spotify - Music streaming app
VLC - Video and music player (plays everything)
Gparted - Partition manager



Friday, September 06, 2013

How To Put Your Wifi Card Into Promiscuous Mode And Start Collecting Information

Many wifi hacks/pentests start out the exact same way; which is getting your wifi card into promiscous/monitoring mode and then to start collecting information about the devices around you. Thus that is the topic of this tutorial. For this tutorial we will be using a Linux distro such as Ubuntu or Backtrack and we will assume your wireless card is “wlan0”, which it typically is, but if you want to verify that wlan0 is available you can run the “ifconfig” command to see your network interference’s.

Also we will be using the wireless pentesting application suite called aircrack-ng which is pre-installed in Backtrack or here's a link to instructions  on how to compile/install it on other systems Installation Instructions. Once aircrack-ng is installed we can begin...
  1. In the terminal type "sudo su" and put in your creditials when prompted. This will give you root access.
  2. Next type “airmon-ng start wlan0”. This puts your card into promiscuous/monitoring mode. After you run the command it may warn you about running processes that may cause you trouble but typically you can ignore this warning message. The important thing to look for where is where it says “monitor mode enabled on” followed by  “mon0”, or "mon1", etc. Make note of the mon#, and for the rest of this demo we will be assuming it is mon0.
  3. Now that you have your wifi card in promiscuous mode you can begin to view the traffic around you. In the terminal type “airodump-ng mon0”. You will now see two lists, the first list is the list of wifi hotspots nearby and the second list is a list of wifi devices such as laptops and cellphones. This command will continue to update with live information until you kill the program with CTRL-C.
  4. Now that we have our wifi card in promiscuous mode and have information about the wifi devices around us we can use this information to decide what next step to take. For instance if we want to hack/pentest a router we now know if that router is using WEP or WPA and thus what attack vector to take.

I hope you have found this information helpful. As always please use this knowledge responsibly, and only do hacking/pentests on networks that you have permission to do so on.

Friday, August 30, 2013

"Getting Started with ownCloud" Book Review


Owncloud is a powerful opensource alternative to services such as Dropbox and Google Drive. It is full of features, options, and plugins. It can be installed on Windows or Linux servers and configured to run over a home lan or via the internet. While the flexibility and configurability offered by ownCloud is great, it can also seem a bit daunting. Fortunately I recently had the pleasure of reading “Getting Started with ownCloud” which is a book that does a good job of tackling the many ways to install and configure OwnCloud in an easy to follow format. It also has step by step instructions for both windows (using IIS) and Linux servers (using a LAMP stack).

While I had previously setup ownCloud a couple times before; after reading this book I realized that I had some major security holes that needing fixing. The book makes a good argument as to why ownCloud version 4 has big security flaws and everyone should upgrade to version 5. Also in chapter four of the book, the author goes into depth on how properly secure your owncloud installation. If you haven't installed owncloud yet and are considering reading this book I would recommend reading chapter 1 and then skipping to chapter 4 before you begin the installation since these two chapters are the most important chapters regarding installation and security.

While novice users will find the book easy to follow, there is also plenty for more advanced gurus. If you are a sysadmin and are deploying owncloud for employees at your company several chapters in this book will be of interest, especially the portions that talk about managing user accounts and load balancing to maximize speed and efficiency. All in all, I think this book has something for everyone. It's easy to follow and is a good compendium of the different options and ways to configure own cloud. To read some sample chapters from the book, and to learn more, head over to http://www.packtpub.com/getting-started-with-owncloud/book. I hope you will find this book as useful as I have.

Friday, August 16, 2013

How To Manually Edit Gnome Menus

In this post we will be editing Gnome menus and menu items in Debian. When I say "menu" I mean the list of application categories (such as... Accessories, Graphics, Internet, Office), and when I say "menu item" I mean a specific application link in our menu (such as... Terminal, Wireshark, LibreOffice, etc).

To edit a gnome menu open your terminal and navigate to ~/.config/menus/ and edit the applications.menu file as sudo. Now you should see all of the different application groups. For this demo I will go ahead and create our own category called "My Category", by entering the following code...
The two important tags from the above code to remember are the <directory> Tag and <category> Tag.The directory tag defines the name displayed in the gnome menu (note: the .directory at the end is not displayed), and the category tag defines how we will reference the menu we are creating when we add specific menu items.

Once you have added the above code, save the file and exit. If you open your gnome menu you won't see the category we created but don't worry this is to be expected because gnome only shows menu categories that have applications in them and since we haven't defined any applications to go into our menu category it won't be displayed yet.

Now it's time to create a menu item.  Navigate to /usr/share/applications. Inside this folder you will see a long list of ".desktop" files which are all your menu items already created. You can either edit an existing ".desktop" file or for this demo I will show you how to create a new one. Specifically, I will be creating a menu item for Eclipse (but you can change out the options for any program you'd like).

Create a new file called eclipse.desktop and then enter the following lines of code.

Type specifies that this is an application we are referring to. Exec is the path of the application we are running. Name is the title of menu item we are creating. Icon is the path to the icon we want displayed for our menu item. Categories specify under which menu category we want our menu item to be stored. These are the basic options we need for our menu item, but if you'd like a more in depth look at all the options available I recommend checking out http://linuxcritic.wordpress.com/2010/04/07/anatomy-of-a-desktop-file/

Once your .desktop file is saved you should see both the menu category we created earlier and the new menu item we just saved. If you have any questions feel free to leave a comment below.

 
 


Friday, August 09, 2013

How To Use Tmux With SSH

Tmux is a terminal multiplexer application that comes in very handy especially if you are using SSH and would like to have multiple terminals. I'm assuming you already know the basics of how to use Tmux and thus in this post I'm simply going to cover using Tmux to maintain your terminal configuration (and keep the programs running inside those terminals) even after disconnecting from SSH.

  1. Connect via ssh to host and run tmux
  2. Configure tmux using the CTRL + B, C and CTRL + B, SHIFT % and other commands so that tmux is exactly how you want it.
  3. Now that Tmux is configured we will keep Tmux running but detach from it by using the CTRL + B, D command.
  4. Now you can exit your ssh session.
  5. Next time you reconnect to restore your previous tmux session all you have to do is run tmux a ("a" stands for attach).    
That's it! Now you can easily reconnect to a host and have every thing as you left it. Personally, I find this useful for being able to have an always on IRC client and I have a multi-divided pane configured with stats about my server that I can instantly see when I log in. 

Monday, August 05, 2013

How to Create Hard and Soft Links In Windows

Symbolic links, also known as soft links, are special types of files that point to another file or folder in your operating system. Essentially you can think of them as advanced shortcuts. They can come in handy for a variety of different tasks. I frequently use them when I need to sync something to Dropbox but don't want to place the file directly into my Dropbox folder. To create a soft link we will use the MKLINK command and run it from the Command Prompt (CMD) in administrator mode.  The basic MKLINK command syntax is as follows.

MKLINK [flag] Link-Location Original-File-Location

Additionally, there are a few optional flags which you can pass the commnad...
 /D --- Directory Soft Link
If you want to link a folder/directory instead of an individual file then you will need to use the /D flag

/H ---Hard Link Instead of Soft Link (Files)
Hard links are a little different than soft links. Instead of acting as a shortcut to a file, they act as the file its self. Essentially, your operating system creates another reference to where the file is stored in memory. Thus if the original target reference gets deleted you can still access the data, where as if you used a soft link and the target was deleted then your soft link would fail. 

/J  ---- Directory Junction  (Folders)
This is essentially the same as the /H flag except that the /J option should be used when linking folders instead of files.

Examples.....

Soft Link of a file

MKLINK C:\NewSoftLinkFile.txt C:\subfolder\TargetFile.txt

Soft Link of a folder

MKLINK /D C:\SoftLinkFolder C:\subfolder\TargetFolder

Hard Link of a file

MKLINK /H C:\NewHardLinkFile.txt C:\subfolder\TargetFile.txt

Hard Link of a folder

MKLINK /J C:\NewHardLinkFolder C:\subfolder\TargetFolder

Monday, July 29, 2013

How To Setup Conky The Easy Way

I've always loved Conky and the ability it gives you to setup beautiful, lightweight, information displays directly on your desktop. Unfortunately, for new users Conky can be a little daunting with it's configuration files and setup process. Fortunately, there is a free app called Conky Manager which makes the process of installing conky scripts, and configuring them dirt simple. Conky Manager runs on Debian, Ubuntu, and Ubuntu derivatives such as Mint. To install Conky Manager on a Ubuntu based system open a terminal and run the following commands.
sudo apt-add-repository -y ppa:teejee2008/ppa
sudo apt-get update
sudo apt-get install conky-manager
Conky Manager comes packaged with several different Conky scripts and to apply one it is as simple as clicking a check box in the app. Then you can click edit to change the position, size, transparency, etc of your conky widget. If you want more control you can still edit the original conky config file which is placed in the conky-manager folder in your home directory. For a more indepth look into the features of Conky Manager you can visit the applications homepage at http://teejeetech.blogspot.in/p/conky-manager.html Additionally, I highly recommend downloading the Deluxe Conky Theme Pack which can be imported into conky manager and gives you a ton of awesome conky configs to choose from.

Here's a screen shot of my desktop that I setup using Conky Manager. Feel free to comment below and show off your own desktop setups.

Friday, July 26, 2013

Password-less SSH

What It Is

Password less SSH uses asymetric encryption to create a private and public key which allows for authentication without a password. "asymetric encryption" means that the algorithm (aka the key) used to encrypt the data cannot be used to decrypt the data. When using asymetric encryption you generate a public and private key. The public key is used to encrypt the data and the private key is used to decrypt it.

The best analogy for this system is a box with a padlock. You can give the box to a friend and they can put something in it, but once the padlcock is shut you are the only person who is able to open it, since only you know the combination (aka the private key). Thus with SSH we can use this system to authenticate users. Essentially, the client (local machine) has a private key, and the the server (remote machine) has the public key. When the client asks to connect to the server, the server uses the public key to encrypt a number/pass-phrase and then sends it to the client. If the client is who he claims to be and has the private key then the client will be able to decrypt the pass-phrase and correctly answer the server, therein validating his identity.  

How To Set It Up

In this "how to" we will use the word "client" to mean the local machine, and "server" to mean the remote machine you are connecting to.


Step 1: Create Public and Private Keys

From the client open a terminal and run the following command, and accept the defaults by repeatedly pressing enter.
ssh-keygen -t rsa  

Step 2: Upload Public Key To The Server

Run the following command to transfer the public key into the home directory of your user on the server. Change "user" and "serverIP" to the appropriate values.
scp ~/.ssh/id_rsa.pub user@serverIP:

Step 3: Create .ssh Directory On The Server

SSH into the server as you normally would (using a password). Then in the home directory of the user on the server that you just ssh'd into create a .ssh folder if it does not already exist.
mkdir ~/.ssh

Step 4: Make the Public Key An Authorized Key

From the server (in your users home directory) type the following command which will add the public key we just transferred as an authorized SSH key.
cat id_rsa.pub >> .ssh/authorized_keys
Now we can delete the public key from the home folder...
rm id_rsa.pub

Step 5: Set Permissions On Server

On the server (in your users home directory) run the following commands to set the appropriate permissions on the .ssh folder and authorized_keys file. Note: This step may not be necessary depending on your system configuration but better to play it safe.
chmod 700 .ssh
chmod 640 .ssh/authorized_keys


You're Finished!

That's it! From now on you should be able to SSH on to the server from your client without being prompted for a password.