diff --git a/markdownrunner.py b/markdownrunner.py index ea81569..88ab338 100755 --- a/markdownrunner.py +++ b/markdownrunner.py @@ -16,6 +16,7 @@ from typing import * host: str directory: str = None +default_user = 'root' def main(): if len(sys.argv) < 3: @@ -178,6 +179,9 @@ def run_command(cmd: Command): remote_command = cmd.command if cmd.user is not None: local_command.extend(['-l', cmd.user]) + else: + global default_user + local_command.extend(['-l', default_user]) local_command.append(host) # SSH seems to honor the first specified parameter. This allows to have username as a part of the hostname, yet still be able to honor the sudo-s in the sinppets. if cmd.directory is not None: remote_command = f'cd {cmd.directory}; {remote_command}'