summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJerome Martin <jxm@risingtidesystems.com>2011-05-11 16:18:32 +0200
committerJerome Martin <jxm@risingtidesystems.com>2011-05-11 16:29:57 +0200
commit947874bdaeeb5430b2d31fb6f734f339cd23a1b5 (patch)
tree5a5320aaef076c659f4348a9278fb0bbb4ed2137 /scripts
parent063b214dd87b3fd89ff820a42b173ee961a14a24 (diff)
downloadtargetcli-947874bdaeeb5430b2d31fb6f734f339cd23a1b5.tar.gz
Disable privileged commands if user is not root.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/rtsadmin12
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/rtsadmin b/scripts/rtsadmin
index 422224d..a365b94 100755
--- a/scripts/rtsadmin
+++ b/scripts/rtsadmin
@@ -20,6 +20,7 @@ Copyright (c) 2011 by RisingTide Systems LLC.
All rights reserved.
'''
+from os import getuid
from rtsadmin import UIRoot
from configshell import ConfigShell
@@ -45,14 +46,21 @@ def main():
'''
Start the rtsadmin shell.
'''
- root_node = UIRoot()
- shell = RTSAdmin(root_node, '~/.rtsadmin')
+ if getuid() == 0:
+ is_root = True
+ else:
+ is_root = False
+ root_node = UIRoot(as_root=is_root)
+ shell = RTSAdmin(root_node, '~/.rtsadmin')
shell.con.epy_write('Welcome to the B{RTSAdmin Community Edition} CLI.')
shell.con.display('')
shell.con.epy_write('Copyright (c) 2011 by RisingTide Systems LLC.')
shell.con.epy_write('Visit us at U{http://www.risingtidesystems.com}.')
shell.con.display('')
+ if not is_root:
+ shell.con.display('You are not root, disabling privileged commands.')
+ shell.con.display('')
root_node.refresh()
shell.run_interactive()