Wednesday, October 2, 2013

Change Group Owner For /var/www

Taking another note. Here's how to change group owner for /var/www directory in Ubuntu Server 12.04. By default that directory meant to be DocumentRoot for Apache 2 web server and own by root. This practice is useful if we want to share the access to several people in webmaster group.


sudo addgroup webmasters

sudo chgrp -R webmasters /var/www

sudo find /var/www -type d -exec chmod g=rwxs "{}" \;
sudo find /var/www -type f -exec chmod g=rws "{}" \;

sudo gpasswd --add user webmasters
sudo gpasswd --add colleague1 webmasters
sudo gpasswd --add colleague2 webmasters
# etc.

Tuesday, January 22, 2013

Accessing Nexus 4 USB Storage From Linux

The objectives is to be able to access USB storage on Nexus 4 from my Linux desktop. This way, I can easily copy and/or move files from/to Nexus 4.

1. Enable Developer options:
a. Open Settings
b. Tap 'About phone'
c. Tap on 'Build number' seven (yes, it's 7) times
d. You'll get the notification that Developer options is enabled

2. In settings, you'll find in System tab the Developer options, tap to open it, and then check the USB debugging option


3. Install necessary modules to Linux desktop:
$ sudo apt-get install mtp-tools mtpfs
4. Configure 51-android.rules:
$ sudo vi /etc/udev/rules.d/51-android.rules
5. Paste the following line into the file:
#LG - Nexus 4
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
6. Make the file executable:
$ sudo chmod +x /etc/udev/rules.d/51-android.rules
7. Restart udev
$ sudo service udev restart
8. Create mount point and permissions
$ sudo mkdir /media/nexus4
$ chmod 755 /media/nexus4
9. Plug in Nexus 4 and make sure MTP is enabled


10. Mount with the following command:
$ sudo mtpfs -o allow_other /media/nexus4
11. And unmount it when you have completed your work:
$ sudo umount /media/nexus4

Practically you can do this with every other Android devices. Just plug your Android and use this command to get your idVendor and idProduct information:
$ mtp-detect | grep idVendor
$ mtp-detect | grep idProduct
Use the information on step 5 above, and you're good to go :)
 

Wednesday, November 7, 2012

Mutt: Viewing URL On Your Favorite Browser

On this past few weeks, I've been back using mutt. And this time, with much advanced configuration. One of its configuration is opening URL inside emails on your favorite browser. The requirement is simply using urlview that you can download from here (I'm using version 0.9), extract and compile it. Then add this config to your .muttrc file:
macro index \cu |urlview\n      # simulate the old browse-url function                                                                                                           
macro pager \cu |urlview\n
Also, you need to add ~/.urlview and put this line:
REGEXP (((http|https|ftp|gopher)|mailto)[.:][^ >"\t]*|www\.[-a-z0-9.]+)[^ .,;\t>">\):]
COMMAND <your-browser> %s

After all done, try to open one email in your mutt. Then in view mode, press ctrl-u and urlview will listing all available URL inside that email. You just have to choose one and press Enter, and your browser will automatically open and load that URL.
 

Wednesday, June 6, 2012

How to open .uif file in Ubuntu Linux

Here's how to open .uif file in Ubuntu Linux:
1. Install uif2iso package
$ sudo apt-get install uif2iso
2. Run command to convert .uif to .iso file
$ uif2iso file.uif file.iso
3. Mount .iso file
$ mkdir ~/iso_file
$ sudo mount file.iso ~/iso_file -t iso9660 -o loop
That's it! :)