Ssh fails due to argument position.

I have a constraint to follow organization policy. So i do not have much liberty.

ssh -i /opt/nonprod user1@hostone -t bash works while ssh -i /opt/nonprod -t bash user1@hostone fails

How can I get this to work when I am enforced to put -t bash before the user@hostname ?

Will share debug output as required.

Please Help !

You can't. The policy is wrong.

You can move the -t (which has nothing to do with the bash bit), but not the bash.

I cannot move it as there is a third party tool that constructs the ssh which I have no crontrol over.

Cant we get -t bash before user@host to work ?

SSH(1)                  Gentoo General Commands Manual                  SSH(1)

NAME
     ssh - OpenSSH SSH client (remote login program)

SYNOPSIS
     ssh [-1246AaCfgKkMNnqsTtVvXxYyz] [-b bind_address] [-c cipher_spec]
         [-D [bind_address:]port] [-E log_file] [-e escape_char]
         [-F configfile] [-I pkcs11] [-i identity_file]
         [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
         [-O ctl_cmd] [-o option] [-p port]
         [-Q cipher | cipher-auth | mac | kex | key]
         [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
         [-w local_tun[:remote_tun]] [user@]hostname [command]

You can put -t almost wherever you want, but the command must always be at the end.

Perhaps their policy is meant to prevent you from doing what you are attempting to do - run remote commands via ssh.