LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-11-2014, 11:37 PM   #1
Huamin
Member
 
Registered: May 2011
Posts: 562

Rep: Reputation: 12
Which privilege to add to user


Hi,
It means huamin user below, is not able to access the folder,

[huamin@CentOS65x64 ~]$ cd /var/lib/pgsql/data/
bash: cd: /var/lib/pgsql/data/: Permission denied
[huamin@CentOS65x64 ~]$ su
Password:
[root@CentOS65x64 huamin]# cd /var/lib/pgsql/data/
[root@CentOS65x64 data]#

then which privileges should be added to "huamin"?
 
Old 07-12-2014, 06:53 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
The 'su' command has a manual page. Please read 'man su', configure, test and then ask.
 
Old 07-12-2014, 03:24 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 22,029

Rep: Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632Reputation: 3632
command ls -l should show the user, owner and group. chmod would allow the user to access the files or folders.
 
Old 07-13-2014, 04:32 PM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,715
Blog Entries: 4

Rep: Reputation: 3951Reputation: 3951Reputation: 3951Reputation: 3951Reputation: 3951Reputation: 3951Reputation: 3951Reputation: 3951Reputation: 3951Reputation: 3951Reputation: 3951
For postgres SQL data, you probably do not want to assign permissions to anyone beyond those that the Postgres configuration already uses!

STOP and read the Postgres documentation ... thoroughly. Do not do anything further, until you have done so.
 
Old 07-13-2014, 11:00 PM   #5
Huamin
Member
 
Registered: May 2011
Posts: 562

Original Poster
Rep: Reputation: 12
Jefro,
"pqsql" is now having this

drwx----w-. 4 postgres postgres 4096 Jul 11 17:36 pgsql

what privilege should be added to the user, to be able to access this folder?
 
Old 07-13-2014, 11:14 PM   #6
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,280
Blog Entries: 24

Rep: Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227
Quote:
Originally Posted by Huamin View Post
Jefro,
"pqsql" is now having this

drwx----w-. 4 postgres postgres 4096 Jul 11 17:36 pgsql

what privilege should be added to the user, to be able to access this folder?
Those permissions must be

Code:
drwx------ postgres postgres
You should NEVER grant any other user permission to access that directory!

Postgresql will refuse to start if you change those permissions!

Why would you want huamin user to access that directory?
 
Old 07-14-2014, 03:15 AM   #7
Huamin
Member
 
Registered: May 2011
Posts: 562

Original Poster
Rep: Reputation: 12
why I want to adjust the privilege to the user on the folder, is due to that I encounter this problem below, to start Postgresql.

[huamin@CentOS65x64 ~]$ postgres -D /usr/local/pgsql/data
postgres cannot access the server configuration file "/usr/local/pgsql/data/postgresql.conf": No such file or directory

what to adjust then?
 
Old 07-14-2014, 09:11 AM   #8
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,627

Rep: Reputation: 2518Reputation: 2518Reputation: 2518Reputation: 2518Reputation: 2518Reputation: 2518Reputation: 2518Reputation: 2518Reputation: 2518Reputation: 2518Reputation: 2518
Quote:
postgres cannot access the server configuration file "/usr/local/pgsql/data/postgresql.conf": No such file or directory
That is not a permissions issue. In your initial post you tried to access a file as a normal user and were denied. You then were able to access as root without a permission denied. Other members have explained that you should use postgres user to access. The error above is telling you that particular file does not exist which is another issue. I'm not familiar with postgres but someone should be along to give you some advice.
 
Old 07-14-2014, 04:50 PM   #9
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,280
Blog Entries: 24

Rep: Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227Reputation: 4227
Quote:
Originally Posted by Huamin View Post
why I want to adjust the privilege to the user on the folder, is due to that I encounter this problem below, to start Postgresql.

[huamin@CentOS65x64 ~]$ postgres -D /usr/local/pgsql/data
postgres cannot access the server configuration file "/usr/local/pgsql/data/postgresql.conf": No such file or directory

what to adjust then?
That is a whole different problem/question from that in your original post.

I suspect that you have never initialized postgresql at all - hence no configuration or data files...

See man {postgres,initdb} for how to initialize and start your version of postgresql properly.

But I would stress once more, if you have changed directory permissions along that path, postgresql will refuse to start and write something like the following to the postgres log file:

Code:
FATAL:  data directory "/var/lib/pgsql/data" has group or world access
DETAIL:  Permissions should be u=rwx (0700).

Last edited by astrogeek; 07-14-2014 at 04:52 PM.
 
  


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
user privilege kais1 Linux - Newbie 1 04-08-2012 07:53 PM
user privilege Punareay Solaris / OpenSolaris 2 08-18-2010 01:09 AM
User privilege script Punareay Programming 6 08-24-2009 03:51 AM
Giving privilege to user Corrado Linux - Security 5 08-20-2008 05:19 PM
Super user privilege pvpnguyen Linux - Security 4 02-01-2008 10:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:22 AM.

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
Open Source Consulting | Domain Registration