Why are permissions inside a jail different?

Ravefiend

Dabbler
Joined
Jun 1, 2011
Messages
37
I'm having a file/directory permission issue that I've not been able to figure out myself for the past two days.

Software: FreeNAS-11.3-RELEASE

Directory structure and permissions on the host OS:

Code:
root@storage:/mnt/tank # ls -l
total 157515
drwxr-xr-x   5 root       wheel              5 Feb 13  2017 .warden-files-cache
drwxr-xr-x  17 root       wheel             21 Feb 13  2017 .warden-template-standard-10.3-x64
-rw-r--r--   1 root       wheel      161072462 Feb  8 18:19 200208_files.lst
drwxr-xr-x   6 ravefiend  ravefiend          7 Dec 29 13:56 backup
drwxr-xr-x   9 root       wheel             12 Feb  8 17:19 iocage
drwxr-xr-x   9 root       wheel              9 Jan 11 10:46 jail_data
drwxrwxr-x   9 media      media              9 Jan 11 00:54 media
drwxr-xr-x   6 ravefiend  media             18 Jan 31 09:37 photos
drwxr-xr-x  14 ravefiend  ravefiend         25 Dec 30 09:26 ravefiend
drwxr-xr-x   2 root       wheel              2 Jan 31 10:47 temp

Code:
root@storage:/mnt/tank # ls -l media
total 100
drwxrwxr-x    8 media  media    8 Nov 12 08:17 incoming
drwxrwxr-x   23 media  media   23 Sep 29 12:29 live_music
drwxrwxr-x    2 media  media    2 Oct  6 14:54 movies
drwxrwxr-x    7 media  media    7 Sep 29 09:38 movies_x
drwxrwxr-x   10 media  media   13 Jan 31 11:24 music
drwxrwxr-x   12 media  media   15 Jan 31 11:24 music_tosort
drwxrwxr-x  100 media  media  100 Jan 17 00:27 tv


Issue is with the /mnt/tank/media directory and its subdirectories. Here, it clearly shows that ownership is set to be media:media so I'm expecting to see the same within my jails.

Code:
root@storage:/mnt/tank # iocage fstab -l plex
+-------+-----------------------------------------------------------------------------------------------------------+
| INDEX |                                                FSTAB ENTRY                                                |
+=======+===========================================================================================================+
| 0     | /mnt/tank/jail_data/plex        /mnt/tank/iocage/jails/plex/root/mnt/plex       nullfs  rw      0       0 |
+-------+-----------------------------------------------------------------------------------------------------------+
| 1     | /mnt/tank/photos        /mnt/tank/iocage/jails/plex/root/mnt/photos     nullfs  ro      0       0         |
+-------+-----------------------------------------------------------------------------------------------------------+
| 2     | /mnt/tank/media /mnt/tank/iocage/jails/plex/root/mnt/media      nullfs  ro      0       0                 |
+-------+-----------------------------------------------------------------------------------------------------------+


This shows 'media' directory is mounted inside the jail (read-only).

Code:
root@plex:/mnt # ls -l
total 66
drwxrwxr-x  9 media  media   9 Jan 11 00:54 media
drwxr-xr-x  6 1001   media  18 Jan 31 09:37 photos
drwxr-xr-x  4 media  media   4 Jan  6 23:02 plex

Code:
root@plex:/mnt # ls -l media
total 52
drwxrwxr-x   8 media  media   8 Nov 12 08:17 incoming
drwxrwxr-x  23 media  media  23 Sep 29 12:29 live_music
drwxr-xr-x   2 root   media   2 Oct  6 14:54 movies
drwxrwxr-x   7 media  media   7 Sep 29 09:38 movies_x
drwxr-xr-x   2 root   media   2 Oct  6 14:50 music
drwxr-xr-x   2 root   media   2 Oct  6 14:55 music_tosort
drwxr-xr-x   3 media  media   3 Feb  8 15:58 tv


There are two issues that I don't understand within this jail:
  1. Why do some folders (movies, music, ...) not show the same ownership media:media as on the host OS, outside the jail?
  2. The directory 'tv' within the jail does not have any files or directories that exist on the host OS. Any file that I create on the host OS in /mnt/tank/media/tv/. does not show up either within the jail under /mnt/media/tv/. How is that possible?
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
The jail is a completely separate virtual FreeBSD installation that does not know about the users you create in the NAS host system.
You need to create the user inside the jail with the numeric UID matching the one on the TrueNAS/FreeNAS host.
 
Top