Friday, June 14, 2013

Manage password file in Linux

You can use either these 2 commands:
sudo vi /etc/passwd
sudo vipw

check groups you belong to:
groups
add an user to a group by editing groups files
vigr

Install Apache Subversion on Ubuntu

1. create svn user:
sudo adduser svn
no login for user svn:
/bin/bash -> /bin/false (ubuntu), /bin/bash > /bin/nologin (redhat)
2. create a respository dir: Let's chose /var dir
sudo mkdir /var/svn
sudo svnadmin create /var/svn/repos

3. change the ownership of the dir svn to the user svn (and svn group as well): so far we use sudo command to create dir svn, so by default it belongs to the user root. Now we need to transfer the ownship to user svn

sudo chown -R svn.svn svn

4. add an user to svn group: In order for someone to be accessed to the repository he/she must be added to the group svn. Let's say user ubuntu is be added
sudo gpasswd -a ubuntu svn
Note: there many ways to add an user to an existing group; in this tutorial we use command gpasswd. Some may prefer append user to /etc/group.

5. install svn
sudo apt-get update
sudo apt-get install subversion

6. check to see if it works
svn co svn+ssh://username@url.or.ip.address/var/svn/repos

Note: if you haven't not installed ssh server, you need to do so you can access the svn server through svn+ssh protocol. And if you have your ssh server run on non-standard port such as 443, then you need to add this line into ~/.subversion/config
ssh = $SVN_SSH ssh -q -p 443



Eclipse Short cut

Alt+Shift+J: automatic insert author name into java class in eclipse

Wednesday, June 12, 2013

Install Groovy on Mac OSX 10.7

after 2 days trying, i keep getting the same error as following:

after first, i thought it may have something do with java version. My current java version is 1.6.45. dig a    little bit deeper, from the terminal i saw something different in all the files under groovy folder after unzip.

finally, i found out that my account doesn't have the adequate privilege

add myself to the wheel group. for security, it is not easy to add a user into the wheel group on Mac OSX 10.7 from command line. So I use GUI tool from apple website called Server Admin Tool.
I used this command to add myself to the wheel group
sudo dscl . append /Groups/wheel GroupMembership myusername
Some people said this command didn't work, but I tried and worked!



Wednesday, June 5, 2013

Generate Random Password on Linux

1. Past this following function into your linux .bashrc

genpasswd() {
 local l=$1
        [ "$l" == "" ] && l=20
       tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
}

2. Execute command:
genpasswd
genpasswd 16 (16 bit)
genpasswd 32 (32 bit)

and so on.

Note: in Linux, .bashrc is where you may define your own function/command. You may need to execute this command after making changes to .bashrc:
source .bashrc




Wednesday, May 22, 2013

How to config Apache2 and domain

1. follow this instruction
2. cd /etc/apache2/sites-avalible/your-domain-name
3. sudo a2ensite (reference to this link)
4. sudo service apache2 reload
Note: make sure to do portforwarding if apache is behind the router. Step # 3 may not be needed.