LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Daemon user question (https://www.linuxquestions.org/questions/linux-server-73/daemon-user-question-926534/)

g_paschoal 01-30-2012 11:12 AM

Daemon user question
 
Hi guys I need to run the deamon named "transmission-daemon" as ftp user not as debian-transmission that is the current user of the daemon.

How do I do that?


Thank you

rodrifra 01-31-2012 02:01 AM

I keep wondering myself why people ask here questions when a simple google search gives the answers......


https://trac.transmissionbt.com/wiki/Scripts/initd


Anyway, changing launching user will probably lead to changing files and directory permisions for the new user (maybe log files and so on...)

g_paschoal 01-31-2012 05:32 AM

I have search for this on google before and I couldn't find my answer.

I have looked at the link you provide me and I also was not able to find my answer.

So You might have misunderstood my question.

acid_kewpie 01-31-2012 05:34 AM

Hmm, I'm not sure they did misunderstand the question. If you look at the init.d script there, there's a very clear "USERNAME=" entry you can change. Also as noted though, there may well be some additional permissions related fallout from doing this.

g_paschoal 01-31-2012 06:38 AM

There's no such thing as USERNAME variable on the script. There is a variable named USER and if I change it to ftp the script won't start.

Quote:

#!/bin/sh -e
### BEGIN INIT INFO
# Provides: transmission-daemon
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start or stop the transmission-daemon.
### END INIT INFO

NAME=transmission-daemon
DAEMON=/usr/bin/$NAME
USER=debian-transmission
# FIXME: no pidfile support; forks, so --make-pidfile doesn't work either
#PIDFILE=/var/run/$NAME.pid
STOP_TIMEOUT=3

export PATH="${PATH:+$PATH:}/sbin"

[ -x $DAEMON ] || exit 0

[ -e /etc/default/$NAME ] && . /etc/default/$NAME

. /lib/lsb/init-functions

start_daemon () {
if [ $ENABLE_DAEMON != 1 ]; then
log_progress_msg "(disabled, see /etc/default/${NAME})"
else
start-stop-daemon --start \
--chuid $USER \
--exec $DAEMON -- $OPTIONS
fi
}

case "$1" in
start)
log_daemon_msg "Starting bittorrent daemon" "$NAME"
start_daemon
log_end_msg 0
;;
stop)
log_daemon_msg "Stopping bittorrent daemon" "$NAME"
start-stop-daemon --stop --quiet \
--exec $DAEMON --retry $STOP_TIMEOUT \
--oknodo
log_end_msg 0
;;
reload)
log_daemon_msg "Reloading bittorrent daemon" "$NAME"
start-stop-daemon --stop --quiet \
--exec $DAEMON \
--oknodo --signal 1
log_end_msg 0
;;
restart|force-reload)
log_daemon_msg "Restarting bittorrent daemon" "$NAME"
start-stop-daemon --stop --quiet \
--exec $DAEMON --retry $STOP_TIMEOUT \
--oknodo
start_daemon
log_end_msg 0
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|reload|force-reload|restart}"
exit 2
;;
esac

exit 0

acid_kewpie 01-31-2012 06:41 AM

right well clearly USER is the alternative, so WHY won't it start? what happens? Is there are GENUINE need to do this? Maybe you can think more carefully about the existing rights and ownerships of directories to get this working as is?

rodrifra 01-31-2012 07:37 AM

Code:

#
# ----- CONFIGURATION -----
#
# For the default location Transmission uses, visit:
# http://trac.transmissionbt.com/wiki/ConfigFiles
# For a guide on how set the preferences, visit:
# http://trac.transmissionbt.com/wiki/EditConfigFiles
# For the available environement variables, visit:
# http://trac.transmissionbt.com/wiki/EnvironmentVariables
#
# The name of the user that should run Transmission.
# It's RECOMENDED to run Transmission in it's own user,
# by default, this is set to 'transmission'.
# For the sake of security you shouldn't set a password
# on this user
USERNAME=transmission

There IS such a thing as USERNAME.

And the steps to follow seem clear to me.

Hmmmmmmmmmmm. You seem to have erased that part from the script. Watch out what are comments and what are not. You have erased code from the script.

acid_kewpie 01-31-2012 07:38 AM

Quote:

Originally Posted by rodrifra (Post 4589352)
Code:

#
# ----- CONFIGURATION -----
#
# For the default location Transmission uses, visit:
# http://trac.transmissionbt.com/wiki/ConfigFiles
# For a guide on how set the preferences, visit:
# http://trac.transmissionbt.com/wiki/EditConfigFiles
# For the available environement variables, visit:
# http://trac.transmissionbt.com/wiki/EnvironmentVariables
#
# The name of the user that should run Transmission.
# It's RECOMENDED to run Transmission in it's own user,
# by default, this is set to 'transmission'.
# For the sake of security you shouldn't set a password
# on this user
USERNAME=transmission

There IS such a thing as USERNAME.

And the steps to follow seem clear to me.

yes but note that isn't the script they are using...

rodrifra 01-31-2012 07:43 AM

Look at the update in my previous post.

acid_kewpie 01-31-2012 07:48 AM

Quote:

Originally Posted by rodrifra (Post 4589354)
Look at the update in my previous post.

No, it is VERY clearly a DIFFERENT script.

g_paschoal 01-31-2012 09:59 AM

It's a different script.

I have installed using this command:

apt-get install transmission-daemon


I got no error when I run the deamon before change the USER variable to ftp.

However when I do netstat, top or ps -ef I don't see the process running. And if the I change USER vairable back to the way it was (USER=debian-transmission) it works OK.

:(

Anybody have any idea ?

anomie 01-31-2012 10:19 AM

@g_paschoal: Check if the parm you need is in /etc/default/transmission-daemon.

rodrifra 01-31-2012 04:01 PM

Do you have any log where you can see what is happening?
As I stated in previous posts, you might need to change permissions on directories/files. You seem to have changed the user, but since it is not working it is probably because the daemon is trying to access places it is not allowed to. Try adding your new user to the group of transmission, or find all those files/directories owned by transmission and change them to the new user.

g_paschoal 02-01-2012 05:21 AM

Yep... I had add ftp user to debian-transmission group and now I am running transmission as ftp user

Thanks for your help guys

bye


All times are GMT -5. The time now is 09:30 PM.