Every time I try to SSH I forget how to do it.
That's why I decided to take notes with this post.
What I want to achieve
- connect a server on a certain port using SSH.
- username and password are given.
Ask man
Just run the command in the terminal.
$ man ssh
The output is here;
NAME
ssh – OpenSSH remote login client
SYNOPSIS
ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] [-b bind_address] [-c cipher_spec] [-D [bind_address:]port] [-E log_file] [-e escape_char]
[-F configfile] [-I pkcs11] [-i identity_file] [-J destination] [-L address] [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option]
[-P tag] [-p port] [-Q query_option] [-R address] [-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]] destination
[command [argument ...]]
This is not enough to specify the username.
To log in with a particular username the command would be this;
$ ssh username@hostname
There it is!
Connect a server using SSH
Input the following command in the terminal.
$ ssh -p port username@hostname
The connection would be established after entering the password as the prompt asks.
Top comments (0)