Can only get sabnzbd to run as root

Support for the Debian/Ubuntu package, created by JCFP.
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
littlecharva
Newbie
Newbie
Posts: 3
Joined: February 17th, 2012, 11:46 am

Can only get sabnzbd to run as root

Post by littlecharva »

Hi,

I'm a relative newb at Linux, but have learned enough to install and setup most software. I followed the article at the following link to install sabnzbd:

http://serverflux.com/linux/install-sab ... n-squeeze/

It all worked fine, but when I tried to start the daemon, it complained of:

OSError: [Errno 13] Permission denied: '/root/.sabnzbd'

Which I assume means it's trying to create it's config folder in the root folder for some reason. I've tried setting the USER to a few different things in the /etc/defaults/sabnzbd file, but nothing seemed to sway it from trying to work from the /root folder.

In the end I set the USER to root, which at least got sabnzbd working, but I obviously don't want it running as root going forward. What am I doing wrong?

littlecharva
User avatar
jcfp
Release Testers
Release Testers
Posts: 989
Joined: February 7th, 2008, 12:45 pm

Re: Can only get sabnzbd to run as root

Post by jcfp »

The install method in the tutorial you linked to doesn't make too much sense, since the program is available directly from Debian using apt-get or aptitude, and also doesn't need python2.4. Note that /etc/defaults/sabnzbdplus is only used by the init script (/etc/init.d/sabnzbdplus), not by the program itself. So editing it won't do any magic unless you actually have the program running as a system service, which can be controlled manually via /etc/init.d/sabnzbdplus start|stop|restart|etc.

As for your perceived "root only" problem, there's just not alot of information in your post to go by. Without the init configuration and the actual commands you're trying, all we can do is making wild guesses.
littlecharva
Newbie
Newbie
Posts: 3
Joined: February 17th, 2012, 11:46 am

Re: Can only get sabnzbd to run as root

Post by littlecharva »

I tried an apt-get install sabnzbdplus before I followed the tutorial, but it said it couldn't be found.

I have been using the /etc/init.d/sabnzbdplus start method to start it. That's what was throwing the initial error until I set the USER to root.

So to clarify: the only things I changed in the default settings file were the USER (to root), the HOST (to 0.0.0.0) and the PORT (to 6999). I'm then starting the service with /etc/init.d/sabnzbdplus start, which gave me the permissions error on /root/.sabnzbd when I set USER to anything but root.

I now have it running, but only by setting it to run as root - which I don't want.

littlecharva
User avatar
jcfp
Release Testers
Release Testers
Posts: 989
Joined: February 7th, 2008, 12:45 pm

Re: Can only get sabnzbd to run as root

Post by jcfp »

Make that sh -x /etc/init.d/sabnzbdplus start and post the complete output. Also try setting the config location explicitly.
littlecharva
Newbie
Newbie
Posts: 3
Joined: February 17th, 2012, 11:46 am

Re: Can only get sabnzbd to run as root

Post by littlecharva »

Hi,

The output:


+ DAEMON=/usr/bin/sabnzbdplus
+ SETTINGS=/etc/default/sabnzbdplus
+ [ -x /usr/bin/sabnzbdplus ]
+ [ -r /etc/default/sabnzbdplus ]
+ DESC=SABnzbd+ binary newsgrabber
+ DEFOPTS=--daemon
+ sed -n 1s/^#\!\([a-z0-9\.\/]\+\)\(.*\)/\1(\2)?/p /usr/bin/sabnzbdplus
+ PYTHONEXEC=^/usr/bin/python( -OO)?
+ PIDFILE=/var/run/sabnzbdplus.pid
+ SETTINGS_LOADED=FALSE
+ unset USER CONFIG HOST PORT EXTRAOPTS
+ . /lib/lsb/init-functions
+ FANCYTTY=
+ [ -e /etc/lsb-base-logging.sh ]
+ true
+ start_sab
+ load_settings
+ [ FALSE != TRUE ]
+ . /etc/default/sabnzbdplus
+ USER=root
+ CONFIG=
+ HOST=0.0.0.0
+ PORT=6999
+ EXTRAOPTS=
+ [ -z root ]
+ OPTIONS=--daemon
+ [ -n ]
+ [ -n 0.0.0.0 ]
+ SERVER=0.0.0.0
+ [ -n 6999 ]
+ SERVER=0.0.0.0:6999
+ [ -n 0.0.0.0:6999 ]
+ OPTIONS=--daemon --server 0.0.0.0:6999
+ [ -n ]
+ SETTINGS_LOADED=TRUE
+ return 0
+ is_running
+ pgrep -f -x -u root ^/usr/bin/python( -OO)? /usr/bin/sabnzbdplus --daemon.*
+ PID=
+ RET=1
+ [ 1 -gt 1 ]
+ return 1
+ log_daemon_msg Starting SABnzbd+ binary newsgrabber
+ [ -z Starting SABnzbd+ binary newsgrabber ]
+ log_daemon_msg_pre Starting SABnzbd+ binary newsgrabber
+ :
+ [ -z ]
+ echo -n Starting SABnzbd+ binary newsgrabber:
Starting SABnzbd+ binary newsgrabber:+ return
+ start-stop-daemon --quiet --chuid root --start --exec /usr/bin/sabnzbdplus -- --daemon --server 0.0.0.0:6999
+ check_retval
+ [ 0 -eq 0 ]
+ log_end_msg 0
+ [ -z 0 ]
+ retval=0
+ log_end_msg_pre 0
+ :
+ log_use_fancy_output
+ TPUT=/usr/bin/tput
+ EXPR=/usr/bin/expr
+ [ -t 1 ]
+ [ xxterm-256color != x ]
+ [ xxterm-256color != xdumb ]
+ [ -x /usr/bin/tput ]
+ [ -x /usr/bin/expr ]
+ /usr/bin/tput hpa 60
+ /usr/bin/tput setaf 1
+ [ -z ]
+ FANCYTTY=1
+ true
+ /usr/bin/tput setaf 1
+ RED=
+ /usr/bin/tput setaf 3
+ YELLOW=
+ /usr/bin/tput op
+ NORMAL=
+ [ 0 -eq 0 ]
+ echo .
.
+ log_end_msg_post 0
+ :
+ return 0
+ return 0
+ dirname /var/run/sabnzbdplus.pid
+ [ -w /var/run ]
+ pgrep -f -x -n -u root ^/usr/bin/python( -OO)? /usr/bin/sabnzbdplus --daemon --server 0.0.0.0:6999
+ exit 0

I'm not sure what to point the CONFIG to when setting it manually - do I just put /home/myusername/.sabnzbd ?
User avatar
jcfp
Release Testers
Release Testers
Posts: 989
Joined: February 7th, 2008, 12:45 pm

Re: Can only get sabnzbd to run as root

Post by jcfp »

In the output you posted the service is configured to run as root, that won't tell us why it wouldn't run as a non-root user.
I'm not sure what to point the CONFIG to when setting it manually - do I just put /home/myusername/.sabnzbd ?
Anywhere fully accessable for that user.
Post Reply