Skip to content
Snippets Groups Projects
Commit 927e666c authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

nvmetcli: print a useful warning when not called as root user


Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 72b210d0
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,9 @@ License for the specific language governing permissions and limitations ...@@ -18,6 +18,9 @@ License for the specific language governing permissions and limitations
under the License. under the License.
''' '''
from __future__ import print_function
import os
import sys import sys
import configshell_fb as configshell import configshell_fb as configshell
import nvmet.nvme as nvme import nvmet.nvme as nvme
...@@ -215,6 +218,10 @@ funcs = dict(save=save, restore=restore, clear=clear) ...@@ -215,6 +218,10 @@ funcs = dict(save=save, restore=restore, clear=clear)
def main(): def main():
if os.geteuid() != 0:
print("%s: must run as root." % sys.argv[0], file=sys.stderr)
sys.exit(-1)
if len(sys.argv) > 3: if len(sys.argv) > 3:
usage() usage()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment