Salt: incron.present failing as non-root user

Created on 14 Apr 2016  路  14Comments  路  Source: saltstack/salt

Description of Issue/Question

incron.present failing as non-root user

Setup

watch ap imports directory:
    incron.present:
        - user: myuser
        - path: /share/wires/incoming/
        - mask:
            - IN_CREATE
            - IN_MOVED_TO
        - cmd: '/usr/local/bin/ap_import_new $@$#'
        - require:
            - file: /etc/incron.allow
            - service: incron

Steps to Reproduce Issue

We recently upgraded from an older version (maybe 2015.5.2). This was working fine before the upgrade.

[INFO    ] Running state [watch ap imports directory] at time 13:52:57.954588
[INFO    ] Executing state incron.present for watch ap imports directory
[INFO    ] Executing command 'incrontab -l -u myuser' as user 'myuser' in directory '/srv/myuser'
[ERROR   ] Command 'incrontab -l -u myuser' failed with return code: 1
[ERROR   ] stderr: cannot override user to 'myuser': insufficient privileges

[ERROR   ] retcode: 1
[DEBUG   ] user data 
[INFO    ] Executing command 'incrontab /tmp/tmp7aAl_7' as user 'myuser' in directory '/srv/myuser'
[ERROR   ] Command 'incrontab /tmp/tmp7aAl_7' failed with return code: 1
[ERROR   ] stderr: copying table from file '/tmp/tmp7aAl_7'
cannot load table from file '/tmp/tmp7aAl_7'
[ERROR   ] retcode: 1
[ERROR   ] Incron watch ap imports directory for user myuser failed to commit with error 
copying table from file '/tmp/tmp7aAl_7'
cannot load table from file '/tmp/tmp7aAl_7'
[INFO    ] Completed state [watch ap imports directory] at time 13:52:58.008641

Versions Report

$ salt-call --versions-report
Salt Version:
           Salt: 2015.8.8.2

Dependency Versions:
         Jinja2: 2.7.2
       M2Crypto: 0.21.1
           Mako: 0.9.1
         PyYAML: 3.10
          PyZMQ: 14.0.1
         Python: 2.7.6 (default, Mar 22 2014, 22:59:56)
           RAET: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.4
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.0
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
        libgit2: Not Installed
        libnacl: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.3.0
   mysql-python: 1.2.3
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
   python-gnupg: Not Installed
          smmap: Not Installed
        timelib: Not Installed

System Versions:
           dist: Ubuntu 14.04 trusty
        machine: x86_64
        release: 3.13.0-46-generic
         system: Ubuntu 14.04 trusty
Bug Confirmed Magnesium Needs Testcase Platform Regression State Module severity-medium

All 14 comments

@ipmb, thanks for reporting.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

Issue still exists.

Thank you for updating this issue. It is no longer marked as stale.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

Issue still exists.

Thank you for updating this issue. It is no longer marked as stale.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

Thank you for updating this issue. It is no longer marked as stale.

[ERROR ] Command '['incrontab', '-l', '-u', 'salt']' failed with return code: 1
[ERROR ] stderr: cannot override user to 'salt': insufficient privileges

Issue still there

@poofyteddy @ipmb is this present in later versions as well?

@sagetherage yes i got it while poking salt 3000.1

Could this line be the cause:

https://github.com/saltstack/salt/blob/de4b70d890d8041dedf242ab2586e27a91115c1d/salt/modules/incron.py#L125

I ran in the same issue with salt 3000.1 on an Armbian system.

I just confirmed my assumption !
Changing the mentioned line to

if user != "root": 

fixed the problem for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mooperd picture mooperd  路  3Comments

golmaal picture golmaal  路  3Comments

icycle77 picture icycle77  路  3Comments

sagetherage picture sagetherage  路  3Comments

qiushics picture qiushics  路  3Comments