LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-01-2020, 02:44 PM   #1
deretsigernu
Member
 
Registered: May 2007
Distribution: Slackware 14.1/-current
Posts: 118

Rep: Reputation: 9
change permissions on subdirectory


Hi,

My computer dual boots Slackware 14.2-64-current and Windows 10. Along with partitions for the two OSes, I have another partition that has the file system ntfs-3g. I use this to store data that are used in both OSes, such as data spreadsheets or GIS files.

I installed PostgreSQL-12.1 on Slackware and I am working with the post-installation set up. From the documentation, these are the main steps:
Code:
./configure
make
su
make install
adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
I created a new directory on the data partition as
/fat-d/projects_and_data/data/linux/pgsql/data

For step 7, "chown postgres /usr/local/pgsql/data", I modified the command to
Code:
bash-5.0# chown postgres /fat-d/projects_and_data/data/linux/pgsql/data
but when I check the directory, the ownership doesn't change.

Code:
bash-5.0# ls -la /fat-d/projects_and_data/data/linux/pgsql/data
total 0
drwxrwxrwx 1 root root   0 Feb  1 11:23 .
drwxrwxrwx 1 root root 144 Feb  1 11:23 ..
I'm not sure what exactly is causing this problem. I suspect it has something to do with the configuration somewhere, but not sure of that. I was wondering if it has something to do with fstab? Here is my /etc/fstab:

Code:
/dev/sda7        swap             swap        defaults         0   0
/dev/sda5        /                ext4        defaults         1   1
/dev/sda2        /boot/efi        vfat        defaults         1   0
/dev/sda4        /fat-c           ntfs-3g     fmask=133,dmask=022 1   0
/dev/sda6        /fat-d           ntfs-3g     fmask=111,dmask=000 1   0
#/dev/cdrom      /mnt/cdrom       auto        noauto,owner,ro,comment=x-gvfs-show 0   0
/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       nosuid,nodev,noexec 0   0
That's just a guess though. How would I get the new directory I created for PostgreSQL to be owned by user postgres? I don't want to create the ...pgsql/data directory on the linux partition because that partition is pretty small and could fill up quickly with data files.
 
Old 02-01-2020, 04:05 PM   #2
captain_sensible
Member
 
Registered: Apr 2010
Posts: 204

Rep: Reputation: 59
i'm slightly surprised that you would approach installing any software the "old fashioned way" .

Slackbuilds.org is usually my first port of call to read up on packages dependencies . So example

You need a "postgres" user and group prior to building postgresql.
Something like this will suffice for most systems:
groupadd -g 209 postgres
useradd -u 209 -g 209 -d /var/lib/pgsql postgres

but that package is for stable and your on current; so i am . I use slpkg for "diligent" use to install .

bash-5.0# slpkg -F postgresql

Packages with name matching [ postgresql ]

+==============================================================================
| Repository Package Size
+==============================================================================
sbo postgresql-10.10 0 K
conrad postgresql-12.1-x86_64-2cf.txz 9240 K
 
Old 02-01-2020, 05:10 PM   #3
deretsigernu
Member
 
Registered: May 2007
Distribution: Slackware 14.1/-current
Posts: 118

Original Poster
Rep: Reputation: 9
I tried the sbopkg repository. It supplies 10.x and I keep getting an error message. Like

Code:
psql: could not connect to server: No such file or directoryIs the server running locally and acceptingconnections on Unix domain socket "/tmp/.s.PGSQL.5432"?
or

Code:
postgres does not know where to find the server configuration file.
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.
I ran
Code:
groupadd -g 209 postgres
useradd -u 209 -g 209 -d /var/lib/pgsql postgres
as instructed prior to installation and it seems like certain directories or other configurations were missing anyway. I even ran the installation a 2nd time through sbopkg. I was getting tired of trying to hunt down them down, so I figured I'd just get the app straightaway.
 
Old 02-01-2020, 09:59 PM   #4
An Infamous Historian
LQ Newbie
 
Registered: Jan 2020
Location: Southern California
Distribution: Slackware
Posts: 16

Rep: Reputation: Disabled
I don't think that's the issue re: changing permissions.

Is /fat-d your NTFS partition? How have you mounted it? NTFS partitions CAN be used w/Unix permissions, although it requires a specific mount option that iirc may break Windows compatibility (I may be wrong about that, and even if I'm right there may be a new way that doesn't break it--it's been a while).

Last edited by An Infamous Historian; 02-01-2020 at 10:07 PM.
 
Old 02-02-2020, 10:34 AM   #5
captain_sensible
Member
 
Registered: Apr 2010
Posts: 204

Rep: Reputation: 59
conrad repo has the x12 conrad postgresql-12.1-x86_64-2cf.txz 9240 K
 
Old 02-02-2020, 05:01 PM   #6
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,185

Rep: Reputation: 662Reputation: 662Reputation: 662Reputation: 662Reputation: 662Reputation: 662
Quote:
Originally Posted by deretsigernu View Post
How would I get the new directory I created for PostgreSQL to be owned by user postgres?.
On a ntfs partition: you do not. The ntfs file system doesn't have the concept of "file owner", so Linux handles it with all of the files (and directories) having the same owner. It is just a fake ID as no owner can be stored and the owner/group is specified by the mounting process.
Real file owners (and groups) are only supported on Linux(Unix) file systems.
 
Old 02-02-2020, 05:55 PM   #7
An Infamous Historian
LQ Newbie
 
Registered: Jan 2020
Location: Southern California
Distribution: Slackware
Posts: 16

Rep: Reputation: Disabled
Quote:
Originally Posted by ehartman View Post
On a ntfs partition: you do not. The ntfs file system doesn't have the concept of "file owner", so Linux handles it with all of the files (and directories) having the same owner. It is just a fake ID as no owner can be stored and the owner/group is specified by the mounting process.
Real file owners (and groups) are only supported on Linux(Unix) file systems.
As I explained above, there is a way to do it, by mounting with the "permissions" option. My understanding is that this might break Windows compatibility, but it can be done--and there might be another, compatible way to do it too.
 
Old 02-02-2020, 06:06 PM   #8
vtel57
Senior Member
 
Registered: Jul 2006
Location: VPN Tunnel, USA
Distribution: Slackware64 14.2
Posts: 1,287

Rep: Reputation: 275Reputation: 275Reputation: 275
Everyone else here is helping the OP, so I'd just like to inject one thing. If you're wanting to have partitions with common access from Win and Lin, then you should always format these partitions as FAT. Makes life much easier. A copy of my /etc/fstab with a win-lin common partition (vfat):

Code:
/dev/sda4        swap             swap        defaults         0   0
/dev/sdb4        swap             swap        defaults         0   0
/dev/sda1        /                ext4        defaults         1   1
/dev/sda2        /home            ext4        defaults         1   2
/dev/sda3        /home/vtel57/vtel57_storage ext4        defaults         1   2
/dev/sdc2        /home/vtel57/vtel57_common vfat        fmask=111,dmask=000 1   0
#/dev/cdrom      /mnt/cdrom       auto        noauto,owner,ro,comment=x-gvfs-show 0   0
/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
/dev/sdj4        /mnt/zip	  vfat	      noauto,rw,user,nosuid,sync,mode=0777	
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       defaults         0   0
Anyway, carry on...
 
Old 02-02-2020, 08:46 PM   #9
deretsigernu
Member
 
Registered: May 2007
Distribution: Slackware 14.1/-current
Posts: 118

Original Poster
Rep: Reputation: 9
@captain sensible
Thanks for the suggestion. I'll look at adding the repo.

@ehartman
Thank you for answering my specific question. I realize that An Infamous Historian's answer contradicts your answer and I suppose I can try to look into that answer, but if doing as suggested messes up the Windows access to the partition, it kind of defeats the purpose of being able to access the partition from either OS.

@vtel57
I used VFAT on one of my earlier laptops that was dual boot. I don't remember what made me switch to NTFS. I think something at the time (years ago now) indicated that NTFS was more reliable. Maybe faster? That might have been when I was using Red Hat as my linux partition. Now, I don't know the exact advantages and disadvantages of using VFAT or NTFS, but so far, NTFS has worked fine on my last 2 dual boots. If VFAT lets me have the mixed linux permissions more easily though, it might be a better option for me. That's going to take some time to figure out. Thanks for mentioning it and giving me some food for thought.
 
1 members found this post helpful.
Old 02-02-2020, 09:10 PM   #10
vtel57
Senior Member
 
Registered: Jul 2006
Location: VPN Tunnel, USA
Distribution: Slackware64 14.2
Posts: 1,287

Rep: Reputation: 275Reputation: 275Reputation: 275
Well, a FAT32 partition definitely has its drawbacks (file size limits, etc.), but I've always found it easier to work with in Linux.

Anyway, glad you got some help here. Hopefully, you'll get your system all squared away as you need it to be.

Cheers!

~Eric
 
Old 02-05-2020, 10:25 PM   #11
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 1,665

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by deretsigernu View Post
I tried the sbopkg repository. It supplies 10.x and I keep getting an error message. Like

Code:
psql: could not connect to server: No such file or directoryIs the server running locally and acceptingconnections on Unix domain socket "/tmp/.s.PGSQL.5432"?
or

Code:
postgres does not know where to find the server configuration file.
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.
I ran
Code:
groupadd -g 209 postgres
useradd -u 209 -g 209 -d /var/lib/pgsql postgres
as instructed prior to installation and it seems like certain directories or other configurations were missing anyway. I even ran the installation a 2nd time through sbopkg. I was getting tired of trying to hunt down them down, so I figured I'd just get the app straightaway.
When using the build from SBo, you can start it by doing:

Code:
chmod +x /etc/rc.d/rc.postgresql
/etc/rc.d/rc.postgresql start
The first time you run it, you may get an error like this:
Quote:
You should initialize the PostgreSQL database at location /var/lib/pgsql/10.10/data
e.g. su postgres -c "initdb -D /var/lib/pgsql/10.10/data --locale=en_US.UTF-8 -A md5 -W"
Just follow that instruction, start it again, and you should be good to go.
 
Old 02-06-2020, 04:19 AM   #12
enorbet
Senior Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware = Main OpSys for decades while testing others to keep up
Posts: 2,623

Rep: Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712
Maybe I'm just being dense but in some 20 years of using Slackware as my main I've never had difficulty with NTFS in Linux or in Windows, though I rarely ever even boot an ancient Win7 partition. Point being I find no compulsion or value in reverting to FAT of any kind though the new exFat may be a decent change... I wouldn't know.

All I have ever done is use the fmask and dmask entries just as vtel57 does but on NTFS like this

Code:
 ###excerpt from /etc/fstab###
/dev/sdb2        /mnt/Win7-64        ntfs-3g     fmask=111,dmask=000     1   0
/dev/sdb5        /mnt/ntfs5          ntfs-3g     fmask=111,dmask=000     1   0
... works perfectly

##NOTE : As applies to installation, although I sometimes just build from source and don't bother with a Slackbuild when no new dependencies are involved (not that Slackbuilds are any bother at all... prolly just habit) still I avoid "make install" simply because it makes uninstall difficult and lacks support data. I either make my own slackbuild or at the very least just "makepkg" so it appears in /var/log/packages/ and is easily uninstalled or upgraded....

... and speaking of which, why in Hell have some devs in other "more mainstream" distros chosen to cease using the oh so obvious and useful /var/log/packages? Do these people have nothing better to do than make Linux unnecessarily complex?

Last edited by enorbet; 02-06-2020 at 04:27 AM.
 
Old 02-10-2020, 10:12 AM   #13
deretsigernu
Member
 
Registered: May 2007
Distribution: Slackware 14.1/-current
Posts: 118

Original Poster
Rep: Reputation: 9
@enorbet, do you mean that you have an NTFS partition that has multiple ownerships on it, like what I'm trying to do? My fmask and dmask settings are the same as yours, but I can't create a folder while I'm logged into Slackware that is owned by anyone but root.

Regarding package installation, your description is helpful. I did not know about makepkg or skipping make install. To be clear, if I skip the "make install", I have to either make a custom slackpkg or or use makepkg to finish the install?

Last edited by deretsigernu; 02-10-2020 at 10:15 AM. Reason: typo
 
Old 02-16-2020, 03:29 PM   #14
mumahendras3
Member
 
Registered: Feb 2018
Location: Indonesia
Distribution: Slackware
Posts: 41

Rep: Reputation: Disabled
Hi @deretsigernu,

In NTFS-3G FAQ: https://www.tuxera.com/community/ntf...q/#permissions

Quote:
Why have chmod and chown no effect?

By default files on NTFS are owned by root with full access to everyone. To get standard per-file protection you should mount with the “permissions” option. Moreover, if you want the permissions to be interoperable with a specific Windows configuration, you have to map the users.
I haven't tried that myself though, maybe worth to try.

Cheers
 
1 members found this post helpful.
Old 02-17-2020, 08:25 PM   #15
deretsigernu
Member
 
Registered: May 2007
Distribution: Slackware 14.1/-current
Posts: 118

Original Poster
Rep: Reputation: 9
@mumahendras3, that link provides a lot of useful information. I will read the material and try to make sense of it. Thanks for pointing to the documentation. I didn't think it was an issue with NTFS-3G, but mount, so getting through NTFS-3G may do the trick for me.
 
  


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
[SOLVED] Permissions Permissions Permissions! makem Linux - Newbie 13 07-30-2015 12:54 PM
Restoring directory and subdirectory permissions/ownership nativetongue03 Solaris / OpenSolaris 1 03-22-2014 09:51 AM
Permissions Issue: directory+ subdirectory r/w etc access for current user? ChiggyDada Linux - Newbie 1 01-28-2013 07:48 AM
ACL permissions on subdirectory Gerard Lally Linux - Newbie 5 03-19-2012 06:59 PM
Samba subdirectory permissions darthfoolish Linux - Networking 3 11-23-2006 03:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:18 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