Friday, April 25, 2008

Ubuntu 8.04 is already available

Ubuntu 8.04 is already available!!! Get your own copy at

Friday, April 11, 2008

Setting up samba with password protection

To easily share your files to linux and windows clients, samba is still the preferred choice. In this guide I will show how to setup a samba server on centos 5 machine, that can be accessed only by certain people protected by password.

  1. Install samba on the server
    • # yum install samba
  2. Create the group that all the samba users will be contained in, for example 'samba'
    • # groupadd samba
  3. Create samba users and add it to the above group, which is in this example is 'samba'. Below is the example to create a user named 'user1' and add it to group 'samba'. Set the password for user1
    • # useradd user1 -g samba
    • # passwd user1
  4. Create the directory to be shared. In this example, i will use /home/shared. Change the ownership to root and group ownership to the 'samba' group. Change permission so that only user and group can read write and execute
    • # mkdir /home/shared
    • # chown -R root.samba /home/shared
    • # chmod -R 775 /home/shared
  5. Below is a simple setting of samba
    • [global] workgroup = samba
      server string = Samba Server
      security = user [shared_folder]
      comment = Sharing place
      path = /home/shared
      public = no
      writable = yes
      printable = no
      write list = @samba
      create mask = 0755
      force create mode = 0755
      directory mask = 0775
      force directory mode = 0775
    • What the above setting does basically is to setup /home/shared as samba shared directory but can only be accessed by user from group samba
  6. Add user/users to samba
    • # smbpasswd -a user1
  7. Start smb service, restart if it has already been started
    • # /etc/init.d/smb start
  8. 'user1' can now access the samba server using address 'smb://samba_server_ip_address/shared_folder' at any nautilus address bar. For windows client, you can see at your 'My Network Places' and find a workgroup named 'samba'

Friday, April 4, 2008

'Watch'ing your commands running

Sometimes when you run a command, you need to see the progress of the command, yet you do not want to keep refreshing the command by repeating it a few times. There is a useful command in linux that can do the job of refreshing for you which is watch. According to the watch man page: "watch - execute a program periodically, showing output fullscreen". By default watch will refresh the command in the interval of 2 seconds but this can be changed according to your needs.
For example, you want to see the memory usage of your computer every 2 seconds:

$ watch free -m

This kind of output will show:

(Click on the image for clearer view)

To set the interval(15 seconds) which watch will refresh, use -n option:

$ watch -n 15 free -m

The output:

(Click on the image for clearer view)

To see the differences of each refresh session, use -d. Watch will highlight the changes that happening on that particular moment:

$ watch -d free -m

(Click on image for clearer view)

To exit from watch, just use your trusty Ctrl-c