theshell.ch/site/pages/cmd/interm/ssh.html
bevilj 5270dfef3a bonus2: add support for more special chars and fix syntax of parsed files
git-svn-id: svn+ssh://atelier.inf.usi.ch/home/bevilj/group-1@250 a672b425-5310-4d7a-af5c-997e18724b81
2018-11-18 17:39:51 +00:00

63 lines
1.6 KiB
HTML

---
layout: page
category-page: intermediate
category-title: Intermediate commands
tags: remote connection host server file
author: Announ Marwan
title: ssh
---
The <code>ssh</code> command is used to operate with a remote machine using
the <i>ssh</i> protocol. It's commonly used for logging into a remote
machine and execute commands from a terminal interface.
<h3>Log into a server</h3>
To log in a remote server you need an user account which is
usually created by the server admin and a password.
<pre>
localhost:[~]&gt; ssh username@remote-server
remote-server:[~]&gt;
</pre>
Once you're logged in, the local machine shell will be
<i>replaced</i> by the remote server's one.<br>
<h3>Log out of a server</h3>
<ul>
<li>Press <code>⌘ + D</code></li>
<li>Run the command <code>logout</code></li>
<li>Run the command <code>exit</code></li>
</ul>
<h3>Run a command on a remote machine</h3>
<pre>
localhost:[~]:&gt; ssh user@remote-host "ls test"
online-backup.dat
online-storage
unix-dedicated-server.txt
</pre>
<h3>Debug the client</h3>
Debugging the ssh client can be useful to resolve connection errors.
<pre>
localhost:[~]:&gt; 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
...
</pre>