Permission error on logdirectory in Ubuntu 18.10

Multi tool use
I have a python daemon program that wants to write logs to /var/log/xxxxx/yyyy
The daemon is started with start-stop-daemon with the option chuid to the unprivileged user.
However when I start the program it will crash with a Permission error on the write to the logfile. This will happen even if I set the permissions of the directories to 777.
I have given the proper permissions for the unprivileged user. I have checked this by su to the user and writing a file in the log directory. This works OK.
Furthermore I have checked that it is actually the proper user that is running the program. This also checks out correctly.
Also I checked if it was a problem with start-stop-daemon, so I started the program manually from the user tm7. This gives the same problem.
Finally the program will run if started as root.
Jan 03 08:56:09 testlinux testde[13205]: * Starting DataExtractor tm7 carp suite
Jan 03 08:56:09 testlinux systemd-resolved[574]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Jan 03 08:56:09 testlinux testde[13205]: sourcedir /opt/tm7/dataextractor/src
Jan 03 08:56:09 testlinux testde[13205]: sys.path is ['/opt/tm7/dataextractor/src', '/opt/tm7/dataextractor', '/opt/tm7/dataextractor/src', '/opt/tm7/venv/dataextractor/lib/python36.zip', '/opt/tm7/
Jan 03 08:56:09 testlinux testde[13205]: Collector started with config /etc/tm7/Customers/Sparq/config.yml
Jan 03 08:56:09 testlinux testde[13205]: Config setup started with customer Sparq and file None
Jan 03 08:56:09 testlinux testde[13205]: get definition directory
Jan 03 08:56:09 testlinux testde[13205]: Definition directory: /etc/tm7/Customers
Jan 03 08:56:09 testlinux testde[13205]: ******* tm7 Start dataextractor_main version developer Logging in /var/log/collector using /etc/tm7/Customers/generic/logger.ini
Jan 03 08:56:09 testlinux testde[13205]: Traceback (most recent call last):
Jan 03 08:56:09 testlinux testde[13205]: File "src/main.py", line 72, in <module>
Jan 03 08:56:09 testlinux testde[13205]: main()
Jan 03 08:56:09 testlinux testde[13205]: File "src/main.py", line 64, in main
Jan 03 08:56:09 testlinux testde[13205]: setup_loggers('main')
Jan 03 08:56:09 testlinux testde[13205]: File "/opt/tm7/dataextractor/src/utils/SetUpLog.py", line 94, in setup_loggers
Jan 03 08:56:09 testlinux testde[13205]: fileConfig(logconf, defaults=None, disable_existing_loggers=False)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/config.py", line 84, in fileConfig
Jan 03 08:56:09 testlinux testde[13205]: handlers = _install_handlers(cp, formatters)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/config.py", line 148, in _install_handlers
Jan 03 08:56:09 testlinux testde[13205]: h = klass(*args)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/handlers.py", line 150, in __init__
Jan 03 08:56:09 testlinux testde[13205]: BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/handlers.py", line 57, in __init__
Jan 03 08:56:09 testlinux testde[13205]: logging.FileHandler.__init__(self, filename, mode, encoding, delay)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/__init__.py", line 1032, in __init__
Jan 03 08:56:09 testlinux testde[13205]: StreamHandler.__init__(self, self._open())
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/__init__.py", line 1061, in _open
Jan 03 08:56:09 testlinux testde[13205]: return open(self.baseFilename, self.mode, encoding=self.encoding)
Jan 03 08:56:09 testlinux testde[13205]: PermissionError: [Errno 13] Permission denied: '/var/log/collector/collector-main.log'
Jan 03 08:56:09 testlinux systemd[1]: testde.service: Control process exited, code=exited status=1
Jan 03 08:56:09 testlinux systemd[1]: testde.service: Failed with result 'exit-code'.
Jan 03 08:56:09 testlinux systemd[1]: Failed to start LSB: DataExtractor.
-- Subject: Unit testde.service has failed
-- Defined-By: systemd
--
python-3.x ubuntu
add a comment |
I have a python daemon program that wants to write logs to /var/log/xxxxx/yyyy
The daemon is started with start-stop-daemon with the option chuid to the unprivileged user.
However when I start the program it will crash with a Permission error on the write to the logfile. This will happen even if I set the permissions of the directories to 777.
I have given the proper permissions for the unprivileged user. I have checked this by su to the user and writing a file in the log directory. This works OK.
Furthermore I have checked that it is actually the proper user that is running the program. This also checks out correctly.
Also I checked if it was a problem with start-stop-daemon, so I started the program manually from the user tm7. This gives the same problem.
Finally the program will run if started as root.
Jan 03 08:56:09 testlinux testde[13205]: * Starting DataExtractor tm7 carp suite
Jan 03 08:56:09 testlinux systemd-resolved[574]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Jan 03 08:56:09 testlinux testde[13205]: sourcedir /opt/tm7/dataextractor/src
Jan 03 08:56:09 testlinux testde[13205]: sys.path is ['/opt/tm7/dataextractor/src', '/opt/tm7/dataextractor', '/opt/tm7/dataextractor/src', '/opt/tm7/venv/dataextractor/lib/python36.zip', '/opt/tm7/
Jan 03 08:56:09 testlinux testde[13205]: Collector started with config /etc/tm7/Customers/Sparq/config.yml
Jan 03 08:56:09 testlinux testde[13205]: Config setup started with customer Sparq and file None
Jan 03 08:56:09 testlinux testde[13205]: get definition directory
Jan 03 08:56:09 testlinux testde[13205]: Definition directory: /etc/tm7/Customers
Jan 03 08:56:09 testlinux testde[13205]: ******* tm7 Start dataextractor_main version developer Logging in /var/log/collector using /etc/tm7/Customers/generic/logger.ini
Jan 03 08:56:09 testlinux testde[13205]: Traceback (most recent call last):
Jan 03 08:56:09 testlinux testde[13205]: File "src/main.py", line 72, in <module>
Jan 03 08:56:09 testlinux testde[13205]: main()
Jan 03 08:56:09 testlinux testde[13205]: File "src/main.py", line 64, in main
Jan 03 08:56:09 testlinux testde[13205]: setup_loggers('main')
Jan 03 08:56:09 testlinux testde[13205]: File "/opt/tm7/dataextractor/src/utils/SetUpLog.py", line 94, in setup_loggers
Jan 03 08:56:09 testlinux testde[13205]: fileConfig(logconf, defaults=None, disable_existing_loggers=False)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/config.py", line 84, in fileConfig
Jan 03 08:56:09 testlinux testde[13205]: handlers = _install_handlers(cp, formatters)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/config.py", line 148, in _install_handlers
Jan 03 08:56:09 testlinux testde[13205]: h = klass(*args)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/handlers.py", line 150, in __init__
Jan 03 08:56:09 testlinux testde[13205]: BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/handlers.py", line 57, in __init__
Jan 03 08:56:09 testlinux testde[13205]: logging.FileHandler.__init__(self, filename, mode, encoding, delay)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/__init__.py", line 1032, in __init__
Jan 03 08:56:09 testlinux testde[13205]: StreamHandler.__init__(self, self._open())
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/__init__.py", line 1061, in _open
Jan 03 08:56:09 testlinux testde[13205]: return open(self.baseFilename, self.mode, encoding=self.encoding)
Jan 03 08:56:09 testlinux testde[13205]: PermissionError: [Errno 13] Permission denied: '/var/log/collector/collector-main.log'
Jan 03 08:56:09 testlinux systemd[1]: testde.service: Control process exited, code=exited status=1
Jan 03 08:56:09 testlinux systemd[1]: testde.service: Failed with result 'exit-code'.
Jan 03 08:56:09 testlinux systemd[1]: Failed to start LSB: DataExtractor.
-- Subject: Unit testde.service has failed
-- Defined-By: systemd
--
python-3.x ubuntu
add a comment |
I have a python daemon program that wants to write logs to /var/log/xxxxx/yyyy
The daemon is started with start-stop-daemon with the option chuid to the unprivileged user.
However when I start the program it will crash with a Permission error on the write to the logfile. This will happen even if I set the permissions of the directories to 777.
I have given the proper permissions for the unprivileged user. I have checked this by su to the user and writing a file in the log directory. This works OK.
Furthermore I have checked that it is actually the proper user that is running the program. This also checks out correctly.
Also I checked if it was a problem with start-stop-daemon, so I started the program manually from the user tm7. This gives the same problem.
Finally the program will run if started as root.
Jan 03 08:56:09 testlinux testde[13205]: * Starting DataExtractor tm7 carp suite
Jan 03 08:56:09 testlinux systemd-resolved[574]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Jan 03 08:56:09 testlinux testde[13205]: sourcedir /opt/tm7/dataextractor/src
Jan 03 08:56:09 testlinux testde[13205]: sys.path is ['/opt/tm7/dataextractor/src', '/opt/tm7/dataextractor', '/opt/tm7/dataextractor/src', '/opt/tm7/venv/dataextractor/lib/python36.zip', '/opt/tm7/
Jan 03 08:56:09 testlinux testde[13205]: Collector started with config /etc/tm7/Customers/Sparq/config.yml
Jan 03 08:56:09 testlinux testde[13205]: Config setup started with customer Sparq and file None
Jan 03 08:56:09 testlinux testde[13205]: get definition directory
Jan 03 08:56:09 testlinux testde[13205]: Definition directory: /etc/tm7/Customers
Jan 03 08:56:09 testlinux testde[13205]: ******* tm7 Start dataextractor_main version developer Logging in /var/log/collector using /etc/tm7/Customers/generic/logger.ini
Jan 03 08:56:09 testlinux testde[13205]: Traceback (most recent call last):
Jan 03 08:56:09 testlinux testde[13205]: File "src/main.py", line 72, in <module>
Jan 03 08:56:09 testlinux testde[13205]: main()
Jan 03 08:56:09 testlinux testde[13205]: File "src/main.py", line 64, in main
Jan 03 08:56:09 testlinux testde[13205]: setup_loggers('main')
Jan 03 08:56:09 testlinux testde[13205]: File "/opt/tm7/dataextractor/src/utils/SetUpLog.py", line 94, in setup_loggers
Jan 03 08:56:09 testlinux testde[13205]: fileConfig(logconf, defaults=None, disable_existing_loggers=False)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/config.py", line 84, in fileConfig
Jan 03 08:56:09 testlinux testde[13205]: handlers = _install_handlers(cp, formatters)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/config.py", line 148, in _install_handlers
Jan 03 08:56:09 testlinux testde[13205]: h = klass(*args)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/handlers.py", line 150, in __init__
Jan 03 08:56:09 testlinux testde[13205]: BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/handlers.py", line 57, in __init__
Jan 03 08:56:09 testlinux testde[13205]: logging.FileHandler.__init__(self, filename, mode, encoding, delay)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/__init__.py", line 1032, in __init__
Jan 03 08:56:09 testlinux testde[13205]: StreamHandler.__init__(self, self._open())
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/__init__.py", line 1061, in _open
Jan 03 08:56:09 testlinux testde[13205]: return open(self.baseFilename, self.mode, encoding=self.encoding)
Jan 03 08:56:09 testlinux testde[13205]: PermissionError: [Errno 13] Permission denied: '/var/log/collector/collector-main.log'
Jan 03 08:56:09 testlinux systemd[1]: testde.service: Control process exited, code=exited status=1
Jan 03 08:56:09 testlinux systemd[1]: testde.service: Failed with result 'exit-code'.
Jan 03 08:56:09 testlinux systemd[1]: Failed to start LSB: DataExtractor.
-- Subject: Unit testde.service has failed
-- Defined-By: systemd
--
python-3.x ubuntu
I have a python daemon program that wants to write logs to /var/log/xxxxx/yyyy
The daemon is started with start-stop-daemon with the option chuid to the unprivileged user.
However when I start the program it will crash with a Permission error on the write to the logfile. This will happen even if I set the permissions of the directories to 777.
I have given the proper permissions for the unprivileged user. I have checked this by su to the user and writing a file in the log directory. This works OK.
Furthermore I have checked that it is actually the proper user that is running the program. This also checks out correctly.
Also I checked if it was a problem with start-stop-daemon, so I started the program manually from the user tm7. This gives the same problem.
Finally the program will run if started as root.
Jan 03 08:56:09 testlinux testde[13205]: * Starting DataExtractor tm7 carp suite
Jan 03 08:56:09 testlinux systemd-resolved[574]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Jan 03 08:56:09 testlinux testde[13205]: sourcedir /opt/tm7/dataextractor/src
Jan 03 08:56:09 testlinux testde[13205]: sys.path is ['/opt/tm7/dataextractor/src', '/opt/tm7/dataextractor', '/opt/tm7/dataextractor/src', '/opt/tm7/venv/dataextractor/lib/python36.zip', '/opt/tm7/
Jan 03 08:56:09 testlinux testde[13205]: Collector started with config /etc/tm7/Customers/Sparq/config.yml
Jan 03 08:56:09 testlinux testde[13205]: Config setup started with customer Sparq and file None
Jan 03 08:56:09 testlinux testde[13205]: get definition directory
Jan 03 08:56:09 testlinux testde[13205]: Definition directory: /etc/tm7/Customers
Jan 03 08:56:09 testlinux testde[13205]: ******* tm7 Start dataextractor_main version developer Logging in /var/log/collector using /etc/tm7/Customers/generic/logger.ini
Jan 03 08:56:09 testlinux testde[13205]: Traceback (most recent call last):
Jan 03 08:56:09 testlinux testde[13205]: File "src/main.py", line 72, in <module>
Jan 03 08:56:09 testlinux testde[13205]: main()
Jan 03 08:56:09 testlinux testde[13205]: File "src/main.py", line 64, in main
Jan 03 08:56:09 testlinux testde[13205]: setup_loggers('main')
Jan 03 08:56:09 testlinux testde[13205]: File "/opt/tm7/dataextractor/src/utils/SetUpLog.py", line 94, in setup_loggers
Jan 03 08:56:09 testlinux testde[13205]: fileConfig(logconf, defaults=None, disable_existing_loggers=False)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/config.py", line 84, in fileConfig
Jan 03 08:56:09 testlinux testde[13205]: handlers = _install_handlers(cp, formatters)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/config.py", line 148, in _install_handlers
Jan 03 08:56:09 testlinux testde[13205]: h = klass(*args)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/handlers.py", line 150, in __init__
Jan 03 08:56:09 testlinux testde[13205]: BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/handlers.py", line 57, in __init__
Jan 03 08:56:09 testlinux testde[13205]: logging.FileHandler.__init__(self, filename, mode, encoding, delay)
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/__init__.py", line 1032, in __init__
Jan 03 08:56:09 testlinux testde[13205]: StreamHandler.__init__(self, self._open())
Jan 03 08:56:09 testlinux testde[13205]: File "/usr/lib/python3.6/logging/__init__.py", line 1061, in _open
Jan 03 08:56:09 testlinux testde[13205]: return open(self.baseFilename, self.mode, encoding=self.encoding)
Jan 03 08:56:09 testlinux testde[13205]: PermissionError: [Errno 13] Permission denied: '/var/log/collector/collector-main.log'
Jan 03 08:56:09 testlinux systemd[1]: testde.service: Control process exited, code=exited status=1
Jan 03 08:56:09 testlinux systemd[1]: testde.service: Failed with result 'exit-code'.
Jan 03 08:56:09 testlinux systemd[1]: Failed to start LSB: DataExtractor.
-- Subject: Unit testde.service has failed
-- Defined-By: systemd
--
python-3.x ubuntu
python-3.x ubuntu
asked Jan 3 at 9:14


Dick KniepDick Kniep
30418
30418
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I 'll answer my own question.
Reading well is an underestimated virtue......
It tries to write to /var/log/collector, while all my effort has been directed to /var/log/tm7/collector.
Hope you didn't waste too much time on this useless question......
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54019258%2fpermission-error-on-logdirectory-in-ubuntu-18-10%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I 'll answer my own question.
Reading well is an underestimated virtue......
It tries to write to /var/log/collector, while all my effort has been directed to /var/log/tm7/collector.
Hope you didn't waste too much time on this useless question......
add a comment |
I 'll answer my own question.
Reading well is an underestimated virtue......
It tries to write to /var/log/collector, while all my effort has been directed to /var/log/tm7/collector.
Hope you didn't waste too much time on this useless question......
add a comment |
I 'll answer my own question.
Reading well is an underestimated virtue......
It tries to write to /var/log/collector, while all my effort has been directed to /var/log/tm7/collector.
Hope you didn't waste too much time on this useless question......
I 'll answer my own question.
Reading well is an underestimated virtue......
It tries to write to /var/log/collector, while all my effort has been directed to /var/log/tm7/collector.
Hope you didn't waste too much time on this useless question......
answered Jan 7 at 10:38


Dick KniepDick Kniep
30418
30418
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54019258%2fpermission-error-on-logdirectory-in-ubuntu-18-10%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
TSUC,oQxl2 hF,LH4ugplnGP2uGpwt7 7YFO8c9Q1AHEMFba,REPEKCL6c,n2bjp3l1dwDVcvSxtHM2rhGtReiw DV ulI53JG