LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-30-2012, 11:12 AM   #1
g_paschoal
Member
 
Registered: Oct 2009
Posts: 131

Rep: Reputation: 15
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
 
Old 01-31-2012, 02:01 AM   #2
rodrifra
Member
 
Registered: Mar 2007
Location: Spain
Distribution: Debian
Posts: 202

Rep: Reputation: 36
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...)
 
Old 01-31-2012, 05:32 AM   #3
g_paschoal
Member
 
Registered: Oct 2009
Posts: 131

Original Poster
Rep: Reputation: 15
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.
 
Old 01-31-2012, 05:34 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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.
 
Old 01-31-2012, 06:38 AM   #5
g_paschoal
Member
 
Registered: Oct 2009
Posts: 131

Original Poster
Rep: Reputation: 15
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
 
Old 01-31-2012, 06:41 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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?
 
Old 01-31-2012, 07:37 AM   #7
rodrifra
Member
 
Registered: Mar 2007
Location: Spain
Distribution: Debian
Posts: 202

Rep: Reputation: 36
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.

Last edited by rodrifra; 01-31-2012 at 07:40 AM. Reason: update
 
Old 01-31-2012, 07:38 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Quote:
Originally Posted by rodrifra View Post
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...
 
Old 01-31-2012, 07:43 AM   #9
rodrifra
Member
 
Registered: Mar 2007
Location: Spain
Distribution: Debian
Posts: 202

Rep: Reputation: 36
Look at the update in my previous post.
 
Old 01-31-2012, 07:48 AM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Quote:
Originally Posted by rodrifra View Post
Look at the update in my previous post.
No, it is VERY clearly a DIFFERENT script.
 
Old 01-31-2012, 09:59 AM   #11
g_paschoal
Member
 
Registered: Oct 2009
Posts: 131

Original Poster
Rep: Reputation: 15
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 ?
 
Old 01-31-2012, 10:19 AM   #12
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
@g_paschoal: Check if the parm you need is in /etc/default/transmission-daemon.
 
Old 01-31-2012, 04:01 PM   #13
rodrifra
Member
 
Registered: Mar 2007
Location: Spain
Distribution: Debian
Posts: 202

Rep: Reputation: 36
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.
 
Old 02-01-2012, 05:21 AM   #14
g_paschoal
Member
 
Registered: Oct 2009
Posts: 131

Original Poster
Rep: Reputation: 15
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
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't seem to start daemon as another user veeruk101 Linux - Software 1 05-31-2011 06:52 PM
How to run daemon process being a normal user [not root user]. narendra1310 Linux - Software 1 10-26-2009 09:48 AM
Daemon User redijedi Linux - Newbie 9 10-30-2006 02:50 PM
Daemon User redijedi Linux - General 1 04-07-2005 07:44 PM
Making a Daemon User Road Linux - General 4 07-10-2002 01:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration