0

When I am login as a user (lets say: John) to may linux (Ubuntu 18), I run the command:

crontab -e

I then entered a simple command:

python pythonFile.py

I was expecting the job to run under user "John" but insted, when running:

ps -ef|grep pythonFile

I see the job running under root. I can't understand why.

Thanks for any help.

4
  • try crontab -e -u <username> (as root) - I couldn't tell you why it's doing that though - unless it's specific to Ubuntu, or python wants to run as root (?)
    – Smock
    Dec 18, 2019 at 17:18
  • @Smock Thanks, But it open the same crontabthat I get with crontab -e and the python script is there but still in the process list it run with root privilege and not the user John
    – ZoRo
    Dec 18, 2019 at 17:23
  • try crontab -l -u <username> (as root) - see if it is definitely in the user crontab and just running as root for some reason. If you run it manually, does it run as your user or root?
    – Smock
    Dec 18, 2019 at 17:23
  • @Smock, Strange, I checked and its in the user cron tab. Still it seems it is running under root BUT I think that the commands in the python are executed as the User. This is really strange but since I don't know exactly how to explain this, I think I will leave it for now until I will have more data on the problem. Thank for your reply.
    – ZoRo
    Dec 19, 2019 at 9:42

0

You must log in to answer this question.

Browse other questions tagged .