13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

324Chapter 14Storing the Data-bash-2.05b$ createuser mschwarzShall the new user be allowed to create databases? (y/n) yShall the new user be allowed to create more new users? (y/n) yCREATE USER-bash-2.05b$Here, we created the PostgreSQL user mschwarz and gave him the abilityto create databases and new users.14.9.3 Creating Our DatabaseNow that our username, mschwarz, has been created and is authorized to createdatabases, we use the createdb command to create our database:[mschwarz@cassidy mschwarz]$ createdb budgetProCREATE DATABASENotice that we did this as the <strong>Linux</strong> user mschwarz, so the createdbcommand used that username when it created the budgetPro database. Whatwould have happened if we had used a <strong>Linux</strong> user that did not have a matchingPostgreSQL user? Let’s see:[albing@cassidy albing]$ createdb budgetProcreatedb: could not c<strong>on</strong>nect to database template1: \FATAL: user "albing" does not existWARNINGNote that we have not implemented any security yet. The user mschwarz exists,but it does not have a password. Depending <strong>on</strong> how PostgreSQL securityis c<strong>on</strong>figured, it may be possible for any user to use the -U opti<strong>on</strong> with thePostgreSQL command-line utilities to impers<strong>on</strong>ate mschwarz. As packagedfor Fedora Core 2, PostgreSQL uses ident to check authenticati<strong>on</strong>, so whenalbing attempts this, he gets this error:[albing@cassidy albing]$ createdb -U mschwarz budgetProcreatedb: could not c<strong>on</strong>nect to database template1: \FATAL: IDENT authenticati<strong>on</strong> failed for user "mschwarz"Just remember that this behavior is dependent <strong>on</strong> the local c<strong>on</strong>figurati<strong>on</strong>of PostgreSQL. You cannot assume this security is in place just because youare in a PostgreSQL envir<strong>on</strong>ment. Always be aware of the security c<strong>on</strong>figurati<strong>on</strong>of your producti<strong>on</strong> envir<strong>on</strong>ment!

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!