You are not logged in.
I have an ext4 external disk that is normally connected to a file server.
For all the files on the disk, the owner is `root` and the group is `users`.
A sample directory on the disk looks like this:
root@fileserver:/media/ARCHIVE1# ls -la logs/
drwxrwxr-- 2 root users 4096 May 18 02:17 .
drwxrwxr-- 17 jimjamz users 4096 Aug 1 05:19 ..
-rwxrwxr-- 1 root users 93764 Feb 26 2016 AVSCAN-20160225-214734-AB9989CA.LOG
-rwxrwxr-- 1 root users 80226 Mar 25 2016 AVSCAN-20160324-113755-5CAA2791.LOG
-rwxrwxr-- 1 root users 4359 Jul 12 2016 diff_20160611.log
-rwxrwxr-- 1 root users 890 May 28 2017 diff_20161010.log
-rwxrwxr-- 1 root users 45911 Oct 14 2016 diff_20161013.log
-rwxrwxr-- 1 root users 46636 Oct 16 2016 diff_20161015.log
-rwxrwxr-- 1 root users 22300 May 28 2017 diff_20161025.log
-rwxrwxr-- 1 root users 37032 Nov 1 2016 diff_20161101.log
-rwxrwxr-- 1 root users 45926 Nov 12 2016 diff_20161112.log
-rwxrwxr-- 1 root users 43374 Dec 31 2016 diff_20161231.log
-rwxrwxr-- 1 root users 54553 May 18 02:17 diff_dir.log
-rwxrwxr-- 1 root users 1551 May 28 2017 fsum_openssl_conversion.log
On my bunsenlabs laptop, I have created and added myself to a group also called `users`:
sudo useradd -g users jimjamz
However, when I connect the disk to my bunsenlabs laptop, and try to view the same directory, I see:
jimjamz@bunsen-mac:/media/jimjamz/ARCHIVE1$ ls -la logs/
ls: cannot access 'logs/diff_20161013.log': Permission denied
ls: cannot access 'logs/AVSCAN-20160225-214734-AB9989CA.LOG': Permission denied
ls: cannot access 'logs/diff_20161025.log': Permission denied
ls: cannot access 'logs/diff_dir.log': Permission denied
ls: cannot access 'logs/.': Permission denied
ls: cannot access 'logs/diff_20161015.log': Permission denied
ls: cannot access 'logs/diff_20161010.log': Permission denied
ls: cannot access 'logs/fsum_openssl_conversion.log': Permission denied
ls: cannot access 'logs/diff_20160611.log': Permission denied
ls: cannot access 'logs/diff_20161231.log': Permission denied
ls: cannot access 'logs/diff_20161101.log': Permission denied
ls: cannot access 'logs/diff_20161112.log': Permission denied
ls: cannot access 'logs/AVSCAN-20160324-113755-5CAA2791.LOG': Permission denied
ls: cannot access 'logs/..': Permission denied
total 0
d????????? ? ? ? ? ? .
d????????? ? ? ? ? ? ..
-????????? ? ? ? ? ? AVSCAN-20160225-214734-AB9989CA.LOG
-????????? ? ? ? ? ? AVSCAN-20160324-113755-5CAA2791.LOG
-????????? ? ? ? ? ? diff_20160611.log
-????????? ? ? ? ? ? diff_20161010.log
-????????? ? ? ? ? ? diff_20161013.log
-????????? ? ? ? ? ? diff_20161015.log
-????????? ? ? ? ? ? diff_20161025.log
-????????? ? ? ? ? ? diff_20161101.log
-????????? ? ? ? ? ? diff_20161112.log
-????????? ? ? ? ? ? diff_20161231.log
-????????? ? ? ? ? ? diff_dir.log
-????????? ? ? ? ? ? fsum_openssl_conversion.log
When I view the groups I am part of:
id jimjamz
the result is:
uid=1000(jimjamz) gid=1000(jimjamz) groups=1000(jimjamz),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),100(users),108(netdev)
To confirm that the `users` group on the disk has the same GID as the `users` group on my laptop, I changed the group's GID then rebooted:
sudo groupmod -g 1004 users
and after reboot, I checked the directory again to see the gid value for the `users` group on the disk is also '100'. It shows '100' instead of 'users' because it is a group not recognised.
drwxrwxr-- 2 root 100 4096 May 18 02:17 logs
So I changed the GID back to 100. One can see that the gid is recognised once again as 'users'.
drwxrwxr-- 2 root users 4096 May 18 02:17 logs
So I am a member of the same `users` group with the same GID as on the disk, and have sufficient permissions to read and write to the directory, but am still not able to access it.
The only ways I know to make the directory viewable to me on my laptop, is to either loosen the permissions on the directory:
sudo chmod 775 -R /media/jimjamz/ARCHIVE1/logs/
But I shouldn't need to do that as the current permissions (774) should be sufficient. However, increasing to 775 does make the directory accessible:
jimjamz@bunsen-mac:/media/jimjamz/ARCHIVE1$ ls -la logs/
total 504
drwxrwxr-x 2 root users 4096 May 18 02:17 .
drwxrwxr-- 17 jimjamz users 4096 Aug 1 05:19 ..
-rwxrwxr-x 1 root users 93764 Feb 26 2016 AVSCAN-20160225-214734-AB9989CA.LOG
-rwxrwxr-x 1 root users 80226 Mar 25 2016 AVSCAN-20160324-113755-5CAA2791.LOG
-rwxrwxr-x 1 root users 4359 Jul 12 2016 diff_20160611.log
-rwxrwxr-x 1 root users 890 May 28 2017 diff_20161010.log
-rwxrwxr-x 1 root users 45911 Oct 14 2016 diff_20161013.log
-rwxrwxr-x 1 root users 46636 Oct 16 2016 diff_20161015.log
-rwxrwxr-x 1 root users 22300 May 28 2017 diff_20161025.log
-rwxrwxr-x 1 root users 37032 Nov 1 2016 diff_20161101.log
-rwxrwxr-x 1 root users 45926 Nov 12 2016 diff_20161112.log
-rwxrwxr-x 1 root users 43374 Dec 31 2016 diff_20161231.log
-rwxrwxr-x 1 root users 54553 May 18 02:17 diff_dir.log
-rwxrwxr-x 1 root users 1551 May 28 2017 fsum_openssl_conversion.log
Reducing back to 774 makes the directory inaccessible once again. Why? I don't understand why the extra execute permissions change the accessibility.
The other way is to change the ownership to me:
sudo chown jimjamz -R /media/jimjamz/ARCHIVE1/logs/
I won't and shouldn't have to do that either, just to be able to view the files.
Last edited by jimjamz (2018-08-24 11:46:53)
Offline
In order to access directories, the mode MUST have the executable bit set, that is 775 is the correct mode for the directory while 774 is just wrong (otherwise, the mode would be 664 at most).
For accessing files, the octal mode is '6', that is 664 for rwrwr.
When changing group affiliation, you need to log in/log out in general for the change to become active for your user (or log in using another session).
Offline
In order to access directories, the mode MUST have the executable bit set
...so you might check the permissions on the directory /media/ARCHIVE1/logs
Last edited by johnraff (2018-08-24 00:24:03)
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline
But the executable permission is set for both owner and group, which is what my user on the Bunsenlabs laptop is a member of:
id jimjamz
response:
uid=1000(jimjamz) gid=1000(jimjamz) groups=1000(jimjamz),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),100(users),108(netdev)
The permissions, `drwxrwxr--` would indicate that the directory/file is executable for both owner and group.
Last edited by jimjamz (2018-08-24 11:35:21)
Offline
OK, this is strange. I haven't changed anything, except shutting down and powering the laptop back on with the disk connected. Now, the files are accessible.
I logged out/in and rebooted many times whilst testing this to see the changes reflected, but it always said not permitted.
So here is how the directory currently looks:
jimjamz@bunsen-mac:~$ ls -la /media/jimjamz/ARCHIVE1/logs/
total 504
drwxrwxr-- 2 root users 4096 May 18 02:17 .
drwxrwxr-- 17 jimjamz users 4096 Aug 1 05:19 ..
-rwxrwxr-- 1 root users 93764 Feb 26 2016 AVSCAN-20160225-214734-AB9989CA.LOG
-rwxrwxr-- 1 root users 80226 Mar 25 2016 AVSCAN-20160324-113755-5CAA2791.LOG
-rwxrwxr-- 1 root users 4359 Jul 12 2016 diff_20160611.log
-rwxrwxr-- 1 root users 890 May 28 2017 diff_20161010.log
-rwxrwxr-- 1 root users 45911 Oct 14 2016 diff_20161013.log
-rwxrwxr-- 1 root users 46636 Oct 16 2016 diff_20161015.log
-rwxrwxr-- 1 root users 22300 May 28 2017 diff_20161025.log
-rwxrwxr-- 1 root users 37032 Nov 1 2016 diff_20161101.log
-rwxrwxr-- 1 root users 45926 Nov 12 2016 diff_20161112.log
-rwxrwxr-- 1 root users 43374 Dec 31 2016 diff_20161231.log
-rwxrwxr-- 1 root users 54553 May 18 02:17 diff_dir.log
-rwxrwxr-- 1 root users 1551 May 28 2017 fsum_openssl_conversion.log
As you can see, I'm logged in as myself (not root), and the permissions are still currently 774. I have full read/write access, so it must have now registered that the users group on the disk is the same users group that I am a member of.
Offline
(BTW my question was about the permissions set on the directory /media/ARCHIVE1/logs itself, not its contents. ie 'ls -l /media/ARCHIVE1' and look at the logs entry. But it's fixed now anyway.)
...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )
Offline