Ruby On Rails a beginner tutorial

Posted on in Categories News last updated February 28, 2006

The Ruby on Rails web application framework got lots of buzz in last year. Apple has just posted very nice and easy to follow tutorial on Ruby On Rails for web development on Mac OS X.

According to apple it is no surprise that Mac OS X is a favored platform for Rails development. Rails and its supporting cast of web servers and databases thrive on the rich Mac OS X environment.

* This tutorial covers
* Installing Rails
* Creating a New Rails Application
* Jump-Starting the Application
* Creating the Database Schema
* And other related stuff etc

Overall an excellent tutorial and highly recommend for all newbie’s out there.

User management: command line vs GUI tools

Posted on in Categories News last updated February 27, 2006

Almost all Linux distribution comes with its own set of GUI tools to manage users and groups. For example:
* Red Hat comes with redhat-config-user
* Suse comes with Yast
* Debian Linux and other distro come with users-admin GUI tool set
* FreeBSD with sysinstall
* Solaris comes with Solaris Management Centre (SMC)

However, I recommend managing user accounts from command line. It offers following benefits over GUI tools:

  • Using commands from command line is faster
  • Automation is possible as per your requirements (use of Perl or shell scripting)
  • If you are going to use LDAP or NIS then command line provides best solution as compare to GUI tools

What is the best way to edit /etc/passwd, shadow, and group files?

Posted on in Categories News last updated February 27, 2006

The best way to edit /etc/passwd, or shadow or group file is to use vipw command. Traditionally (under UNIX and Linux) if you use vi to edit /etc/passwd file and same time a user try to change a password while root editing file, then the user’s change will not entered into file. To avoid this problem and to put a lock while editing file, use vipw and vigr command which will edit the files /etc/passwd and /etc/group respectively. If you pass -s option to these command, then they will edit the shadow versions of those files i.e. /etc/shadow and /etc/gshadow, respectively.

The main purpose of locks is to prevent file corruption. Do not use vi or other text editor to edit password file. Syntax:

  • vipw -s : Edit /etc/passwd file
  • vigr -s : Edit /etc/group file

Where,

  • -s : Secure file editing

An example

Login as a root user:

# vipw -s

On other terminal login as normal user (for example vivek) and issue command passwd to change vivek’s password:

$ passwd

(current) UNIX password:
Enter new UNIX password:
Retype new UNIX password:
passwd: Authentication token lock busy

As you see it returned with an error “passwd: Authentication token lock busy”

This will avoid /etc/shadow file corruption.

How to: Allow Any User To Shutdown a Linux Server

Posted on in Categories CentOS, Debian Linux, FreeBSD, Gentoo Linux, Howto, Linux, RedHat/Fedora Linux, Sys admin, Tips, Ubuntu Linux last updated December 28, 2009

You need to use the sudo command to grant a permission to other users to shutdown your server. The sudo command allows a permitted user to execute a command as the superuser or another user, as specified in the /etc/sudoers file. Login as a root user and type the visudo command to edit the sudoers file.

Testing Oracle 10g installation on Red Hat Linux AS 4.0

Posted on in Categories Howto, Linux last updated March 10, 2008

One of my friend installed Oracle first time. After installation, he just wants to make sure everything is working fine so he called me. If you are installing oracle for Unix/Linux oses first time then it will confuse you. He wanted to know how to start oracle service and test it. He emailed me the following error:
ORA-27101: shared memory realm does not exist
ORA-01034: ORACLE not available

You need to add following line to oracle user’s .bash_profile file for testing purpose (once it is tested, you can give control to Oracle DBA) (login as a oracle user):
$ cd;vi .bash_profile
Append following lines:
export ORACLE_HOME=/home/oracle/oracle/product/10.2.0/db_1
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin

Save file. Just load the above settings:
$ . .bash_profile
Start oracle Net listing service:
$ lsnrctl start
ALTERNATIVELY use full path:
$ /home/oracle/oracle/product/10.2.0/db_1/bin/lsnrctl start
Start oracle database:
$ dbstart
ALTERNATIVELY, use full path:
$ /home/oracle/oracle/product/10.2.0/db_1/bin/dbstart
Connect to Oracle database with sqlplus client (test it with scott username):
$ sqlplus "scott/tiger"
sql> select * from tab;

To shutdown Oracle database:
$ lsnrctl stop
$ dbshut

Further readings:

If you are new to Oracle try out Oracle Database 10g Documentation library, especially 2 Day DBA is fantastic document. Do not forget check out John Smiley’s “Installing Oracle Database 10g Release 2 on Linux x86” article. It will teach you the basics of installing Oracle Database 10g Release 2 on Red Hat Enterprise Linux or Novell SUSE Enterprise Linux, from the bare metal up.

HowTo: Recovering Linux Grub Boot Loader Password

Posted on in Categories CentOS, Debian Linux, Howto, Linux, RedHat/Fedora Linux, Suse Linux, Sys admin, Tips, Troubleshooting, Ubuntu Linux last updated May 7, 2010

If you have, a password protected grub boot loader and you forgot both root and grub password, then you can recover grub-boot loader password using the following method/procedure:

* Use Knoppix cd
* Remove the password from Grub configuration file
* Reboot the system
* Change the root password
* Setup new Grub password if required (optional)