Add root check to run as unprivileged user only
This commit is contained in:
parent
ff5b2334b9
commit
28464373b6
@ -9,7 +9,13 @@ import youtube_dl
|
||||
from selenium import webdriver
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from os.path import expanduser
|
||||
|
||||
# if running as root...kick out
|
||||
if os.geteuid()==0:
|
||||
sys.exit("\nPlease run this script as unprivileged user only.\n")
|
||||
|
||||
home = expanduser("~")
|
||||
|
||||
def usage(error=0, msg=None):
|
||||
if msg:
|
||||
@ -20,11 +26,11 @@ def usage(error=0, msg=None):
|
||||
print("\tOptions may be replaced with environment variables. Command line options take precedence.")
|
||||
print("\t\tLADL_USERNAME, LADL_PASSWORD, LADL_DIR, LADL_COOKIES\n")
|
||||
print("Examples:")
|
||||
print("\t$ ./linuxacademy-dl.py -u person@exmple.com -p p@ssw0rd https://linuxacademy.com/cp/modules/view/id/346\n")
|
||||
print("\t$ ./linuxacademy-dl.py -u person@exmple.com -p my_p@ssw0rd https://linuxacademy.com/cp/modules/view/id/388\n")
|
||||
print("\t$ export LADL_USERNAME=person@example.com")
|
||||
print("\t$ export LADL_PASSWORD=p@ssw0rd")
|
||||
print("\t$ export LADL_DIR=/home/jdoe/linux-academy")
|
||||
print("\t$ ./linuxacademy-dl.py https://linuxacademy.com/cp/modules/view/id/346")
|
||||
print("\t$ export LADL_PASSWORD=my_p@ssw0rd")
|
||||
print('\t$ export LADL_DIR=' + str(home) + '/linux-academy-videos')
|
||||
print("\t$ ./linuxacademy-dl.py https://linuxacademy.com/cp/modules/view/id/388")
|
||||
exit(error)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user