[How-To] Giving Plugins Write Permissions to Your Data

Status
Not open for further replies.

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Ok, another total noob to FreeNas here. I've created a user Jails that belongs to the wheel group with a UID of 1003. Ideally, I'd like to use Solution 2 so that each jail has access to write to the dataset that's mounted to each jail.

Creating the user inside the jail seemed to work without a hitch. However, when I try to complete the second step in Solution 2 is where I think I'm getting hung up. Here's what the it looks like when I submit the commands. Maybe I missed a step or something?

Code:
root@sickbeard_1:/ # service sickbeard onestop                               
Stopping sickbeard.                                                          
Waiting for PIDS: 75222.                                                     
root@sickbeard_1:/ # chown -R Jails:WHEEL /var/db/sickbeard                  
chown: WHEEL: illegal group name                                             
root@sickbeard_1:/ # chown -R Jails:wheel /var/db/sickbeard                  
root@sickbeard_1:/ # sysrc 'PLUGIN_user=Jails'                               
PLUGIN_user: Jails -> Jails                                                  
root@sickbeard_1:/ # service sickbeard start                                 
Starting sickbeard.                                                          
Data directory: /var/db/sickbeard must be writable (write permissions). Exiting.
/usr/local/etc/rc.d/sickbeard: WARNING: failed to start sickbeard 


Now I can't even get sickbeard to restart!?
you didnt change the user sickbeard runs as.
in the 'sysrc' step replace "PLUGIN" with "sickbeard"

also in case you have an issue with the pidfile run this..
Code:
rm -r /var/run/sickbeard
 

sdgenxr

Contributor
Joined
Sep 4, 2014
Messages
131
Thanks for the help @Joshua Parker Ruehlig, Sickbeard is running once again. However, I cannot get it to have write access. Is there something I'm missing here?

Thanks!
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Thanks for the help @Joshua Parker Ruehlig, Sickbeard is running once again. However, I cannot get it to have write access. Is there something I'm missing here?

Thanks!
If sickbeard is running as your Jails user, and the UIDs match that of the owner yof that dataset you set outside the jail, sickbeard should have ownership of those files/folders as well.

Can you check what this gives you from inside the jail?
Code:
ls -l /path/to/mediafiles
 

sdgenxr

Contributor
Joined
Sep 4, 2014
Messages
131
If sickbeard is running as your Jails user, and the UIDs match that of the owner of that dataset you set outside the jail, sickbeard should have ownership of those files/folders as well.

Can you check what this gives you from inside the jail?
Code:
ls -l /path/to/mediafiles

How do I know if sickbeard is running as the Jails user? When I run "ls -l /media" it returns "total 0".

I really appreciate your help on this! It's been on my list of things to do for over a month now.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
How do I know if sickbeard is running as the Jails user? When I run "ls -l /media" it returns "total 0".

I really appreciate your help on this! It's been on my list of things to do for over a month now.
you could check using 'ps aux' but I'm pretty sure it is base on your earlier output.

you ran that command in the jail? I have a feeling you ran that in the host.
 

sdgenxr

Contributor
Joined
Sep 4, 2014
Messages
131
you could check using 'ps aux' but I'm pretty sure it is base on your earlier output.

you ran that command in the jail? I have a feeling you ran that in the host.
Yes, I ran it from the jails tab and selected the shell link at the bottom of the page.
Code:
root@sickbeard_1:/ # ls -l /media                                              
total 0  
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Yes, I ran it from the jails tab and selected the shell link at the bottom of the page.
Code:
root@sickbeard_1:/ # ls -l /media                                             
total 0  
Ok I'm a bit confused then cause tat folder is empty.

You need write acces to the /media folder, is that where you want sickbeard to organize files too, or where you want sabnzbd/trransmission to download files too? Is that a dataset mounted into the jail?
 

sdgenxr

Contributor
Joined
Sep 4, 2014
Messages
131
Yes, I would like sickbeard to have write access to the /media folder. I currently have "/mnt/Vol_1/Shares/TV Shows" as the storage dataset source and "/media" the destination configured for the jail. Eventually I would like to get transmission et al configured, but I'm working on sickbeard first to figure out how.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Yes, I would like sickbeard to have write access to the /media folder. I currently have "/mnt/Vol_1/Shares/TV Shows" as the storage dataset source and "/media" the destination configured for the jail. Eventually I would like to get transmission et al configured, but I'm working on sickbeard first to figure out how.
Ok, then I need to actually see the permissions on that folder
Code:
ls -l / | grep media
 
Last edited:

sdgenxr

Contributor
Joined
Sep 4, 2014
Messages
131
When I run that code, nothing is returned. It just goes back to the command prompt "root@sickbeard_1:/ #"
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
When I run that code, nothing is returned. It just goes back to the command prompt "root@sickbeard_1:/ #"
My mistake, I fixed the code in the post. please try again.
 

sdgenxr

Contributor
Joined
Sep 4, 2014
Messages
131
Code:
root@sickbeard_1:/ # ls -l / | grep media                                      
drwxrwxr-x+ 40 1002  wheel    43 Feb  9 15:22 media                            
drwxr-xr-x   2 root  wheel     2 Jan 12 14:54 mediaTV_Shows 
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Code:
root@sickbeard_1:/ # ls -l / | grep media                                     
drwxrwxr-x+ 40 1002  wheel    43 Feb  9 15:22 media                           
drwxr-xr-x   2 root  wheel     2 Jan 12 14:54 mediaTV_Shows 
You jail didn't match UID 1002 to the user "Jails". When you created that user in the jail did you specify the UID like in the instructions?
 

sdgenxr

Contributor
Joined
Sep 4, 2014
Messages
131
I noticed that as well. Not sure how it got assigned the UID of 1002. However, when I edit /etc/group it shows that user Jails has the UID of 1003.
Jails:*:1003:
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I noticed that as well. Not sure how it got assigned the UID of 1002. However, when I edit /etc/group it shows that user Jails has the UID of 1003.
Jails:*:1003:
Looks like you found the issue. I think there's a way to change a users UID. You'd also want to run the 'chown' step again.
 

sdgenxr

Contributor
Joined
Sep 4, 2014
Messages
131
OK, back at this after a fresh install of 9.3. Here's the code I ran and what I get in return for review.
Code:
root@sickbeard_1:/ # pw useradd -n Jails -u 1003 -d /nonexistent -s /usr/sbin/no
login                                                                          
pw: login name `Jails' already exists                                          
root@sickbeard_1:/ # service sickbeard onestop                                 
Stopping sickbeard.                                                            
Waiting for PIDS: 24612.                                                       
root@sickbeard_1:/ # chown -R Jails:wheel /var/db/sickbeard                    
root@sickbeard_1:/ # sysrc 'sickbeard_user=Jails'                              
sickbeard_user: Jails -> Jails                                                 
root@sickbeard_1:/ # service sickbeard start                                   
Starting sickbeard.                                                            
root@sickbeard_1:/ # ls -l / | grep media                                      
drwxr-xr-x   3 root  wheel     3 Feb 21 20:52 media                            
root@sickbeard_1:/ #   

At this time, I still cannot add a show in sickbeard as it returns:
2015-02-22 11:03:55 CP Server Thread-4 :: Unable to create the folder /media/TV_Shows/Better Call Saul, can't add the show
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
OK, back at this after a fresh install of 9.3. Here's the code I ran and what I get in return for review.
Code:
root@sickbeard_1:/ # pw useradd -n Jails -u 1003 -d /nonexistent -s /usr/sbin/no
login                                                                          
pw: login name `Jails' already exists                                          
root@sickbeard_1:/ # service sickbeard onestop                                 
Stopping sickbeard.                                                            
Waiting for PIDS: 24612.                                                       
root@sickbeard_1:/ # chown -R Jails:wheel /var/db/sickbeard                    
root@sickbeard_1:/ # sysrc 'sickbeard_user=Jails'                              
sickbeard_user: Jails -> Jails                                                 
root@sickbeard_1:/ # service sickbeard start                                   
Starting sickbeard.                                                            
root@sickbeard_1:/ # ls -l / | grep media                                      
drwxr-xr-x   3 root  wheel     3 Feb 21 20:52 media                            
root@sickbeard_1:/ #   

At this time, I still cannot add a show in sickbeard as it returns:
can you show the output of 'ls -l /media'
 

sdgenxr

Contributor
Joined
Sep 4, 2014
Messages
131
Code:
root@sickbeard_1:/ # ls -l /media                                              
total 12                                                                       
drwxrwxr-x+ 24 1002  wheel  27 Feb 21 21:05 TV_Shows 
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Code:
root@sickbeard_1:/ # ls -l /media                                              
total 12                                                                       
drwxrwxr-x+ 24 1002  wheel  27 Feb 21 21:05 TV_Shows 
well just like earlier your jail isn't associating UID 1002 with your 'Jails' user. it has a different UID, in your earlier attempt a few posts up you use a different UID (1003)
 

sdgenxr

Contributor
Joined
Sep 4, 2014
Messages
131
OK, my next question is why isn't the correct UID not being associated with the user Jails when created? Just like previously, when I edit /etc/group, it returns Jails:*:1003:.

Here's what I get when read the user information from chpass Jails:
Code:
#Changing user information for Jails.                                          
Login: Jails                                                                   
Password: *                                                                    
Uid [#]: 1003                                                                  
Gid [# or name]: 1003                                                          
Change [month day year]:                                                       
Expire [month day year]:                                                       
Class:                                                                         
Home directory: /nonexistent                                                   
Shell: /usr/sbin/nologin                                                       
Full Name: User &                                                              
Office Location:                                                               
Office Phone:                                                                  
Home Phone:                                                                    
Other information:   
 
Last edited:
Status
Not open for further replies.
Top