ssh in the question does not ask for password (the only prompt is from remote sudo), so most likely the OP has already set up authentication with a key. It seems he or she is happy having "sudo …" as a part of local command; using authorized_keys to force the remote command may be useful here, but it's not what the OP asked for. He or she wants to send the content of local password.txt to the remote sudoautomatically and to get a fully functional remote interactive shell. This is what they struggle with. For now I cannot see how this answer solves the problem. What am I missing?