diff --git a/cccli/command/account.py b/cccli/command/account.py
index 0734ea8f3bd8b0d9eb4221c91131f362dea1b73b..a95249d0742539668ca0f34344e96580c372d5fd 100644
--- a/cccli/command/account.py
+++ b/cccli/command/account.py
@@ -8,7 +8,7 @@ CloudControl accounts related commands
 from cccli.exception import *
 from sjrpc.core.exceptions import *
 from cccli.printer import Printer, color
-from cccli.command.command import Command, OptionCommand, TqlCommand
+from cccli.command.command import OptionCommand, TqlCommand
 
 class Command_addaccount(OptionCommand):
     '''Create an account'''
@@ -56,29 +56,36 @@ class Command_declose(TqlCommand):
         self.rpccall("declose", self.args[0])
 
 
-class Command_passwd(Command):
+class Command_passwd(TqlCommand):
     '''Change account password'''
 
+    def __init__(self, cli, argv0):
+        TqlCommand.__init__(self, cli, argv0)
+        self.set_usage("%prog [options] [tql] [password]")
+
     def __call__(self, argv):
-        if len(argv) == 1:
-            argv.append("a=%s"%self.cli.settings["login"])
-        if len(argv) == 2:
-            a = self.printer.getpass("Password: ")
-            b = self.printer.getpass("Again: ")
-            if a != b:
-                raise cmdError("You don't type twice the same password. Aborted")
-            argv.append(a)
-        elif len(argv) == 3:
-            if self.cli.interactive:
-                s = "You cannot set password with clear argument in interactive mode.\n"
-                s += "*** Think to clean your history! ***"
-                raise cmdError(s)
+        # parse args
+        self.parse_args(argv)
+        _tql = None
+        _pass = None
+        if len(self.args) == 0:
+            _tql = "a=%s"%self.cli.settings["login"]
+        elif len(self.args) == 1:
+            _tql = self.args[0]
+        elif len(self.args) == 2:
+            _tql = self.args[0]
+            _pass = self.args[1]
+            _check = self.args[1]
+            if self.printer.isinteractive():
+                self.printer.warn("Removing last line from history")
+                self.printer.history.removelast()
         else:
             raise cmdBadArgument()
-        try:
-            self.cli.rpc.call("passwd", argv[1], argv[2])
-        except RpcError as e:
-            raise cmdError("RPCError: %s"%str(e))
-
-    def usage(self):
-        return "Usage: passwd [tql] [password]"
+        # get password
+        if _pass is None:
+            _pass = self.printer.getpass("Password: ")
+            _check = self.printer.getpass("Again: ")
+        if _pass != _check:
+            raise cmdError("You don't type twice the same password. Aborted")
+        # execute command
+        self.rpccall("passwd", _tql, _pass)
diff --git a/cccli/printer.py b/cccli/printer.py
index cdac2f8e0fac4ce9ede291d81b0a4503950ba166..bc0a4aab4c3de996cbc924b715456380ad0b96f7 100644
--- a/cccli/printer.py
+++ b/cccli/printer.py
@@ -100,6 +100,9 @@ class Printer(object):
         if cccli.debug:
             self.out("%s%s%s"%(color["lgrey"],message,color["reset"]), fd, nl)
 
+    def isinteractive(self):
+        return self.readline is not None
+
     def interactive(self, message, fd=sys.stderr, nl=os.linesep):
         '''Print only in interactive mode'''
         if self.readline is not None: