I can ssh from my pc using putty, 1 line like so
ssh email@example.com -pw abc123
but when I try this from OSX terminal, I get an error
Bad port 'w'
How can make this work on OSX?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
ssh does not support passing a password on the command line, it is interpreting the
-pw as "Connect to port w".
In order to do automated logins via ssh, use
ssh_keygen. If you accept the default filenames, your ssh client will automatically try this key when it connects.
.ssh/authorized_keyson the destination host (eg
If your heart is set on passwords via the commandline, the
expect toolset can be used to interact with STDIN/STDOUT on running commands.
What you're trying to do is impossible with the built-in SSH client in OS X. The OpenSSH client is incapable of accepting a password from the command line.
The reason you're getting the "Bad port" error is because the
-p flag is used to specify the port to connect to and the
-pw flag does not exist. See the man page for more details.
Additionally, it's almost always a bad idea to specify a password from the command line. Have you looked into using public key authentication?