--- layout: page category-page: intermediate category-title: Intermediate commands tags: remote connection host server file author: Announ Marwan title: ssh --- The ssh command is used to operate with a remote machine using the ssh protocol. It's commonly used for logging into a remote machine and execute commands from a terminal interface.

Log into a server

To log in a remote server you need an user account which is usually created by the server admin and a password.
localhost:[~]> ssh username@remote-server
remote-server:[~]>
Once you're logged in, the local machine shell will be replaced by the remote server's one.

Log out of a server

Run a command on a remote machine

localhost:[~]:> ssh user@remote-host "ls test"
    online-backup.dat
    online-storage
    unix-dedicated-server.txt

Debug the client

Debugging the ssh client can be useful to resolve connection errors.
localhost:[~]:> ssh -v user@remote-host
    OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: Applying options for *
    debug1: Connecting to remote-host [172.22.200.140] port 22.
    debug1: Connection established.
    debug1: identity file /home/user/.ssh/identity type -1
    debug1: identity file /home/user/.ssh/id_rsa type -1
    debug1: identity file /home/user/.ssh/id_dsa type 2
    debug1: loaded 3 keys
    ...