Blog is moving

My blog is moving to http://victormendonca.com/blog/. If you are looking for a specific or older post you are in the right place Otherwise check out my new page for more up to date content.

Thursday, December 13, 2012

How to mount Box.com storage via davfs2

A while ago Box.com had a promotion and they were giving out a free 25GB account, so I hurried to get one. If you were like me, or if you just have some storage with them and are looking for a way to mount it in Ubuntu, here's the solution.

We will be mounting your box.com storage with WebDav, so we will need to install a package for that:

$ sudo apt-get install davfs2


After the package is installed we will need to reconfigure it so normal users can mount it. When prompted if unprivileged users can be allowed to mount WebDav resources, say "Yes":

$ sudo dpkg-reconfigure davfs2


We also need to give it the proper permission and add your user to the proper group:

$ sudo chmod u+s /sbin/mount.davfs

$ sudo addgroup [user] davfs2


Now create a location where you would like to mount your storage. I chose the following:

$ mkdir $HOME/Export/Box


Now we need to create two configuration files for davfs2, one for file locking, and another with your credentials. The files should be in the following format:

$ mkdir $HOME/.davfs2

$ cd .davfs2

$ cat davfs2.conf 
use_locks 0

$ cat secrets 
https://www.box.com/dav [email] [password]

$ chmod 600 secrets


Almost done. We now will add an entry in fstab (sudo vim /etc/fstab) to mount box.com automatically:

# Mounts Box.com
https://www.box.com/dav /home/[user]/Export/Box davfs _netdev,rw,user 0 0


And that's it. As long as you have a network connection box.com will be mounted automatically (that's the _netdev option). And if it doesn't, you can run the command below to mount it:

$ mount $HOME/Export/Box





Wednesday, December 12, 2012

Port scanning with Bash's TCP socket

Let's say you logged on to a Linux machine and you need to run nmap to find out what ports are open on a specific node, however you do not have sudo access and/or 'nmap' (or nc) is not installed...

Well, here's the solution. Depending on the Bash version that you have, and if it has TCP socket enabled, you can use it's built-in TCP (and UDP) socket to create connections (it's somewhat similar to the client side of 'netcat').

Here's a quick function that can be used for that:

nmap2 () {
[[ $# -ne 1 ]] && echo "Please provide server name" && return 1

for i in {1..9000} ; do
  SERVER="$1"
  PORT=$i
  (echo  > /dev/tcp/$SERVER/$PORT) >& /dev/null &&
   echo "Port $PORT seems to be open"
done
}


And here's an example of running the scan against my gateway:

$ GW=$(route -n | grep '^0.0.0.0' | awk '{print $2}')

$ nmap $GW
The program 'nmap' is currently not installed. You can install it by typing:
sudo apt-get install nmap

$ nmap2 $GW
Port 1720 seems to be open


If you need to increase/decrease the ports that are scanned, simple change the option '{1..9000}' in the script.

Tuesday, December 11, 2012

System monitoring with syspeek (new)

Here's a neat little tool for your Ubuntu indicator applet that displays system information when clicked:

syspeek-new



Syspeek displays live system information for:

  • CPU
  • Memory
  • Swap
  • Disk space
  • Network

It also gives you a shortcut for the default "System Monitor":



To install this unofficial updated version of syspeek (syspeek-new) you will need to add the following ppa:

sudo add-apt-repository ppa:emptythevoid/syspeeknew
sudo apt-get update


And then install the package:

sudo apt-get install syspeek



Monday, December 10, 2012

Capture screenshots easily with ScreenCloud

ScreenCloud is a free app for Windows, Mac and Ubuntu that allows you to easily take screenshots off your desktop and upload the images. When the upload is done the app copies the online link to your clipboard so you can easily share with others.

http://screencloud.net/


At the moment ScreenCloud supports the following upload methods:
- Local file
- ScreenCloud
- FTP
- SFTP
- DropBox
- Imgur
- Ubuntu One



ScreenCloud also comes pre-configured with 3x shortcuts (which can be changed):

Friday, December 7, 2012

Try Ubuntu Online

Here's a great site that you can share with people that want to know what Ubuntu looks like, but they don't want to go trough the trouble of downloading an iso and booting from a live CD.

http://www.ubuntu.com/tour/en/



Please keep in mind that the system is very limited, but it should give the user with a minimal experience and brake that old barrier that Linux is a scary thing!