Monday, 5 March 2012

PostgreSQL add or create a user account and grant permission for database How to create a user account called tom and grant permission for database called jerry?


How to  create a user account called tom and grant permission for database called jerry?

You need to use following commands.
=> adduser - UNIX/Linux adduser command to add a user to /etc/passwd file
=> psql => It is a terminal-based front-end to PostgreSQL.
=> CREATE USER - Adds a new user to a PostgreSQL database cluster.
=> CREATE DATABASE - create a new database
=> GRANT ALL PRIVILEGES - define access privileges

Procedure to add a user to PostgreSQL database

To create a normal user and an associated database you need to type the following commands. The easiest way to use is to create a Linux / UNUX IDENT authentication i.e. add user tom to UNIX or Linux system first.

Step # 1: Add a Linux/UNIX user called tom

Type the following commands to create a UNIX/Linux user called tom:
# adduser tom
# passwd tom

Step # 2: Becoming a superuser

You need to login as database super user under postgresql server. Again the simplest way to connect as the postgres user is to change to the postgres unix user on the database server using su command as follows:
# su - postgres

Step #3: Now connect to database server

Type the following command
$ psql template1
OR
$ psql -d template1 -U postgres
Output:
Welcome to psql 7.4.16, the PostgreSQL interactive terminal.

Type:  \\copyright for distribution terms
       \\h for help with SQL commands
       \\? for help on internal slash commands
       \\g or terminate with semicolon to execute query
       \\q to quit

template1=# 

Step #4: Add a user called tom

Type the following command to create a user called tom with a password called myPassword (you need to type command highlighted with red color):
template1=# CREATE USER tom WITH PASSWORD 'myPassword';

Step #5: Add a database called jerry

Type the following command (you need to type command highlighted with red color):
template1=# CREATE DATABASE jerry;
Now grant all privileges on database
template1=# GRANT ALL PRIVILEGES ON DATABASE jerry to tom;
Type \q to quit:
template1=# \q

Step #6: Test tom user login

In order to login as tom you need to type following commands. Login as tom or use su command:
$ su - tom
$ psql -d jerry -U tom

Output:
Welcome to psql 7.4.16, the PostgreSQL interactive terminal.

Type:  \\copyright for distribution terms
       \\h for help with SQL commands
       \\? for help on internal slash commands
       \\g or terminate with semicolon to execute query
       \\q to quit

jerry=> 


Ubuntu Linux Install Sun Java Development Kit ( JDK ) and Java Runtime Environment ( JRE )


Installation Setup

1 ) Issue following command to find out current jdk version in apt-get
apt-cache search jdk

2 ) Install java JDK and JRE with apt-get install
apt-get install sun-java6-jdk sun-java6-jre

3 ) Ubuntu will auto download necessary file from web for installation.
Do you want to continue [Y/n]? y
Get:1 http://my.archive.ubuntu.com hardy/main java-common 0.28ubuntu3 [78.2kB]
Get:2 http://my.archive.ubuntu.com hardy/multiverse sun-java6-jre 6-06-0ubuntu1 [6334kB]
Get:3 http://my.archive.ubuntu.com hardy/main odbcinst1debian1 2.2.11-16build1 [66.2kB]
Get:4 http://my.archive.ubuntu.com hardy/main unixodbc 2.2.11-16build1 [289kB]
Get:5 http://my.archive.ubuntu.com hardy/multiverse sun-java6-bin 6-06-0ubuntu1 [27.3MB] 
Get:6 http://my.archive.ubuntu.com hardy/multiverse sun-java6-jdk 6-06-0ubuntu1 [9625kB] 
85% [6 sun-java6-jdk 3208002/9625kB 33%]

4) After installation done, jdk and jre will install at /usr/lib/jvm/java-6-sun-1.6.0.06
5) Ubuntu help to create a java symbolic link and put in /usr/bin for shortcut access
4 ) type java -version, DONE !!

Post-Installation Setup(important)

Set JAVA_HOME into environment variable
Copy following statement and append to /etc/profile or .bashrc file, make system set JAVA_HOME into system environment variable.
export JAVA_HOME="/usr/lib/jvm/java-6-sun-1.6.0.06"

How to create a custom repository disk for Ubuntu.

You can save these packages with install iso on disk

Make Ubuntu look like Mac



Macbuntu is an open-source program, designed to make Ubuntu’s appearance look like Mac OS X. I have written about Macbuntu for previous Ubuntu edition, but Macbuntu package for Ubuntu 11.04 Unity has not come out yet. So here’s how to install Macbuntu package for Ubuntu 10.10 on Ubuntu 11.04 Natty to make Unity look like Mac OS X.
1.) First, download Macbuntu for Ubuntu 10.10 from this page:http://sourceforge.net/projects/macbuntu/files/
2.) Open up a terminal window and uncompress the package:
cd ~/Downloads
tar zxvf Macbuntu-10.10.tar.gz
cd Macbuntu-10.10
3.) Run “install.sh” file will detect Ubuntu version, so first edit it:
gedit install.sh
find out this section:
chk_system()
{
echo “”
echo “Checking Ubuntu version…”
s=`cat /etc/issue | grep -i “$UBUNTU”`
if [ ! -n "$s" ]; then
echo “Failed. System not supported, script will end here”
echo “To ignore their compatibility with current OS try ./install.sh force”
echo “Exiting…”
exit 1;
fi
echo “Passed”
}
change it into:
chk_system()
{
echo “Passed”
}
save it and finally run:
./install.sh
4.) Answer questions and start installation and finally restart.

                     

Step by Step How To Enable Root Login on Fedora 11 or Later version


  To enable root login, the /etc/pam.d/gdm and /etc/pam.d/gdm-password configuration file need to edit. but before you make any adjustment to these configuration file, make sure that you follow the step to  make backup of these two files.

1.  Login on graphical user interface as normal user.
Enable root login on Fedora 11 GUI User Desktop

2.  Open X-terminal by clicking on Applications -> System Tools -> and click on Terminal.


3.  Use copy command to backup the /etc/pam.d/gdm configuration file as show on command example below.
[fedora11@localhost ~]$ su -c "cp -pr /etc/pam.d/gdm /etc/pam.d/gdm.bak"
Password:    <-- type in root user password here and hit Enter key

4.  Type in command on the x-terminal as show on example below to start edit the /etc/pam.d/gdm configuration file using gedit editor. 
pam.d gdm configuration file Fedora 11
[fedora11@localhost ~]$ su -c "gedit /etc/pam.d/gdm"
Password:    <-- type in root user password here and hit Enter key

5.  To enable root login on Fedora 11 you must delete or comment out the "auth       required    pam_succeed_if.so user != root quiet" as show on example below.
Fedora 11 gdm configuration file
-  /etc/pam.d/gdm configuration file
=====================================================
#%PAM-1.0
auth     [success=done ignore=ignore default=bad] pam_selinux_permit.so
# auth       required    pam_succeed_if.so user != root quiet   <-- Put "#" hash sign in front of this line to comment out the line
auth       required    pam_env.so
auth       substack    system-auth
auth       optional    pam_gnome_keyring.so
account    required    pam_nologin.so
account    include     system-auth
password   include     system-auth
session    required    pam_selinux.so close
session    required    pam_loginuid.so
session    optional    pam_console.so
session    required    pam_selinux.so open
session    optional    pam_keyinit.so force revoke
session    required    pam_namespace.so
session    optional    pam_gnome_keyring.so auto_start
session    include     system-auth
=====================================================

6.  Save and exit the editor.

7.  Again.. use copy command to backup the /etc/pam.d/gdm-password configuration file as show on command example below.

[fedora11@localhost ~]$ su -c "cp -pr /etc/pam.d/gdm-password /etc/pam.d/gdm-password.bak"
Password:    <-- type in root user password here and hit Enter key

8.  Then open and edit the /etc/pam.d/gdm-password using gedit editor by type in command as show on example below. 
pam.d gdm-password configuration file Fedora 11
[fedora11@localhost ~]$ su -c "gedit /etc/pam.d/gdm-password"
Password:    <-- type in root user password here and hit Enter key

9.  Delete or just comment out the "auth        required      pam_succeed_if.so user != root quiet" line.. see example below. 
Fedora 11 gdm-password configuration file
-  /etc/pam.d/gdm-password configuration file.
=====================================================
auth        substack      password-auth
# auth        required      pam_succeed_if.so user != root quiet   <-- Put "#" hash sign in front of this line to comment out the line
auth        optional      pam_gnome_keyring.so

account     required      pam_nologin.so
account     include       password-auth

password    include       password-auth

session     required      pam_selinux.so close
session     required      pam_loginuid.so
session     optional      pam_console.so
session     required      pam_selinux.so open
session     optional      pam_keyinit.so force revoke
session     required      pam_namespace.so
session     optional      pam_gnome_keyring.so auto_start
session     include       password-auth
=====================================================

10.  Then save and exit the gedit editor.

11.  Logout or just restart the system... and then try to login root user on Fedora 11 GUI Desktop. :-)
Step by Step How To Enable Root Login on Fedora 11 GUI Root Desktop

BOSS LINUX India's Operating System

I am proud to say that India has its own os named BOSS Linux .It is  Linux OS  based on Debian.It is user friendly OS.It is produced by Bharat Operating System Solutions with C-DAC.


BOSS (Bharat Operating System Solutions) is a GNU/Linux distribution developed by C-DAC
, Chennai in order to benefit the usage of Free/Open Source Software throughout India. BOSS
GNU/Linux is a key deliverable of NRCFOSS.It has enhanced Desktop Environment integrating
Indian language support and other packages that are relevant for use in the
 Indian government domain.
BOSS makes it easier for Microsoft Windows user to migrate to GNU/Linux platform,
 by providing outstanding features like bulk document converter, presentation tool and
also features like plug and play. BOSS is customized for the ease of use in
 Educational Domains (schools & colleges) and variants are available to suit
Enterprise users (Server Edition).
For more visit www.bosslinux.in
 

RESTORE DELETE KEY FOR MOVING FILES TO TRASH IN UBUNTU 11.10 / FEDORA 15 [QUICK TIP]


In GNOME 3 (be it Fedora 15, Ubuntu 11.10 with Unity or GNOME Shell, etc.), you can't move files or folders to trash by pressing the DELETE key anymore and you must use CTRL + DELETE instead. But you can restore the Gnome 2 behavior - just follow the steps below.

Important note: for Ubuntu 11.10 Oneiric Ocelot with Unity (either 2D or the regular Unity), you must install GNOME Shell and follow the steps below while being logged in to GNOME Shell. This won't work in Unity (there is an alternate method for this but it also doesn't work without installing GNOME Shell). This doesn't apply to Fedora 15 because it comes with GNOME Shell by default (unless you've removed GNOME Shell).


Firstly, here is a video I've recorded to make it easier to understand how this works:




And here are the step by step instructions:

1. To be able to replace the new CTRL + DELETE keyboard shortcut for moving files to trash in Nautilus with DELETE, run the following command in a terminal (this will enable changing accels):
gsettings set org.gnome.desktop.interface can-change-accels true

2. Now select a file or folder in Nautilus, then hover the "Move to trash" menu item in Nautilus (under "Edit") and press the DELETE key twice:

Nautilus ctrl + delete key


Nautilus Delete key

The keyboard shortcut should change from "Ctrl + Delete" to "Delete".

3. Restore the original settings so you don't change an accel by accident, using the command below (this will disable changing accels):
gsettings set org.gnome.desktop.interface can-change-accels false

At this point, the "delete" key should be used for moving the files to trash, just like in Gnome 2.