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

Status
Not open for further replies.

chris pucknell

Explorer
Joined
Dec 9, 2013
Messages
51
I think that's sorted it! Cheers :)

I actually tried this a couple of times before I posted, as I saw you mention it to the sickbeard guy earlier in the thread... not sure what I was messing up there.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I think that's sorted it! Cheers :)

I actually tried this a couple of times before I posted, as I saw you mention it to the sickbeard guy earlier in the thread... not sure what I was messing up there.
glad you got it working. I should probably add cleaning the pidfile/folder to the instructions.
 

whatnissan

Dabbler
Joined
Feb 18, 2015
Messages
49
well this didnt work... wtf here is where im at... IM getting sick of this cause everyone is haveing the same issue and i have not see 1 solution that works for it
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
well this didnt work... wtf here is where im at... IM getting sick of this cause everyone is haveing the same issue and i have not see 1 solution that works for it
They all work if done properly. Which one are you trying?
 

whatnissan

Dabbler
Joined
Feb 18, 2015
Messages
49
Sorry i responded out of frustration.. Your guide actually helped me when i slowed down and took a break from it. I got transmission running under another user and now files downloaded i can delete and rename ect.. Now im waiting to see if couchpotato does its job and auto renames and moves it to the movies folder... Anyway to force this to text it? Or you just wait?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Sorry i responded out of frustration.. Your guide actually helped me when i slowed down and took a break from it. I got transmission running under another user and now files downloaded i can delete and rename ect.. Now im waiting to see if couchpotato does its job and auto renames and moves it to the movies folder... Anyway to force this to text it? Or you just wait?
lol, they were interesting.

you can go to couchpotato's wanted page and have it process a directory directly. otherwise it sounds like your having CP regular scan the download folder. the best way is to have a script run so post-processing is done immediately.
 

whatnissan

Dabbler
Joined
Feb 18, 2015
Messages
49
yea i just checked the logs for couchpotato and it looks like its having a hard time doing the rename and move... Ugh.. So now i have to figure that out more permissions issues.. Im just trying to do this one thing at a time lol
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
yea i just checked the logs for couchpotato and it looks like its having a hard time doing the rename and move... Ugh.. So now i have to figure that out more permissions issues.. Im just trying to do this one thing at a time lol
yup, CP runs as the media user.
one thing to make things easier is to have transmission write files with 777 permissions.
you can change this in the transmission configure menu, in the left panel, in the freenas webui.
 

whatnissan

Dabbler
Joined
Feb 18, 2015
Messages
49
I keep seeing this spammed though my log files.. Not sure im waitng to see if it will rename and move a file... no such luck so far


Code:
04-02 13:43:09ERROR[hpotato.core.plugins.base] Unable writing to file "/mnt/downloads/The Hunger Games Mockingjay Part 1 2014 US-BluRay 720p DTS x264-MgB [ETRG]/Box Cover,Poster/The Hunger Games Mockingjay Part 1 2014 Poster.downloading.ignore": Traceback (most recent call last):
  File "/usr/pbi/couchpotato-amd64/share/couchpotato/CouchPotatoServer/couchpotato/core/plugins/base.py", line 142, in createFile
    f = open(path, write_type)
IOError: [Errno 13] Permission denied: '/mnt/downloads/The Hunger Games Mockingjay Part 1 2014 US-BluRay 720p DTS x264-MgB [ETRG]/Box Cover,Poster/The Hunger Games Mockingjay Part 1 2014 Poster.downloading.ignore'
 

whatnissan

Dabbler
Joined
Feb 18, 2015
Messages
49
You talking about download permissions? I already had that set to 777.. Trust me im alot further with this than I was lmafo.. I just want couchpotato to do its job lol
 

whatnissan

Dabbler
Joined
Feb 18, 2015
Messages
49
Yea im seeing lots of errors on the log files for couchpotato. Its passing the torrents to transmission and they are doing what needs to be done but the whole clean up and rename part and move I have yet to see work. Can you instruct how to force this so i can test it please??

Code:
04-02 13:48:34ERROR[to.core.media._base.media] Failed deleting media: Traceback (most recent call last):
  File "/usr/pbi/couchpotato-amd64/share/couchpotato/CouchPotatoServer/couchpotato/core/media/_base/media/main.py", line 424, in delete
    media = db.get('id', media_id)
  File "/usr/pbi/couchpotato-amd64/share/couchpotato/CouchPotatoServer/libs/CodernityDB/database_super_thread_safe.py", line 43, in _inner
    res = f(*args, **kwargs)
  File "/usr/pbi/couchpotato-amd64/share/couchpotato/CouchPotatoServer/libs/CodernityDB/database.py", line 946, in get
    raise RecordDeleted("Deleted")
RecordDeleted: Deleted
 

whatnissan

Dabbler
Joined
Feb 18, 2015
Messages
49
Ok what did I do wrong ugh...... I killed it help

Code:
root@couchpotato_1:/ # pw useradd -n dave -u 1001 -d /nonexistent -s /usr/sbin/nologin
root@couchpotato_1:/ # service couchpotato onestop
Stopping couchpotato.
Waiting for PIDS: 76284.
root@couchpotato_1:/ # chown -R dave:1001 /var/db/couchpotato
root@couchpotato_1:/ # sysrc 'Plugin_user=dave'
Plugin_user:  -> dave
root@couchpotato_1:/ # service couchpotato start
Starting couchpotato.
Traceback (most recent call last):
  File "/usr/pbi/couchpotato-amd64/share/couchpotato/CouchPotatoServer/CouchPotato.py", line 131, in <module>
    l = Loader()
  File "/usr/pbi/couchpotato-amd64/share/couchpotato/CouchPotatoServer/CouchPotato.py", line 64, in __init__
    hdlr = handlers.RotatingFileHandler(os.path.join(self.log_dir, 'error.log'), 'a', 500000, 10)
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/handlers.py", line 117, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/handlers.py", line 64, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/__init__.py", line 911, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/__init__.py", line 936, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/var/db/couchpotato/logs/error.log'

Traceback (most recent call last):
  File "/usr/pbi/couchpotato-amd64/share/couchpotato/CouchPotatoServer/CouchPotato.py", line 131, in <module>
    l = Loader()
  File "/usr/pbi/couchpotato-amd64/share/couchpotato/CouchPotatoServer/CouchPotato.py", line 64, in __init__
    hdlr = handlers.RotatingFileHandler(os.path.join(self.log_dir, 'error.log'), 'a', 500000, 10)
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/handlers.py", line 117, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/handlers.py", line 64, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/__init__.py", line 911, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/__init__.py", line 936, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/var/db/couchpotato/logs/error.log'
/usr/local/etc/rc.d/couchpotato: WARNING: failed to start couchpotato
root@couchpotato_1:/ # 
 

whatnissan

Dabbler
Joined
Feb 18, 2015
Messages
49
I tried changing permissions of the file the error log that its denied permission too and it said its starting but then it doesnt.. And i have nothing to go off of now as to why...
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Ok what did I do wrong ugh...... I killed it help

Code:
root@couchpotato_1:/ # pw useradd -n dave -u 1001 -d /nonexistent -s /usr/sbin/nologin
root@couchpotato_1:/ # service couchpotato onestop
Stopping couchpotato.
Waiting for PIDS: 76284.
root@couchpotato_1:/ # chown -R dave:1001 /var/db/couchpotato
root@couchpotato_1:/ # sysrc 'Plugin_user=dave'
Plugin_user:  -> dave
root@couchpotato_1:/ # service couchpotato start
Starting couchpotato.
Traceback (most recent call last):
  File "/usr/pbi/couchpotato-amd64/share/couchpotato/CouchPotatoServer/CouchPotato.py", line 131, in <module>
    l = Loader()
  File "/usr/pbi/couchpotato-amd64/share/couchpotato/CouchPotatoServer/CouchPotato.py", line 64, in __init__
    hdlr = handlers.RotatingFileHandler(os.path.join(self.log_dir, 'error.log'), 'a', 500000, 10)
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/handlers.py", line 117, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/handlers.py", line 64, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/__init__.py", line 911, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/__init__.py", line 936, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/var/db/couchpotato/logs/error.log'

Traceback (most recent call last):
  File "/usr/pbi/couchpotato-amd64/share/couchpotato/CouchPotatoServer/CouchPotato.py", line 131, in <module>
    l = Loader()
  File "/usr/pbi/couchpotato-amd64/share/couchpotato/CouchPotatoServer/CouchPotato.py", line 64, in __init__
    hdlr = handlers.RotatingFileHandler(os.path.join(self.log_dir, 'error.log'), 'a', 500000, 10)
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/handlers.py", line 117, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/handlers.py", line 64, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/__init__.py", line 911, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/pbi/couchpotato-amd64/lib/python2.7/logging/__init__.py", line 936, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/var/db/couchpotato/logs/error.log'
/usr/local/etc/rc.d/couchpotato: WARNING: failed to start couchpotato
root@couchpotato_1:/ # 
PLUGIN_user isn't a thing. you should have changed this to couchpotato_user
 

whatnissan

Dabbler
Joined
Feb 18, 2015
Messages
49
still no dice its acting like its starting but it doesnt

Code:
[root@freenas] ~# jexec 22 tcsh
root@couchpotato_1:/ # sysrc 'Couchpotato_user=dave'
Couchpotato_user:  -> dave
root@couchpotato_1:/ # service couchpotato stop
couchpotato not running? (check /var/run/couchpotato/couchpotato.pid).
root@couchpotato_1:/ # service couchpotato start
Starting couchpotato.
root@couchpotato_1:/ # service couchpotato stop
couchpotato not running? (check /var/run/couchpotato/couchpotato.pid).
root@couchpotato_1:/ # sysrc 'Couchpotato_user=dave'
Couchpotato_user: dave -> dave
 

whatnissan

Dabbler
Joined
Feb 18, 2015
Messages
49
I hope i dont have to delete the plugin and start over cause it was kinda sorta working before....
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
still no dice its acting like its starting but it doesnt

Code:
[root@freenas] ~# jexec 22 tcsh
root@couchpotato_1:/ # sysrc 'Couchpotato_user=dave'
Couchpotato_user:  -> dave
root@couchpotato_1:/ # service couchpotato stop
couchpotato not running? (check /var/run/couchpotato/couchpotato.pid).
root@couchpotato_1:/ # service couchpotato start
Starting couchpotato.
root@couchpotato_1:/ # service couchpotato stop
couchpotato not running? (check /var/run/couchpotato/couchpotato.pid).
root@couchpotato_1:/ # sysrc 'Couchpotato_user=dave'
Couchpotato_user: dave -> dave
you didn't do as I said. Couchpotato_user doesn't mean anything.
 

Supa

Patron
Joined
Jan 10, 2014
Messages
204
So I'm attempting to understand this...

Currently I have CP set to 0777 Folder/File permission. I have umask = 0 for transmission. And I have the transmission downloaded permissions set to 777.

I've noticed that every file that gets put into /Downloads/Movies from CP has the permissions set to 921 / Guest.

In CP i get the errors:

ERROR[hpotato.core.plugins.base] Unable writing to file "/media/downloads/Movies/xxx": Traceback (most recent call last): File "/usr/pbi/couchpotato-amd64/share/couchpotato/CouchPotatoServer/couchpotato/core/plugins/base.py", line 142, in createFile f = open(path, write_type)
IOError: [Errno 13] Permission denied: '/media/downloads/Movies/xxx'


I'm wondering if I need to change the Transmission UID to Guest rather than 921. I set pretty much all my folders to guest:guest. Downloads/Movies/TV etc.

Then after every download.. I try to delete the copy of the folder and it says:

uqdFJxR.png


Then again maybe it's because I forgot to restart the transmission plugin after changing umask to 0?


Providing screenshots for these 2 lines would help a lot!

x9L7Q2a.png


Because I'm really not sure what I'm doing :D. I thought all I needed to do was change the transmission UID 921 to guest since that is how I have everything else set up. By runnning chown -R guest:guest /mn1/v1/media/Downloads/Movies I can then delete the files in there with UID 921.

PKKRiUF.png
 
Last edited:

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
S o I'm attempting to understand this...

Currently I have CP set to 0777 Folder/File permission. I have unmask = 0 for transmission. And I have the transmission downloaded permissions set to 777.

I've noticed that every file that gets put into /Downloads/Movies has the permissions set to 921 / Guest.

In CP i get the errors:

ERROR[hpotato.core.plugins.base] Unable writing to file "/media/downloads/Movies/xxx": Traceback (most recent call last): File "/usr/pbi/couchpotato-amd64/share/couchpotato/CouchPotatoServer/couchpotato/core/plugins/base.py", line 142, in createFile f = open(path, write_type)
IOError: [Errno 13] Permission denied: '/media/downloads/Movies/xxx'


I'm wondering if I need to change the Transmission UID to Guest rather than 921. I set pretty much all my folders to guest:guest. Downloads/Movies/TV etc.

Then after every download.. I try to delete the copy of the folder and it says:

uqdFJxR.png


Then again maybe it's because I forgot to restart the transmission plugin after changing unmask to 0?
Just because CP (which runs as user 'media' UID=816) can read/write a file transmission downloaded doesn't mean it can write to the "/media/downloads/Movies" folder. CP, or whatever you use to post-process the file, needs to be able to write to the final destination.

"unmask" doesn't mean anything, you probably mean "umask".
Also, you should 777 from the WebUI > left panel, not editing the config file directly anymore because otherwise it will get overwritten. And saving the settings is all you need to do, no restarting of anything is necessary in this case. I think you did this properly, but just making sure.

I'm not going to comment on the windows permission issue. Not my avenue of expertise.

####

Sorry I doin't have time for the screenshots right now. I never mentioned "guest" in any of the alternative, I don't even know how that would solve anything. Just pick an alternative and execute it for any program that needs to write to any folder.
 

Supa

Patron
Joined
Jan 10, 2014
Messages
204
The windows permission issue is just because for some reason all the files end up with UID 921 instead of guest. I'm not sure if that's a transmission thing or CP thing. As soon as I change the UID to guest they are movable/deletable.

Ok so if I'm doing solution 2:

In the jail, add a user with a matching UID as the owner of the data dataset/folders.

I'm still not sure what the UID should be. What is the UID matching?

These are the only users I have created....

Wl4icfl.png


Rest seems pretty self-explanatory. It's just weird because I have no issues with sickrage but CP is giving me issues.

pw useradd -n guest -u UID -d /nonexistent -s /usr/sbin/nologin
  1. service couchpotato onestop
  2. chown -R guest:guest /var/db/couchpotato
  3. sysrc 'couchpotato_user=guest'
  4. service couchpotato start
 
Status
Not open for further replies.
Top