LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-12-2006, 07:16 AM   #1
Spus
LQ Newbie
 
Registered: Jun 2006
Posts: 4

Rep: Reputation: 0
pg_hba.conf problem


Hi,

I am a complete newbie at this and my questions could sound very stupid but anyway:

I have to change the data in this pg_hba.conf file in order to be able to remotely edit my postgre/php system. Unfortunately I am not familiar to any extend with *nix OS or DOS commands. This is a complete darkness to me.

I somehow found that if I type:

locate pg_hba.conf

...and press enter, it gives me several possible locations of the file I searched for.

/usr/local/pgsql/data/pg_hba.conf
/usr/local/pgsql/data1/pg_hba.conf
/usr/local/pgsql/share/pg_hba.conf.sample
/home/user1/postgresql-7.4.7/src/backend/libpq/pg_hba.conf.sample

I am aware that there are two users of the system: "user1" and "user2".

My first question is:

I have loged the system as user1 and since I know the meaning of

/home/user1/postgresql-7.4.7/src/backend/libpq/pg_hba.conf.sample

what is the meaning of

/usr/local/pgsql/data/pg_hba.conf
/usr/local/pgsql/data1/pg_hba.conf

... and how to enter those directories?

My second question is: What command should I use to open and edit the file, when I get to it?

Thanks in advance!

Sena Aid
 
Old 06-12-2006, 07:52 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
What do you mean by "what is the meaning of..."? locate tells you the locations of filenames matching what you've entered. Here, it tells you that there are files located in /usr/local/pgsql/data and /usr/local/pgsql/data1 named pg_hba.conf. You can enter those directories using cd, e.g. "cd /usr/local/pgsql/data1".

You can use any text editor to edit the files, it's up to you. You just need to follow the executable with the filename, e.g. "vi pg_hba.conf", "emacs pg_hba.conf", etc. You may find nano/pico easy to use and also you may need to become root to edit the files (which you can do with su).
 
Old 06-12-2006, 07:52 AM   #3
worzel68
Member
 
Registered: May 2006
Location: Sydney
Distribution: FC5, FC3, AIX, System V,
Posts: 50

Rep: Reputation: 15
Hi Spus & welcome to LQ


Quote:
/usr/local/pgsql/data/pg_hba.conf
to change to this directory use:

Quote:
cd /usr/local/pgsql/data
One way to edit the file (there several different ways)

Quote:
gedit pg_hba.conf &
Or, to combine the two together do this:

Quote:
gedit /usr/local/pgsql/data/pg_hba.conf &
gedit opens a window with the file in it, availble for editing

The first argument is the file name.

The & runs the command in the background, as opposed to running it exclusively. One should always use the ampersand when running anything that is going to open it's own window.

I am not sure of the specifics of PostgreSQL, but there is one other thing to be aware of:

Linux has files which are links, they are conceptually the same thing as a shortcut in windows. Be careful that some of the files found in your locate command could be links to 1 file - so you might only have to edit 1 file. When you look at the files user a file browser it should tell you whether it's link or not.

How to open Nautilus:

Quote:
nautilus &
or open it from the main menu.

It's not a bad idea to fill in which distribution of Linux you are using, in your LQ profile. This info is rather helpful to those trying to help.


Nylex is faster at typing than me
anyway have a great time with Linux

Last edited by worzel68; 06-12-2006 at 07:54 AM.
 
Old 06-12-2006, 09:12 AM   #4
Spus
LQ Newbie
 
Registered: Jun 2006
Posts: 4

Original Poster
Rep: Reputation: 0
Thank You both, now I can enter those directories and even read the file, using the vi command, but I still don know how to edit it.

Unfortunately non of the text editors You mentioned dos not work.

I also have an ftp access to the system, using user1 and user2 data to login, but it does not work with the su username and password.

As for the linux distribution, this is what I receive, when log in the system:

Last login: Mon Jun 12 15:50:25 2006 from *******************
Linux 2.4.26.


I can only say it is Slackware 10.xx or close to it, I do not know how to define it.

Thanks in advance.


Sena Aid
 
Old 06-12-2006, 09:18 AM   #5
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
There's a guide to vi here.
 
Old 06-12-2006, 09:26 AM   #6
worzel68
Member
 
Registered: May 2006
Location: Sydney
Distribution: FC5, FC3, AIX, System V,
Posts: 50

Rep: Reputation: 15
If you are using vi, be careful!

press the "i" key to insert text (this is insert mode) then Escape key when finished inserting.

press the "x" key to delete 1 character.

type :wq to write & quit

or :q to quit without saving

even easier look on the menus for a text editor - just like windows with Copy, Paste, Cut.

Check out the man pages

Have fun. Nylex beat me again
 
Old 06-12-2006, 10:10 AM   #7
Spus
LQ Newbie
 
Registered: Jun 2006
Posts: 4

Original Poster
Rep: Reputation: 0
Thank You!

I've found another one - mcedit, and it actually worked, so I've done it already.

Thanks again.


Sena Aid
 
Old 06-12-2006, 11:08 AM   #8
Spus
LQ Newbie
 
Registered: Jun 2006
Posts: 4

Original Poster
Rep: Reputation: 0
Restart the system

Actually there is one more problem, obviously I have to restart the system for the changes to take effect, but I'm not sure how to do it remotely. I use Putty to connect to the server, and I do not know which server to restart, the Apache, the Postgre, or the Linux?

Please, I'm totally
 
Old 06-13-2006, 01:19 AM   #9
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
You could just reboot the machine, that would be the easiest way and you'd at least know that everything was restarted.
 
Old 06-13-2006, 02:41 PM   #10
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
If you only change the postgres configuration postgres is obviously
all you'll need to restart. If it's a slack-box there may (or may
not) be a special startup-script that you can use to do that, depending
on who and how they installed postgres.

If you have root-access something like (paths adjusted, of course)
should work ...

Code:
su - postgres -c "/usr/local/pgsql/bin/pg_ctl stop -l /usr/local/pgsql/data/logfile -D /usr/local/pgsql/data

Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DNS Hosts.conf or resolv.conf problem mac_casey SUSE / openSUSE 0 03-26-2006 10:21 AM
.conf problem Fredstar Linux - Newbie 2 10-20-2004 10:27 PM
SUSE 9.1: named.conf works, but including separate conf files doesn't??? registering Linux - Distributions 0 06-09-2004 05:03 PM
grub.conf problem BlandoCal Fedora 23 12-12-2003 04:23 AM
pg_hba.conf hubergeek Linux - General 0 04-22-2002 02:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration