diff options
| author | Jerome Martin <jxm@risingtidesystems.com> | 2011-05-11 16:18:32 +0200 |
|---|---|---|
| committer | Jerome Martin <jxm@risingtidesystems.com> | 2011-05-11 16:29:57 +0200 |
| commit | 947874bdaeeb5430b2d31fb6f734f339cd23a1b5 (patch) | |
| tree | 5a5320aaef076c659f4348a9278fb0bbb4ed2137 /scripts | |
| parent | 063b214dd87b3fd89ff820a42b173ee961a14a24 (diff) | |
| download | targetcli-947874bdaeeb5430b2d31fb6f734f339cd23a1b5.tar.gz | |
Disable privileged commands if user is not root.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/rtsadmin | 12 |
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() |
