LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   File permissions reset after computer restart (https://www.linuxquestions.org/questions/linux-newbie-8/file-permissions-reset-after-computer-restart-4175478384/)

esso82 09-24-2013 02:43 PM

Transmission-daemon doesn't bind rpc port
 
All this is useless reading - jump straight to post #16

Hello, I've put together my home file server running debian wheezy and I have problems with transmission daemon rpc, the deamon itself is running but the server is not listening on the rpc port set in settings.json. Then I found out that settings.json is:
Code:

- rw------- debian-transmission debian-transmission settings.json
If I restart (not reload the settings - that won't work), then daemon is able to read settings.json, but I want it to work straight after the server starts, so I:
Code:

# chmod 660 settings.json
Then ls -l shows:
Code:

- rw-rw---- debian-transmission debian-transmission settings.json
That looks fine to me now, as the daemon is ran by debian-transmission, but after i do reboot, permissions on setting.json are set back to 600. I do this via SSH and either as root or root group user.

Can anyone please help me? Why do those permissions reset after i reboot?

Also, to avoid creating another thread, different sort of question though, in windows, there is Device Manager which shows me all the devices and whether the drivers are installed/mising or there is a conflict on device. Is there any way how can I check this in linux cli? or at least xfce as I don't need gnome/kde/whatever on my server. Thank you for suggestions ;)

kbp 09-24-2013 10:24 PM

So is your transmission server not running as the debian-transmission user ? Permissions won't change themselves so it's probably one of the transmission applications doing it

Firerat 09-25-2013 01:40 AM

with kbp on this

transmission deamon should be started with user debian-transmission.

How are you starting it?

esso82 09-25-2013 02:38 AM

hmm, as I am quite noob, I don't know to determine this, but I guess you want to know what ps -aux | grep transmission-daemon shows:
Code:

105    2074  0.0  0.0  91388  2552  ?      Ss1  08:29  0:00 /usr/bin/transmission-daemon --config-dir /var/lib/transmission-daemon/info
esso  2794  0.0  0.0  7828  880  pts/0  S+  08:32  0:00 grep transmission-daemon

105 is debian-transmission according to /etc/passwd

EDIT:
How do I know how do I start it? How would I change the process owner if I need to?

Firerat 09-25-2013 02:57 AM

that looks good to me

when you install transmission-daemon in Debian it defaults to configuring the service to start,
you can find the startup script here
/etc/init.d/transmission-daemon

some background reading here
https://wiki.debian.org/Daemon

I have to admit, I currently don't understand what is going wrong for you, it should be working 'as is'



and regards your other question, the best I can think of right now is
Code:

lspci -k

esso82 09-25-2013 03:12 AM

yes, that's what I thought, when I do
Code:

# /etc/init.d/transmission-daemon restart
everything works, but not right after the system boots. Well, I'll probably --purge remove a nd install the package again and will see, I'll report how it goes. To the second question, I don't have time now, have to go to work, but will tell you later whether that is what I thought because I never saw that command before :redface:

esso82 09-29-2013 03:35 PM

OK ... nothing worked so I reinstalled the system and it doesn't work on clean install either ...

I noticed that /etc/transmission-daemon's rights are drwxrws--- (what does the 's' stand for?)
tried chmod 770 but there is still the 's' right instead of 'x' for the owner which is debian-transmission

stat %a transmission-daemon says - Access: (2770/drwxrws---)

how do I change it to "real" 770? It looks like the user which runs the daemon can't access the file, because can't go into the directory where settings are located

kbp 09-29-2013 06:09 PM

That's called a sticky bit, setting g+s (group sticky) on a directory means that no matter which user creates a file in the directory it's group will be the same as the directory. This is a way of ensuring that the group who owns the directory will always have access to every file in it.

esso82 09-30-2013 02:24 PM

Ok .. reinstalled for 7th (yes, seventh!!!) time, and went step by step

so:
1. clean install of debian
2. after reboot, apt-get update
3. then apt-get install transmission transmission-common transmission-daemon transmission-cli
4. after reboot, netstat shows connection on port 9091 (which is default), but as I have another daemon on NAS running on port 9091, I want to change the port to 9092
5. /etc/init.d/transmission-daemon stop (because I want to change the rpc port in settings.json)
6. now the test, right after "stop" I tried to start the daemon again and restart the computer without making any changes to settings.json, just stop and start the daemon, to see whether it still works
7. after reboot netstat shows no listening on 9091 or 9092

what the hell???????? I did all this via SSH as root

where do I make mistake? People, gurus, please help, I start to have grey hair from this

Habitual 09-30-2013 03:19 PM

Quote:

Originally Posted by esso82 (Post 5037473)
Ok .. reinstalled for 7th (yes, seventh!!!) time...

Stop that.
It's unnecessary, but perhaps you realize that now?

esso82 09-30-2013 03:28 PM

Quote:

Originally Posted by Habitual (Post 5037502)
Stop that.
It's unnecessary, but perhaps you realize that now?

Yes, the last time was to determine exactly when it gets broken

Firerat 09-30-2013 04:33 PM

I do hope that your netstat is
Code:

netstat -a

esso82 10-01-2013 04:46 PM

Quote:

Originally Posted by Firerat (Post 5037541)
I do hope that your netstat is
Code:

netstat -a

sorry for late reply, baby was crying all the time lol

nope, did netstat -el but tried -a now as well and can't see the port there

OK, no more reinstalls, tried to log daemon's activity, at least as much as is offered, here is the log:
Code:

[22:34:45.175] Transmission 2.52 (13304) started (session.c:718)
[22:34:45.175] RPC Server Adding address to whitelist: 127.0.0.1 (rpc-server.c:803)
[22:34:45.175] RPC Server Serving RPC and Web requests on port 127.0.0.1:9091/transmission/ (rpc-server.c:997)
[22:34:45.175] RPC Server Whitelist enabled (rpc-server.c:1001)
[22:34:45.175] UDP Failed to set receive buffer: requested 4194304, got 262142 (tr-udp.c:75)
[22:34:45.175] UDP Please add the line "net.core.rmem_max = 4194304" to /etc/sysctl.conf (tr-udp.c:80)
[22:34:45.175] UDP Failed to set send buffer: requested 1048576, got 262142 (tr-udp.c:86)
[22:34:45.175] UDP Please add the line "net.core.wmem_max = 1048576" to /etc/sysctl.conf (tr-udp.c:91)
[22:34:45.175] DHT Generating new id (tr-dht.c:309)
[22:34:45.175] Using settings from "/root/.config/transmission-daemon" (daemon.c:488)
[22:34:45.175] Saved "/root/.config/transmission-daemon/settings.json" (bencode.c:1731)
[22:34:45.175] Port Forwarding (NAT-PMP) initnatpmp succeeded (0) (natpmp.c:72)
[22:34:45.175] Port Forwarding (NAT-PMP) sendpublicaddressrequest succeeded (2) (natpmp.c:72)
[22:34:54.176] Port Forwarding (UPnP) Found Internet Gateway Device "http://192.168.0.1:37215/ctrlu/WANIPConnection_3" (upnp.c:202)
[22:34:54.176] Port Forwarding (UPnP) Local Address is "192.168.0.13" (upnp.c:204)
[22:34:54.176] Port Forwarding (UPnP) Port forwarding through "http://192.168.0.1:37215/ctrlu/WANIPConnection_3", service "urn:schemas-upnp-org:service:WANIPConnection:1". (local address: 192.168.0.13:51413) (upnp.c:279)
[22:34:54.176] Port Forwarding State changed from "Not forwarded" to "Starting" (port-forwarding.c:93)
[22:34:54.176] Port Forwarding State changed from "Starting" to "???" (port-forwarding.c:93)
[22:35:17.177] DHT Attempting bootstrap from dht.transmissionbt.com (tr-dht.c:247)

my settings.json:
Code:

{
    "alt-speed-down": 50,
    "alt-speed-enabled": false,
    "alt-speed-time-begin": 540,
    "alt-speed-time-day": 127,
    "alt-speed-time-enabled": false,
    "alt-speed-time-end": 1020,
    "alt-speed-up": 50,
    "bind-address-ipv4": "0.0.0.0",
    "bind-address-ipv6": "::",
    "blocklist-enabled": false,
    "blocklist-url": "http://www.example.com/blocklist",
    "cache-size-mb": 4,
    "dht-enabled": true,
    "download-dir": "/shares/hdd1/tmp/torrent/complete",
    "download-limit": 100,
    "download-limit-enabled": 0,
    "download-queue-enabled": true,
    "download-queue-size": 5,
    "encryption": 1,
    "idle-seeding-limit": 30,
    "idle-seeding-limit-enabled": false,
    "incomplete-dir": "/shares/hdd1/tmp/torrent/incomplete",
    "incomplete-dir-enabled": true,
    "lpd-enabled": false,
    "max-peers-global": 200,
    "message-level": 2,
    "peer-congestion-algorithm": "",
    "peer-limit-global": 240,
    "peer-limit-per-torrent": 60,
    "peer-port": 21766,
    "peer-port-random-high": 65535,
    "peer-port-random-low": 49152,
    "peer-port-random-on-start": false,
    "peer-socket-tos": "default",
    "pex-enabled": true,
    "port-forwarding-enabled": true,
    "preallocation": 1,
    "prefetch-enabled": 1,
    "queue-stalled-enabled": true,
    "queue-stalled-minutes": 30,
    "ratio-limit": 2,
    "ratio-limit-enabled": false,
    "rename-partial-files": true,
    "rpc-authentication-required": true,
    "rpc-bind-address": "0.0.0.0",
    "rpc-enabled": true,
    "rpc-password": "{40759589a5272710cc3f81ba0263ccff797ec3deq9GJJAgu",
    "rpc-port": 9092,
    "rpc-url": "/transmission/",
    "rpc-username": "admin",
    "rpc-whitelist": "127.0.0.1",
    "rpc-whitelist-enabled": false,
    "scrape-paused-torrents-enabled": true,
    "script-torrent-done-enabled": false,
    "script-torrent-done-filename": "",
    "seed-queue-enabled": false,
    "seed-queue-size": 10,
    "speed-limit-down": 100,
    "speed-limit-down-enabled": false,
    "speed-limit-up": 100,
    "speed-limit-up-enabled": false,
    "start-added-torrents": true,
    "trash-original-torrent-files": false,
    "umask": 18,
    "upload-limit": 100,
    "upload-limit-enabled": 0,
    "upload-slots-per-torrent": 14,
    "utp-enabled": true,
    "watch-dir": "/shares/hdd1/tmp/torrent/watch",
    "watch-dir-enabled": true
}

noticed that port 9091 in log? ... why???? why is that???? why it doesn't read from /etc/transmission-daemon/settings.json ????

Firerat 10-01-2013 05:40 PM

ok, I'm confused now

earlier we decided that transmission-daemon was running as debian-transmission ( post 4 )

but your log ( post 13 ) it would appear that root is running it...

lets see if we can figure out what is going on

Code:

sudo sh -x /etc/init.d/transmission-daemon start 2>&1 | grep start-stop
you should get
Code:

+ start-stop-daemon --start --chuid debian-transmission --exec /usr/bin/transmission-daemon -- --config-dir /var/lib/transmission-daemon/info
if not, stop it with
Code:

sudo service transmission-daemon stop
Code:

sudo sh -c "sh -vx /etc/init.d/transmission-daemon start 2>&1 > /path/to/somelog.log"
Wayyy to much in that log, but too much is better than too little ;)
also post the contents of
/etc/default/transmission-daemon

esso82 10-01-2013 06:01 PM

yes, I got exactly what you wrote down, chuid is debian-transmission + all those paths are the same
but I can see where you point, but I was blind or it is way too late here and I'm waaay to tired lol
log says something about /root/.config/...... right, it should say /etc/tranmsission.....
but I don't know how the hell do I explain to that boody daemon to read from there lol

/etc/defaults/trasmission-daemon:
Code:

# defaults for transmission-daemon
# sourced by /etc/init.d/transmission-daemon

# Change to 0 to disable daemon
ENABLE_DAEMON=1

# This directory stores some runtime information, like torrent files
# and links to the config file, which itself can be found in
# /etc/transmission-daemon/settings.json
CONFIG_DIR="/var/lib/transmission-daemon/info"

# Default options for daemon, see transmission-daemon(1) for more options
OPTIONS="--config-dir $CONFIG_DIR --logfile /var/log/transmission-daemon.log"

# (optional) extra options to start-stop-daemon
#START_STOP_OPTIONS="--iosched idle --nicelevel 10"

/etc/init.d/transmission-daemon:
Code:

#!/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
STOP_TIMEOUT=30

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)"
                log_end_msg 255 || true
    else
        start-stop-daemon --start \
        --chuid $USER \
                $START_STOP_OPTIONS \
        --exec $DAEMON -- $OPTIONS || log_end_msg $?
                log_end_msg 0
    fi
}

case "$1" in
    start)
        log_daemon_msg "Starting bittorrent daemon" "$NAME"
        start_daemon
        ;;
    stop)
        log_daemon_msg "Stopping bittorrent daemon" "$NAME"
        start-stop-daemon --stop --quiet \
            --exec $DAEMON --retry $STOP_TIMEOUT \
            --oknodo || log_end_msg $?
        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 $?
        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 || log_end_msg $?
        start_daemon
        ;;
    status)
        status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
        ;;
    *)
        log_action_msg "Usage: /etc/init.d/$NAME {start|stop|reload|force-reload|restart|status}" || true
        exit 2
        ;;
esac

exit 0

I didn't change anything in any of those two EDIT: I did actually, added the logfile option

EDIT: it's really really late here and I wake up to work in 5 hours so I go sleep and will get back tomorrow to try anything you suggest, thank you for helping btw ;)

EDIT2: there is a link in /var/lib/transmission-daemon/info/settings.json -> /etc/transmission-daemon/settings.json


All times are GMT -5. The time now is 03:21 PM.