Server OpenSSH
Indietro
Avanti

Server OpenSSH

Introduzione

Questa sezione della guida presenta una potente collezione di strumenti per il controllo remoto di computer in rete e per il trasferimento di dati tra i medesimi, chiamata OpenSSH. Vengono anche indicate alcune delle possibili impostazioni di configurazione e come cambiarle su sistemi Ubuntu.

OpenSSH is a freely available version of the Secure Shell (SSH) protocol family of tools for remotely controlling a computer or transferring files between computers. Traditional tools used to accomplish these functions, such as telnet or rcp, are insecure and transmit the user's password in cleartext when used. OpenSSH provides a server daemon and client tools to facilitate secure, encrypted remote control and file transfer operations, effectively replacing the legacy tools.

The OpenSSH server component, sshd, listens continuously for client connections from any of the client tools. When a connection request occurs, sshd sets up the correct connection depending on the type of client tool connecting. For example, if the remote computer is connecting with the ssh client application, the OpenSSH server sets up a remote control session after authentication. If a remote user connects to an OpenSSH server with scp, the OpenSSH server daemon initiates a secure copy of files between the server and client after authentication. OpenSSH can use many authentication methods, including plain password, public key, and Kerberos tickets.

Installazione

Installation of the OpenSSH client and server applications is simple. To install the OpenSSH client applications on your Ubuntu system, use this command at a terminal prompt:

sudo apt-get install openssh-client

To install the OpenSSH server application, and related support files, use this command at a terminal prompt:

sudo apt-get install openssh-server

Configurazione

You may configure the default behavior of the OpenSSH server application, sshd, by editing the file /etc/ssh/sshd_config. For information about the configuration directives used in this file, you may view the appropriate manual page with the following command, issued at a terminal prompt:

man sshd_config

There are many directives in the sshd configuration file controlling such things as communications settings and authentication modes. The following are examples of configuration directives that can be changed by editing the /etc/ssh/ssh_config file.

Suggerimento

Prior to editing the configuration file, you should make a copy of the original file and protect it from writing so you will have the original settings as a reference and to reuse as necessary.

Copy the /etc/ssh/sshd_config file and protect it from writing with the following commands, issued at a terminal prompt:

sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original
sudo chmod a-w /etc/ssh/sshd_config.original

Quelli che seguono sono esempi delle istruzioni di configurazione che possono essere modificate:

  • Per far ascoltare OpenSSh alla porta TCP 2222 invece della porta TCP 22, modificare le istruzioni relative alla porta come segue:

    Porta 2222

  • Affinchè l'applicazione sshd permetta il login basato su cifratutra a chiave pubblica, basta modificare o aggiungere la linea:

    PubkeyAuthentication yes

    nel file /etc/ssh/sshd_config. Se la stringa è già presente nel file, verificare che non sia disattivata.

  • Affinchè il server OpenSSH mostri il contenuto del file /etc/issue.net come un banner di pre-login, basta aggiungere o modificare la linea:

    Banner /etc/issue.net

    in the /etc/ssh/sshd_config file.

After making changes to the /etc/ssh/sshd_config file, save the file, and restart the sshd server application to effect the changes using the following command at a terminal prompt:

sudo /etc/init.d/ssh restart

Avvertimento

Per soddisfare le esigenze dell'utente, sono disponibili molte altre istruzioni di configurazione per modificare il comportamento dell'applicazione sshd. Se l'unico metodo per accedere al server è mediante l'applicazione ssh è necessario prestare molta attenzione alla configurazione di sshd. Delle impostazioni non corrette nel file /etc/ssh/sshd_config possono precludere l'accesso al server dopo il suo riavvio, oppure impedire il suo funzionamento. In sintesi, è necessaria molta attenzione nella modifica del file /etc/ssh/sshd_config.

Riferimenti

OpenSSH Website

Advanced OpenSSH Wiki Page

Indietro
Avanti
Partenza