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

Status
Not open for further replies.

xmicks

Dabbler
Joined
Apr 28, 2016
Messages
33
When i changed user media to a new user with the same uid as the owner of my /Volume1/Media dataset. sabnzbd throws the warning:

Code:
"Cannot access Pid file: /var/run/sabnzbd/sabnzbd.pid"


when i had media as the user of the jail i didnt had this warning/error. Also i have problems starting and stopping sabnzbd, its quite different starting and stopping the plugin from the commandline or from the gui. for example: i stop the plugin from the commandline and when i then look in the gui. the plugin is still marked as "On".

this how ive configuered in the sabnzbd jail, (i combined option 2 and 3 of this tutorial)

Code:
pw useradd -n NewMedia -u 1002 -d /nonexistent -s /usr/sbin/nologin

pw groupmod media -m NewMedia

service sabnzbd onestop
chown -R NewMedia:media /var/db/sabnzbd
sysrc 'sabnzbd_user=NewMedia'
service sabnzbd start


later i tried giving the NewMedia user root permissions
Code:
pw usermod NewMedia -G media,wheel
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
When i changed user media to a new user with the same uid as the owner of my /Volume1/Media dataset. sabnzbd throws the warning:

Code:
"Cannot access Pid file: /var/run/sabnzbd/sabnzbd.pid"


when i had media as the user of the jail i didnt had this warning/error. Also i have problems starting and stopping sabnzbd, its quite different starting and stopping the plugin from the commandline or from the gui. for example: i stop the plugin from the commandline and when i then look in the gui. the plugin is still marked as "On".

this how ive configuered in the sabnzbd jail, (i combined option 2 and 3 of this tutorial)

Code:
pw useradd -n NewMedia -u 1002 -d /nonexistent -s /usr/sbin/nologin

pw groupmod media -m NewMedia

service sabnzbd onestop
chown -R NewMedia:media /var/db/sabnzbd
sysrc 'sabnzbd_user=NewMedia'
service sabnzbd start


later i tried giving the NewMedia user root permissions
Code:
pw usermod NewMedia -G media,wheel
You also need to change the owner of /var/run/sabnzbd
 

xmicks

Dabbler
Joined
Apr 28, 2016
Messages
33
didnt i do that with this command
Code:
chown -R NewMedia:media /var/db/sabnzbd


i think it is the owner
Code:
root@sabnzbd_1:/ # ls -l /var/db/sabnzbd/
total 19
drwxr-xr-x 4 NewMedia media 4 Apr 30 21:30 Downloads
drwxr-xr-x 2 NewMedia media 8 May 1 01:43 admin
drwxr-xr-x 2 NewMedia media 4 Apr 29 19:47 logs
-rw------- 1 NewMedia media 6284 May 1 01:43 sabnzbd.ini
-rw------- 1 NewMedia media 6284 May 1 01:43 sabnzbd.ini.bak
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
didnt i do that with this command
Code:
chown -R NewMedia:media /var/db/sabnzbd


i think it is the owner
Code:
root@sabnzbd_1:/ # ls -l /var/db/sabnzbd/
total 19
drwxr-xr-x 4 NewMedia media 4 Apr 30 21:30 Downloads
drwxr-xr-x 2 NewMedia media 8 May 1 01:43 admin
drwxr-xr-x 2 NewMedia media 4 Apr 29 19:47 logs
-rw------- 1 NewMedia media 6284 May 1 01:43 sabnzbd.ini
-rw------- 1 NewMedia media 6284 May 1 01:43 sabnzbd.ini.bak
Nope you didn't. I left out that step cause it isn't necessary for all the plugins.
 

xmicks

Dabbler
Joined
Apr 28, 2016
Messages
33
o wait i didnt read your post right:). i changed owners and i dont have the warning message. Big thanks for the help and the tutorial!!
 

xmicks

Dabbler
Joined
Apr 28, 2016
Messages
33

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Do you know for which plugins its necessary?
any of them that have a pid file. check their init file in /usr/local/etc/rc.d
 

saintryan

Dabbler
Joined
Apr 10, 2016
Messages
10
I am having an issue with transmission. I have created a user called media and a group called media (816). My datasets are setup with the same user aswell.

However when i try and change the transmission jail user:group i come up against a number of issues eg:

service PLUGIN onestop
PLUGIN does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d)

The issue then is that my transmission cannot download as I do no have permission to the dataset folder.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I am having an issue with transmission. I have created a user called media and a group called media (816). My datasets are setup with the same user aswell.

However when i try and change the transmission jail user:group i come up against a number of issues eg:

service PLUGIN onestop
PLUGIN does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d)

The issue then is that my transmission cannot download as I do no have permission to the dataset folder.
you aren't replacing PLUGIN with the plugin name.
 

xmicks

Dabbler
Joined
Apr 28, 2016
Messages
33
any of them that have a pid file. check their init file in /usr/local/etc/rc.d
now i'm configuring emby
,when i try to open this file with 'ee /usr/local/etc/rc.d' i get a empty file, and the message that that path is a directory.

i did a similar configuration as i discribed above.
this how ive configuered in the sabnzbd jail, (i combined option 2 and 3 of this tutorial)
Code:
pw useradd -n NewMedia -u 1002 -d /nonexistent -s /usr/sbin/nologin

pw groupmod media -m NewMedia

service sabnzbd onestop
chown -R NewMedia:media /var/db/sabnzbd
sysrc 'sabnzbd_user=NewMedia'
service sabnzbd start

later i tried giving the NewMedia user root permissions
Code:
pw usermod NewMedia -G media,wheel

but when i try to start or stop the service i get a permissions error

Code:
root@emby_2:/ # service emby-server stop
/etc/rc.conf: emby-server_user=NewMedia: not found
/etc/rc.conf: emby-server_user=NewMedia: not found
emby_server not running? (check /var/run/emby-server.pid).
root@emby_2:/ # service emby-server start
/etc/rc.conf: emby-server_user=NewMedia: not found
/etc/rc.conf: emby-server_user=NewMedia: not found
Starting emby_server.
daemon: pidfile ``/var/run/emby-server.pid'': Permission denied
/usr/local/etc/rc.d/emby-server: WARNING: failed to start emby_server
root@emby_2:/ #


i did a chown of /'var/run' and a chown of '/var/run/emby-server.pid' but that doenst solve the problem

note: when i did 'sysrc' i get this
Code:
root@emby_2:/ # sysrc 'emby-server_user=NewMedia'
emby-server_user: server_user -> server_user


what did i do wrong?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
the init file is IN the /usr/local/etc/rc.d directory, did you read the error you posted?

the dashes should be replaced with underscores in the rc.conf
so settings for emby-server should be emby_server
 

xmicks

Dabbler
Joined
Apr 28, 2016
Messages
33
okay got it working now. the 'chown' command worked now when i used 'emby_server_user'. my previous attempts to solve this messed up the jail so i created a new jail and now everything is working.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
okay got it working now. the 'chown' command worked now when i used 'emby_server_user'. my previous attempts to solve this messed up the jail so i created a new jail and now everything is working.
sweet
 

BBarker

Contributor
Joined
Aug 7, 2015
Messages
120
I have tried a few things in this excellent thread to try and get Sabnzbd to work. After install last night, it ran and I was able to configure it to work and downloaded some content just to see. This morning, the service was off and would not restart in the FreeNAS webGUI yet I could access it using my laptop using MS Edge and it is still running. I did download the latest update for FreeNAS and was able to turn the service on but when I tried to move the files it downloaded, I got a permissions error:
Untitled.jpg

Here is my jails:
Untitled2.jpg

and this:
Untitled1.jpg

I know the resolution is in this thread, but I have not been able to source it out. Help please?
 

Attachments

  • upload_2016-5-24_9-17-45.png
    upload_2016-5-24_9-17-45.png
    108.1 KB · Views: 404

BBarker

Contributor
Joined
Aug 7, 2015
Messages
120
I feel like I may be chasing my tail a bit here. Sabnzbd is working but I can not get the plugin to turn on?

In the webGUI for Sabnzbd it has an error message: "Cannot access PID file /var/run/sabnzbd/sabnzbd.pid"

I thought I had my ownership setup properly:

Untitled3.jpg

When I try to start it using the jail webGUI it shows this error:

[24/May/2016:20:38:50] HTTP
Traceback (most recent call last):
File "/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/cherrypy/_cprequest.py", line 670, in respond
File "/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/cherrypy/lib/encoding.py", line 217, in __call__
File "/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/cherrypy/_cpdispatch.py", line 61, in __call__
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/site-packages/sabnzbd/interface.py", line 741, in index
filter=FILTER, searchList=[info], compilerSettings=DIRECTIVES)
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/site-packages/Cheetah/Template.py", line 1259, in __init__
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/site-packages/Cheetah/Template.py", line 1546, in _compile
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/genericpath.py", line 54, in getmtime
return os.stat(filename).st_mtime
OSError: [Errno 2] No such file or directory: '/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/interfaces/Glitter/templates/queue.tmpl'
ERROR 24/05/2016 20:38 [24/May/2016:20:38:49] HTTP
Traceback (most recent call last):
File "/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/cherrypy/_cprequest.py", line 670, in respond
File "/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/cherrypy/lib/encoding.py", line 217, in __call__
File "/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/cherrypy/_cpdispatch.py", line 61, in __call__
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/site-packages/sabnzbd/interface.py", line 741, in index
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/site-packages/Cheetah/Template.py", line 1259, in __init__
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/site-packages/Cheetah/Template.py", line 1546, in _compile
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/genericpath.py", line 54, in getmtime
return os.stat(filename).st_mtime
OSError: [Errno 2] No such file or directory: '/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/interfaces/Glitter/templates/queue.tmpl'
 
Last edited:

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I feel like I may be chasing my tail a bit here. Sabnzbd is working but I can not get the plugin to turn on?

In the webGUI for Sabnzbd it has an error message: "Cannot access PID file /var/run/sabnzbd/sabnzbd.pid"

I thought I had my ownership setup properly:

View attachment 11892

When I try to start it using the jail webGUI it shows this error:

[24/May/2016:20:38:50] HTTP
Traceback (most recent call last):
File "/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/cherrypy/_cprequest.py", line 670, in respond
File "/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/cherrypy/lib/encoding.py", line 217, in __call__
File "/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/cherrypy/_cpdispatch.py", line 61, in __call__
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/site-packages/sabnzbd/interface.py", line 741, in index
filter=FILTER, searchList=[info], compilerSettings=DIRECTIVES)
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/site-packages/Cheetah/Template.py", line 1259, in __init__
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/site-packages/Cheetah/Template.py", line 1546, in _compile
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/genericpath.py", line 54, in getmtime
return os.stat(filename).st_mtime
OSError: [Errno 2] No such file or directory: '/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/interfaces/Glitter/templates/queue.tmpl'
ERROR 24/05/2016 20:38 [24/May/2016:20:38:49] HTTP
Traceback (most recent call last):
File "/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/cherrypy/_cprequest.py", line 670, in respond
File "/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/cherrypy/lib/encoding.py", line 217, in __call__
File "/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/cherrypy/_cpdispatch.py", line 61, in __call__
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/site-packages/sabnzbd/interface.py", line 741, in index
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/site-packages/Cheetah/Template.py", line 1259, in __init__
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/site-packages/Cheetah/Template.py", line 1546, in _compile
File "/usr/pbi/sabnzbd-amd64/lib/python2.7/genericpath.py", line 54, in getmtime
return os.stat(filename).st_mtime
OSError: [Errno 2] No such file or directory: '/usr/pbi/sabnzbd-amd64/share/sabnzbdplus/interfaces/Glitter/templates/queue.tmpl'
This isn't related to permissions, but somehow your sabnzbd application files got messed up.

I suggest you do the following...
* Upload a PBI from here, like the btsync one, to your sabnzbd jail http://download.freenas.org/plugins/9/x64/
* Delete your sabnzbd plugin
* Upload the sabnzbd v1.0.2 PBI from here http://download.freenas.org/plugins/9/x64/ to your sabnzbd jail
* Delete your btsync plugin
 

BBarker

Contributor
Joined
Aug 7, 2015
Messages
120
Interestingly enough, when I did the plugin switch as described above and then applied solution one, Sabnzbd is running and while the plugin initially turned on, after configuring Sabnzbd and restarting it for the changes to take effect, the plugin is now off and will not turn on in the FreeNAS webGUI.

I have been able to download content, it unpacks it and deletes the .rar files and I am able to move the files about and use them fine.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Interestingly enough, when I did the plugin switch as described above and then applied solution one, Sabnzbd is running and while the plugin initially turned on, after configuring Sabnzbd and restarting it for the changes to take effect, the plugin is now off and will not turn on in the FreeNAS webGUI.

I have been able to download content, it unpacks it and deletes the .rar files and I am able to move the files about and use them fine.
Can you try restarting the jail. maybe the freenas webui can make a fresh connection with the sabnzbd plugin's communication interface.
 

BBarker

Contributor
Joined
Aug 7, 2015
Messages
120
Can you try restarting the jail. maybe the freenas webui can make a fresh connection with the sabnzbd plugin's communication interface.

I was thinking to leave well enough alone but I did try this with the only result being that Sabnzbd is now stopped and I can not get it to restart, no change in the webGUI...it still won't turn the plugin on:

root@sabnzbd_1:/ # service sabnzbd onestart
Starting sabnzbd.
su: pam_start: system error
/usr/local/etc/rc.d/sabnzbd: WARNING: failed to start sabnzbd
root@sabnzbd_1:/ # service sabnzbd start
Starting sabnzbd.
su: pam_start: system error
/usr/local/etc/rc.d/sabnzbd: WARNING: failed to start sabnzbd
root@sabnzbd_1:/ #
 
Status
Not open for further replies.
Top