Forums

Run command as superuser?

Hello! I am building an application that will call a Python file in the command line (like "file.py -args"). But, when running the command, I get the following output: bash/usr/bin 1: /home/skolmataspurangen/credentials.py: Permission denied I get the same error in the terminal. I am using subprocess and "shell=True" in my script.

This error has also occurred when I am trying to write something to a regular text file. So, what I basically would like to know, (because sudo doesn´t work), is, how to run a command (preferably a task) as superuser?

See this

Sorry, but with chmod 700, which should give me access to everything, I still get PermissionError: [Errno 13] Permission denied: '/home/skolmataspurangen\dagensmat.txt', after entering "chmod 700 dagensmat.txt".

oh- are you sure you have the correct path? (eg: in your post there is a \ that should be a /)

and what are you running this .txt file as? a python script?

The Python file that I run opens my script using open() and os.path.join().

But your solution fixed it, so thanks a lot!