Closed ghost closed 5 years ago
It seems that I am not the only having this behavior: https://github.com/Teradata/PyTd/issues/61#issuecomment-265264319
The problem seems to be related to a permission denied on the following file/directory:
/opt/teradata/client/ODBC_64/.runNumber
as the execution with wabuser and root returns the following:
# sudo -u wabuser -g wabuser PYTHONPATH=$PYTHONPATH python -O
Python 2.7.9 (default, Apr 10 2017, 15:10:54)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import teradata
>>> udaExec = teradata.UdaExec(appName="WALLIX Bastion Password Change", version="1.0.0",logConsole=False,odbcLibPath="/opt/teradata/client/ODBC_64/lib/libodbc.so")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/teradata/udaexec.py", line 111, in __init__
self._initRunNumber(runNumberFile, runNumber, logMsgs)
File "/usr/local/lib/python2.7/dist-packages/teradata/udaexec.py", line 321, in _initRunNumber
with open(self.runNumberFile, 'w') as f:
IOError: [Errno 13] Permission denied: '/opt/teradata/client/ODBC_64/.runNumber'
# PYTHONPATH=$PYTHONPATH python -O
Python 2.7.9 (default, Apr 10 2017, 15:10:54)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import teradata
>>> udaExec = teradata.UdaExec(appName="WALLIX Bastion Password Change", version="1.0.0",logConsole=False,odbcLibPath="/opt/teradata/client/ODBC_64/lib/libodbc.so")
I found a solution to my problem.
I need to set logDir and runNumberFile which are by default written in /opt/teradata/client/ODBC_64/
udaExec = teradata.UdaExec(appName="WALLIX Bastion Password Change", version="1.0.0",logConsole=False,odbcLibPath="/home/wabuser/terachg/lib/libodbc.so",runNumberFile="/var/tmp/.runNumber",logDir="/var/tmp/logs")
Hello,
I have an issue regarding loading the driver where the same code works fine with root but not with another user (wabuser) even if the chown/chmod are set correctly.
With root:
With wabuser
I have tried everything mentioned here, from setting env variables, symblink for .so libs.
I had an error regarding our grsec kernel:
grsec: denied untrusted exec (due to not being in trusted group and file in non-root-owned directory) of /opt/teradata/client/16.20/lib64/libodbc.so by /usr/bin/python2.7[python:31551] uid/euid:1001/1001 gid/egid:1001/1001, parent /usr/bin/sudo[sudo:31550] uid/euid:0/0 gid/egid:0/0
but it was solved with chown root:wabuserThe python code portion is as follow:
Any hint will be appreciated.
Thanks