Lab: unable to edit pg_hba.conf properly for troubleshoot developement environment

I have tried using sudo vi /etc/postgresql/10/main/pg_hba.conf. Still not working

1 Like

Can you paste here o/p of error?

@Tej-Singh-Rana on clicking check button for this question, it says “pg_hba.conf” file not updated correctly.
So after that i checked the content of file using cat command and i have pasted the content of file in question itself

So it’s working now?

No , its not working. Can you let me know where do i need to put that exactly in a file or can you share the file? i am also facing issue navigating through file.

Which lab number it is?
Got it.

it is the last lab in linux basic course . “Troubleshoot development environmet”

Issue in the file, when you will run ls -l command :
ls -l /etc/postgresql/10/main/pg_hba.conf
You will see there is no permission to write for other users into the file so you need to change the permission of the file.
Do with the command:
sudo chmod 777 /etc/postgresql/10/main/pg_hba.conf
after edit the file change again the file permission
sudo chmod 644 /etc/postgresql/10/main/pg_hba.conf
After changes in the configuration file, make sure restart the postgresql service

okay. That explains correctly. Thanks

but no matter what i try it always says that pg_hba.conf not updated correctly. I have again ran cat command and i do see that changes are made but its still not proceeding. Below is the conctent of the file

# Database administrative login by Unix domain socket
local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5
# Allow replication connections from localhost, by a user with the
# replication privilege.



host    all             all             0.0.0.0/0               md5
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            md5
host    replication     all             ::1/128                 md5

Where you will see this message?

i see that message on Right side.

I am able to proceed with other question and able to complete the lab successfully. i believe that file has been changed successfully but there is error in validation to check for this question.

I am even able to access project mercury on my browser.

Thanks

Hi @bhvk49 & @Tej-Singh-Rana,

I am also facing issues with editing the pg_hba.conf file. It doesn’t seem to matter what I do. I have changed the permissions and the editor just does not seem to work. For example, when I go into insert mode with i @ the end of the file and attempt to type anything the last line gets deleted and replaced with the letter B and when I exit command mode and try to undo the last action with u, the editor seems to not know what to do…

Also, if I attempt to scroll down in insert mode the same thing happens (see scroll-i-png).

I’m not sure what to do. This happened to me yesterday as well.

I am going to attempt to move forward with the other challenges in the lab.

Cheers:-)

1 Like

Hi @juliettet,

Yeah, actually i don’t understand this. Every other vi commands and file edits for the labs worked perfectly.Only in this lab it behaves strange.

One thing i have noticed is that, it does get saved after changes, it just doesn’t reflect when we hit check button. Mine next question and challenges worked fine and i was able to access project mercury perfectly.

I do see that line is still not added in your file. i believer it might create issue in upcoming question. You may copy content of my file i have pasted here :slight_smile:

what i have done is 1. Opened that file using vi command 2. Haven’t gone to the end of the file(just gone to the last third line). 3. Entered insert mode(it’s quite challenging as there issue in this). 4. It might add some letter, delete that letter and start typing the content manually(do not copy paste). 5. hit ‘Esc’ key and type :wq(to save the file)

Hope this helps

1 Like

Hi @bhvk49,

Thank you for responding. I know…It is strange. Hmmm…

Every other vi commands and file edits for the labs worked perfectly.Only in this lab it behaves strange.

Yep. Same here:-)

I do see that line is still not added in your file

I was trying to add it at the end of the file, but it wouldn’t let me. I am going to try your suggestion to copy and paste what you have (if it will let me). Wish me luck!!

Thank you again! :grinning:

1 Like

Okay @juliettet I will look into it. Thanks for reporting.

1 Like

Thank you @Tej-Singh-Rana. I gave this exercise another go yesterday and the same thing happened.

I thought I was doing wrong when i saw characters appearing. Looks like many actually faced this issue.

1 Like

They fixed the issue and I also checked. You can try now. Report it if you face again. Thanks

2 Likes

Everything is working as expected now. I have just finished the task. I’ll post back if I come across any more issues. Thanks!!

1 Like

This thing even didn’t worked for me. As a work around I had to use ‘echo’ command along with redirection to append to the file. You can use that for now.

Regards.

1 Like