I have a python program I want to run when a specific user logs into my Ubuntu Server. Previously, I tried to do this via the command useradd -m -s /var/jumpbox/jumpbox.py jumpbox. This ran the program, but it didn't work the same way it did when I call it via ./jumpbox.py from the /var/jumpbox directory. The problem is, this is a curses menu and when an option is selected, another .py file is called to run. Using the useradd method to run jumpbox.py, my menu was the part the worked, but it never called my other .py files when an option was selected. What is the best way to go about running my /var/jumpbox/jumpbox.py file is run when the jumpbox user (and only this user) logs into the server?
It was the path of the .py file being called inside jumpbox.py. I was referencing it only as the filename, without the full path, since it was in the same directory. os.system("python <full path>.py") made it work perfectly.
Thanks @Hannu
Ubuntu Server Run Script at Login for Specific User