JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 26.06.2018, 15:04
Jungack Jungack is offline
Junior Loader
 
Join Date: Jun 2018
Posts: 13
Question Ubuntu permissions problems

Hello,
I'm a newbie for Jdownloader on Ubuntu and I'm having trouble using It with my config.
Indeed, I'm running Jdownloader on a computer with Nextcloud and Plex. I want It to download all the things I need directly to a folder owned by apache user (www-data). I can't change the permissions of that folder because Nextcloud is blocking It.
Using Plex, I added the user "plex" to the group "www-data" to be able to navigate through the folders owned by www-data user. Knowing that Plex program is launched with the user "plex".
I can't add my personal account to www-data group because Nextcloud doesn't let me do so too.
So how can I let Jdownloader access this folders owned by www-data?
Reply With Quote
  #2  
Old 26.06.2018, 15:15
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 60,451
Default

You can either run JDownloader as the correct user, eg
sudo -c "java -jar JDownloader.jar...&" user
or create a new user JD with group www-data
sudo -c "java -jar JDownloader.jar...&" JD
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3  
Old 26.06.2018, 15:23
Jungack Jungack is offline
Junior Loader
 
Join Date: Jun 2018
Posts: 13
Default

Quote:
Originally Posted by Jiaz View Post
You can either run JDownloader as the correct user, eg
sudo -c "java -jar JDownloader.jar...&" user
or create a new user JD with group www-data
sudo -c "java -jar JDownloader.jar...&" JD
Oh, I didn't know this was possible ! However, now I have uninstalled Jdownloader. If I choose your second option, how to install Jdownloader cleanly?
And another question : how can I auto start on boot Jdownloader if we suppose that I use your second option?
Thank you for your answer !
Reply With Quote
  #4  
Old 26.06.2018, 15:34
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 60,451
Default

Read here about clean installation
https://support.jdownloader.org/Know...bedded-devices

Autostart, best would be to use search engine of your choice.
For example /etc/rc.local

and add line like
sudo -c "java -jar /path/JDownloader.jar &" user
__________________
JD-Dev & Server-Admin
Reply With Quote
  #5  
Old 26.06.2018, 15:42
Jungack Jungack is offline
Junior Loader
 
Join Date: Jun 2018
Posts: 13
Default

Quote:
Originally Posted by Jiaz View Post
Read here about clean installation
**External links are only visible to Support Staff**...

Autostart, best would be to use search engine of your choice.
For example /etc/rc.local

and add line like
sudo -c "java -jar /path/JDownloader.jar &" user
What's the difference between your link tutorial and using the sh file? Do I have to run the installation commands under the user "JD" of your second method of your first post?
Reply With Quote
  #6  
Old 26.06.2018, 15:52
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 60,451
Default

What sh file?
The tutorial is about pure/manual installation as *clean* as possible.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #7  
Old 26.06.2018, 16:00
Jungack Jungack is offline
Junior Loader
 
Join Date: Jun 2018
Posts: 13
Default

Quote:
Originally Posted by Jiaz View Post
What sh file?
The tutorial is about pure/manual installation as *clean* as possible.
http://jdownloader.org/download/index
It is the file that you can download in the linux section of this page.
Using your tutorial, do I have to run all the commands using the newly created user mentioned in your first post?
Reply With Quote
  #8  
Old 26.06.2018, 16:15
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 60,451
Default

Thanks, that's a very old script and not meant for headless installations.
Best would be to run as that user, so the files all have right ownership from start.
create a user, eg jd
su jd
now install JDownloader as user jd
then add commandline to /etc/rc.local /as root like shown above
__________________
JD-Dev & Server-Admin
Reply With Quote
  #9  
Old 26.06.2018, 21:15
Jungack Jungack is offline
Junior Loader
 
Join Date: Jun 2018
Posts: 13
Default

Quote:
Originally Posted by Jiaz View Post
Thanks, that's a very old script and not meant for headless installations.
Best would be to run as that user, so the files all have right ownership from start.
create a user, eg jd
su jd
now install JDownloader as user jd
then add commandline to /etc/rc.local /as root like shown above
Sorry, I have problems installing JDownloader. The step 3.1 shows some errors...

EDIT : Found the solution here but still don't understand why this happened to me...
https://board.jdownloader.org/showthread.php?t=75534
Trying now to make JDownloader start on boot...

Last edited by Jungack; 27.06.2018 at 00:27.
Reply With Quote
  #10  
Old 27.06.2018, 01:56
Jungack Jungack is offline
Junior Loader
 
Join Date: Jun 2018
Posts: 13
Default

Hello,
In fact, I encountered an other problem. The folder group (www-data) only has read permissions. This can't be changed. So JDownloader can't download to the directory I want. Any idea?
Reply With Quote
  #11  
Old 27.06.2018, 10:28
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 60,451
Default

Simply allow write permission to the download folder for that group?
Permissions are set on file/folder level, and not group.
You can also check who the owner of the folder is and use the same user instead of group
__________________
JD-Dev & Server-Admin
Reply With Quote
  #12  
Old 27.06.2018, 12:40
Jungack Jungack is offline
Junior Loader
 
Join Date: Jun 2018
Posts: 13
Default

Quote:
Originally Posted by Jiaz View Post
Simply allow write permission to the download folder for that group?
Permissions are set on file/folder level, and not group.
You can also check who the owner of the folder is and use the same user instead of group
Permissions fixed using chmod -R, chmod g+s and umask (apache). Now trying the autostart.
Reply With Quote
  #13  
Old 27.06.2018, 12:57
Jungack Jungack is offline
Junior Loader
 
Join Date: Jun 2018
Posts: 13
Default

Since I used this post :
https://board.jdownloader.org/showthread.php?t=75534
to solve my problem, I need to use the command
java -Djava.awt.headless=true -jar JDownloader.jar
to start JDownloader each time.
So to autostart I opened /etc/rc.local and put :
sudo -c "java -Djava.awt.headless=true -jar JDownloader.jar" jd2
(jd2 is the user)
It does not work : It does not start automatically. Any idea please?:outch:
Reply With Quote
  #14  
Old 27.06.2018, 13:00
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 60,451
Default

You've got to specify the full path to JDownloader.jar
sudo -c "java -Djava.awt.headless=true -jar /folder/folder/JDownloader.jar &" jd2
__________________
JD-Dev & Server-Admin
Reply With Quote
  #15  
Old 27.06.2018, 13:14
Jungack Jungack is offline
Junior Loader
 
Join Date: Jun 2018
Posts: 13
Default

Quote:
Originally Posted by Jiaz View Post
You've got to specify the full path to JDownloader.jar
sudo -c "java -Djava.awt.headless=true -jar /folder/folder/JDownloader.jar &" jd2
Ah yes sorry, I have put the path but no the &. What is it for?
And I encountered an other problem ahhh ! When the file is downloaded to the folder at stake, It is owned by www-data group and jd2 user. I need It to be owned by www-data user and www-data group. I can't run jd2 with www-data user, since It is the Apache user. How can I automatically change the user owner from jd2 to www-data?
Reply With Quote
  #16  
Old 27.06.2018, 13:43
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 60,451
Default

Of course you can run it as www-data, why shouldn't this be possible?
Doesn't matter if it's used by apache or more applications.
Also you can't change the owner without admin rights and also there is no need to.

The files don't need the same owner!

I suggest to set correct umask

create a script, eg /etc/jd.sh
Code:
#!/bin/bash
umask 000
java -Djava.awt.headless=true -jar /folder/folder/JDownloader.jar &
chmod +x /etc/jd.sh
in /etc/rc.local
sudo -c "/etc/jd.sh &" jd2

umask specifies the default permissions for new created files/folders, so other user/groups can still rename/delete/write the files of JDownloader.

the & tells NOT to wait and start in background
__________________
JD-Dev & Server-Admin
Reply With Quote
  #17  
Old 27.06.2018, 13:53
Jungack Jungack is offline
Junior Loader
 
Join Date: Jun 2018
Posts: 13
Default

Quote:
Originally Posted by Jiaz View Post
Of course you can run it as www-data, why shouldn't this be possible?
Doesn't matter if it's used by apache or more applications.
Also you can't change the owner without admin rights and also there is no need to.

The files don't need the same owner!

I suggest to set correct umask

create a script, eg /etc/jd.sh
Code:
#!/bin/bash
umask 000
java -Djava.awt.headless=true -jar /folder/folder/JDownloader.jar &
chmod +x /etc/jd.sh
in /etc/rc.local
sudo -c "/etc/jd.sh &" jd2

umask specifies the default permissions for new created files/folders, so other user/groups can still rename/delete/write the files of JDownloader.

the & tells NOT to wait and start in background
Thank you for all this informations ! In fact, I don't know how to launch Jdownloader using www-data.
su www-data asks for password.

So I think the problem of accessing the file isn't related to the permissions... My Nextcloud instance does not detect the files downloaded by JDownloader I don't know why ! Some ideas maybe?

umask is already set to 002. With the chmod g+s, all the files downloaded has 775 permissions I think. I'm going to try your scripts. Thank you ! And I put here some results...
Reply With Quote
  #18  
Old 27.06.2018, 13:57
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 60,451
Default

/etc/rc.local is launched as root so sudo doesn't require any password
sudo -c "command" www-data
will run command as www-data
I guess nextcloud has to reindex the new files, maybe a cronjob required for this
__________________
JD-Dev & Server-Admin
Reply With Quote
  #19  
Old 28.06.2018, 11:45
Jungack Jungack is offline
Junior Loader
 
Join Date: Jun 2018
Posts: 13
Default

Hello,
I have tried the command below :
sudo -c "java -Djava.awt.headless=true -jar /folder/folder/JDownloader.jar &" jd2
Instead of showing that jdownloader is starting, It shows me the usage of the sudo command :
usage : sudo -h | -K | -k | -V
usage : sudo -v [-AknS] [-g group]...
Why is this?
Reply With Quote
  #20  
Old 28.06.2018, 11:52
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 60,451
Default

Sorry
try
su -c "java -Djava.awt.headless=true -jar /folder/folder/JDownloader.jar &" jd2
__________________
JD-Dev & Server-Admin
Reply With Quote
Old 28.06.2018, 12:41
Jungack
Message deleted by Jiaz.
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 02:29.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.