summaryrefslogtreecommitdiff
path: root/python/vyos/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos/util.py')
-rw-r--r--python/vyos/util.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py
index 9ca229136..000b13025 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -24,7 +24,7 @@ from subprocess import DEVNULL
def debug(flag):
"""
- Check is a debug flag was set by the user.
+ Check is a debug flag was set by the user.
a flag can be set by touching the file /tmp/vyos.flag.debug
with flag being the flag name, the current flags are:
- developer: the code will drop into PBD on un-handled exception
@@ -196,6 +196,16 @@ def chown(path, user, group):
gid = getgrnam(group).gr_gid
os.chown(path, uid, gid)
+
+def chmod_600(path):
+ """ make file only read/writable by owner """
+ from stat import S_IRUSR, S_IWUSR
+
+ if os.path.exists(path):
+ bitmask = S_IRUSR | S_IWUSR
+ os.chmod(path, bitmask)
+
+
def chmod_750(path):
""" make file/directory only executable to user and group """
from stat import S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IXGRP
@@ -205,8 +215,8 @@ def chmod_750(path):
os.chmod(path, bitmask)
-def chmod_x(path):
- """ make file executable """
+def chmod_755(path):
+ """ make file executable by all """
from stat import S_IRUSR, S_IWUSR, S_IXUSR, S_IRGRP, S_IXGRP, S_IROTH, S_IXOTH
if os.path.exists(path):