LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Permissions Permissions Permissions! (https://www.linuxquestions.org/questions/linux-newbie-8/permissions-permissions-permissions-4175549294/)

makem 07-29-2015 03:07 PM

Permissions Permissions Permissions!
 
Hi,

I have a directory which I am unable to change the permissions, owner, goup, anything!

Code:

pi@OpenVPN-Server /media $ ls -la
total 20
drwxr-xr-x  5 root root 4096 Jul 27 18:42 .
drwxr-xr-x 22 root root 4096 Jul 26 19:04 ..
drwxrwxrwx  1 root root 4096 Jul 27 23:24 128gb
drwxrwxrwx  2 pi  pi  4096 Jul 21 13:48 13d368bf-6dbf-4751-8ba1-88bed06bef77
drwxrwxr-x  4 pi  pi  4096 Jul 27 00:34 pi2Data
pi@OpenVPN-Server /media $

pi@OpenVPN-Server /media $ sudo chmod 775 -R 128gb
pi@OpenVPN-Server /media $ ls -la
total 20
drwxr-xr-x  5 root root 4096 Jul 27 18:42 .
drwxr-xr-x 22 root root 4096 Jul 26 19:04 ..
drwxrwxrwx  1 root root 4096 Jul 27 23:24 128gb
drwxrwxrwx  2 pi  pi  4096 Jul 21 13:48 13d368bf-6dbf-4751-8ba1-88bed06bef77
drwxrwxr-x  4 pi  pi  4096 Jul 27 00:34 pi2Data
pi@OpenVPN-Server /media $

pi@OpenVPN-Server /media $ sudo chown pi:pi 128gb
pi@OpenVPN-Server /media $ ls -la
total 20
drwxr-xr-x  5 root root 4096 Jul 27 18:42 .
drwxr-xr-x 22 root root 4096 Jul 26 19:04 ..
drwxrwxrwx  1 root root 4096 Jul 27 23:24 128gb
drwxrwxrwx  2 pi  pi  4096 Jul 21 13:48 13d368bf-6dbf-4751-8ba1-88bed06bef77
drwxrwxr-x  4 pi  pi  4096 Jul 27 00:34 pi2Data
pi@OpenVPN-Server /media $

Assistance?

[edit] Forgot to mention the diretory is a NTFS formatted USB stick attached to a Raspberry Pi2 running Raspbian if that makes a difference.

suicidaleggroll 07-29-2015 03:23 PM

What's the output of "mount"?

astrogeek 07-29-2015 03:23 PM

Quote:

Originally Posted by makem (Post 5397988)
Code:

drwxrwxrwx  1 root root 4096 Jul 27 23:24 128gb

The "1" is suspicious - all directories on a *nix filesystem will show at least 2 links - itself and "." inside itself.

What filesystem type is this? What filesystem and perms is the media/ parent directory?

*** UPDATED

I see you updated while I was typ-o-ing... NTFS makes the difference.

As suicidaleggroll asked, what does mount say?

makem 07-29-2015 04:00 PM

Quote:

Originally Posted by suicidaleggroll (Post 5398000)
What's the output of "mount"?

Code:

pi@OpenVPN-Server / $ mount
/dev/root on / type ext4 (rw,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=372880k,nr_inodes=93220,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=75436k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=150860k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
/dev/sdb1 on /media/pi2Data type ext4 (rw,relatime,data=ordered)
/dev/sdc1 on /media/128gb type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
/dev/mmcblk0p2 on /media/13d368bf-6dbf-4751-8ba1-88bed06bef77 type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks)
pi@OpenVPN-Server / $


makem 07-29-2015 04:02 PM

Quote:

Originally Posted by astrogeek (Post 5398001)
The "1" is suspicious - all directories on a *nix filesystem will show at least 2 links - itself and "." inside itself.

What filesystem type is this? What filesystem and perms is the media/ parent directory?

*** UPDATED

I see you updated while I was typ-o-ing... NTFS makes the difference.

As suicidaleggroll asked, what does mount say?

Yes, I also saw the '1' and knew it was unusual.

Code:

pi@OpenVPN-Server / $ ls -la
total 96
drwxr-xr-x  22 root root  4096 Jul 26 19:04 .
drwxr-xr-x  22 root root  4096 Jul 26 19:04 ..
drwxr-xr-x  2 root root  4096 Jul 27 16:15 bin
drwxr-xr-x  4 root root 16384 Jan  1  1970 boot
drwxr-xr-x  13 root root  3360 Jul 27 18:42 dev
drwxr-xr-x 107 root root  4096 Jul 27 17:21 etc
drwxr-xr-x  3 root root  4096 May  6 23:20 home
drwxr-xr-x  14 root root  4096 May  7 00:15 lib
drwx------  2 root root 16384 May  6 23:10 lost+found
drwxr-xr-x  5 root root  4096 Jul 27 18:42 media
drwxr-xr-x  2 root root  4096 Jul 21 00:27 mnt
drwxr-xr-x  6 root root  4096 May  7 00:24 opt
dr-xr-xr-x 137 root root    0 Jan  1  1970 proc
drwx------  7 root root  4096 Jul 20 16:17 root
drwxr-xr-x  20 root root  780 Jul 27 18:42 run
drwxr-xr-x  2 root root  4096 Jul 27 16:15 sbin
drwxr-xr-x  2 root root  4096 Jun 20  2012 selinux
drwxr-xr-x  2 root root  4096 May  6 23:12 srv
dr-xr-xr-x  11 root root    0 Jul 29 20:36 sys
drwxrwxrwt  5 root root  4096 Jul 29 21:17 tmp
drwxr-xr-x  10 root root  4096 May  6 23:12 usr
drwxr-xr-x  12 root root  4096 Jun 29 22:58 var
pi@OpenVPN-Server / $

'media' is on another USB stick which has the Raspbian filesystem on it, formatted ext4. The SD card now only has the boot files and an empty filesystem directory which I must stop mounting at some time.

suicidaleggroll 07-29-2015 04:21 PM

Quote:

Originally Posted by makem (Post 5398021)
Code:

pi@OpenVPN-Server / $ mount
/dev/sdc1 on /media/128gb type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)


Looks like you're forcing the user:group to root in the mount, probably why you can't chown it. I'm not sure about the permissions, but it may have something to do with it being ntfs. I don't have a lot of experience with ntfs support on Linux.

makem 07-29-2015 04:35 PM

Quote:

Originally Posted by suicidaleggroll (Post 5398030)
Looks like you're forcing the user:group to root in the mount, probably why you can't chown it. I'm not sure about the permissions, but it may have something to do with it being ntfs. I don't have a lot of experience with ntfs support on Linux.

Yes, something is certainly wrong there because:

Code:

pi@OpenVPN-Server / $ sudo nano /etc/fstab

proc            /proc          proc    defaults          0      0
/dev/mmcblk0p1  /boot          vfat    defaults          0      2
#/dev/mmcblk0p2  /              ext4    defaults,noatime  0      1
/dev/disk/by-uuid/6757d089-fec5-4ddd-89bd-8c5a0b56cd0c  / ext4 defaults,noatime$
# a swapfile is not a swap partition, so no using swapon|off from here on, use $

#tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0

#tmpfs /var/tmp tmpfs defaults,noatime,nosuid,size=30m 0 0

#tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=100m 0 0

#tmpfs /var/run tmpfs defaults,noatime,nosuid,mode=0755,size=2m 0 0

#ln -s /media/pi2Data  /media/pi2Data  autoddefaults 0 2

#/dev/sdb1 /media/pi2Data auto noatime 0 0

UUID=81a7719a-9e86-45a9-bf71-947f67562f49 /media/pi2Data auto defaults 1 2

UUID=E2EC725DEC722C43 /media/128gb ntfs-3g defaults 1 2


makem 07-29-2015 05:40 PM

Tried this fstab:


Code:

proc            /proc          proc    defaults          0      0
/dev/mmcblk0p1  /boot          vfat    defaults          0      2
#/dev/mmcblk0p2  /              ext4    defaults,noatime  0      1
/dev/disk/by-uuid/6757d089-fec5-4ddd-89bd-8c5a0b56cd0c  / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, so no using swapon|off from here on, use  dphys-swapfile swap[on|off$


UUID=81a7719a-9e86-45a9-bf71-947f67562f49 /media/pi2Data auto defaults 1 2

#UUID=E2EC725DEC722C43 /media/128gb ntfs-3g defaults 1 2
UUID=E2EC725DEC722C43 /media/128gb ntfs-3g defaults,auto,umask=000,users,rw 0 0

Check it works:

Code:

pi@OpenVPN-Server ~ $ sudo mount -a
pi@OpenVPN-Server ~ $ sudo mount
/dev/root on / type ext4 (rw,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=372880k,nr_inodes=93220,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=75436k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=150860k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
/dev/sdb1 on /media/pi2Data type ext4 (rw,relatime,data=ordered)
/dev/sdc1 on /media/128gb type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
/dev/mmcblk0p2 on /media/13d368bf-6dbf-4751-8ba1-88bed06bef77 type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks)
pi@OpenVPN-Server ~ $

No change:

Code:

/dev/sdc1 on /media/128gb type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
Also this fstab:


Code:

proc            /proc          proc    defaults          0      0
/dev/mmcblk0p1  /boot          vfat    defaults          0      2
#/dev/mmcblk0p2  /              ext4    defaults,noatime  0      1
/dev/disk/by-uuid/6757d089-fec5-4ddd-89bd-8c5a0b56cd0c  / ext4 defaults,noatime 0 1
# a swapfile is not a swap partition, so no using swapon|off from here on, use  dphys-swapfile swap[on|off]  for that


UUID=81a7719a-9e86-45a9-bf71-947f67562f49 /media/pi2Data auto defaults 1 2

#UUID=E2EC725DEC722C43 /media/128gb ntfs-3g defaults 1 2
#UUID=E2EC725DEC722C43 /media/128gb ntfs-3g defaults,auto,umask=000,users,rw 0 0
UUID=E2EC725DEC722C43 /media/128gb ntfs-3g uid=1000,gid=1000,umask=007 0 0

Check it works:
Code:

pi@OpenVPN-Server ~ $ sudo mount -a
pi@OpenVPN-Server ~ $ sudo mount
/dev/root on / type ext4 (rw,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=372880k,nr_inodes=93220,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=75436k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=150860k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
/dev/sdb1 on /media/pi2Data type ext4 (rw,relatime,data=ordered)
/dev/sdc1 on /media/128gb type fuseblk (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,blksize=4096)
/dev/mmcblk0p2 on /media/13d368bf-6dbf-4751-8ba1-88bed06bef77 type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks)
pi@OpenVPN-Server ~ $

Same result - still have no control over permission etc. maybe I should be looking at Windows 8.1 permissions.

The aim of this exercise is to access the Pi data remotely via a VPN server on my router.

suicidaleggroll 07-29-2015 05:58 PM

It may have to do with the ntfs driver on the Pi. Is there a reason you need the drive formatted as ntfs? Unless you absolutely need ntfs, you'll be much better off with a native Linux filesystem.

SpudMan13 07-29-2015 06:13 PM

What happens if you create another mount point (e.g. /mnt2), unmount the memory stick from /media/128GB, and then mount it on /mnt2 with the same mounting parameters?

makem 07-29-2015 06:22 PM

It seems that if the drive is NTFS chown and chmod will not work and are in fact not needed to access the data as pi even though all are root:root.

I think I must have made an error in setting this up and thought I needed to change the owner etc. to correct the error. I did not.

Thanks for the help and suggestions, they were informative.

I will mark this as solved. (If I can see how lol)

makem 07-29-2015 06:32 PM

Quote:

Originally Posted by suicidaleggroll (Post 5398065)
It may have to do with the ntfs driver on the Pi. Is there a reason you need the drive formatted as ntfs? Unless you absolutely need ntfs, you'll be much better off with a native Linux filesystem.

I use the Pi2 among other things, for watching Chinese streamed movies from the internet and movie files which my smart tv cannot show subs. Omxplayer can do both with settings from kweb.

I obtain quite a few movies via Windows and as some are 10gb in size I find it easier and much quicker to just move the USB stick to a Windows machine.

I agree a native Linux system would be far better and with the advent of Windows 10 I am in the process of changing all machines over to Linux - just a few bits of software I need first (mainly finance related). I have a dual boot Windows 7 and Ubuntu as a tester.

makem 07-29-2015 06:34 PM

Quote:

Originally Posted by SpudMan13 (Post 5398071)
What happens if you create another mount point (e.g. /mnt2), unmount the memory stick from /media/128GB, and then mount it on /mnt2 with the same mounting parameters?

I will try that in the morning thanks.

makem 07-30-2015 11:54 AM

Quote:

Originally Posted by SpudMan13 (Post 5398071)
What happens if you create another mount point (e.g. /mnt2), unmount the memory stick from /media/128GB, and then mount it on /mnt2 with the same mounting parameters?

Here we go:

Code:

pi@OpenVPN-Server ~ $ sudo mkdir /media/mnt2
pi@OpenVPN-Server ~ $ sudo umount /media/128gb
pi@OpenVPN-Server ~ $ sudo nano /etc/fstab
pi@OpenVPN-Server ~ $ sudo nano /etc/fstab
pi@OpenVPN-Server ~ $ sudo mount -a
pi@OpenVPN-Server ~ $ sudo mount
/dev/root on / type ext4 (rw,noatime,data=ordered)
devtmpfs on /dev type devtmpfs (rw,relatime,size=372880k,nr_inodes=93220,mode=755)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=75436k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=150860k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
/dev/mmcblk0p1 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
/dev/sdb1 on /media/pi2Data type ext4 (rw,noatime,data=ordered)
/dev/mmcblk0p2 on /media/13d368bf-6dbf-4751-8ba1-88bed06bef77 type ext4 (rw,nosuid,nodev,relatime,data=ordered,uhelper=udisks)
/dev/sdc1 on /media/mnt2 type fuseblk (rw,nosuid,nodev,noatime,user_id=0,group_id=0,allow_other,blksize=4096)

The fstab was:

Code:

proc            /proc          proc    defaults          0      0
/dev/mmcblk0p1  /boot          vfat    defaults          0      2
#/dev/mmcblk0p2  /              ext4    defaults,noatime  0      1
/dev/disk/by-uuid/6757d089-fec5-4ddd-89bd-8c5a0b56cd0c  / ext4 defaults,noatime$
# a swapfile is not a swap partition, so no using swapon|off from here on, use $


#UUID=81a7719a-9e86-45a9-bf71-947f67562f49 /media/pi2Data auto defaults 1 2
UUID=81a7719a-9e86-45a9-bf71-947f67562f49 /media/pi2Data auto noatime 0 0


#UUID=E2EC725DEC722C43 /media/128gb ntfs-3g defaults 1 2
#UUID=E2EC725DEC722C43 /media/128gb ntfs-3g defaults,auto,umask=000,users,rw 0 0

#UUID=E2EC725DEC722C43 /media/128gb ntfs-3g uid=1000,gid=1000,umask=007 0 0
##UUID=E2EC725DEC722C43 /media/128gb auto noatime 0 0
UUID=E2EC725DEC722C43 /media/mnt2 auto noatime 0 0

Any further thoughts?


All times are GMT -5. The time now is 07:45 PM.