Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en:connexion_serveur_admin [2017/01/02 18:48] – created Domperss | en:connexion_serveur_admin [2021/12/03 18:19] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| <WRAP center round important 60%> | <WRAP center round important 60%> | ||
| The manipulation here concerns a console connection from a Linux machine. | The manipulation here concerns a console connection from a Linux machine. | ||
| - | </ WRAP> | + | </ |
| The advantage of connecting to a server using a public key is that you can forget the basic passwords of the servers, there is only one to remember: **yours**. This is very useful if you have several servers to administer, or if they have passwords to extend and impossible to remember. | The advantage of connecting to a server using a public key is that you can forget the basic passwords of the servers, there is only one to remember: **yours**. This is very useful if you have several servers to administer, or if they have passwords to extend and impossible to remember. | ||
| Line 10: | Line 10: | ||
| ===== Generating the key ===== | ===== Generating the key ===== | ||
| **Open a console and generate a pair of keys by typing:** | **Open a console and generate a pair of keys by typing:** | ||
| - | < | + | |
| You should have the following text displayed: | You should have the following text displayed: | ||
| Line 20: | Line 20: | ||
| Your public key has been saved in / | Your public key has been saved in / | ||
| - | A public/ | + | A public/ |
| **Copy the key to the remote server account** | **Copy the key to the remote server account** | ||
| - | < | + | |
| Replace '' | Replace '' | ||
| And now, it's all good! You can connect to the server via ssh with your key: | And now, it's all good! You can connect to the server via ssh with your key: | ||
| - | < | + | ssh yyy@xxxxx.org |
| or | or | ||
| - | < | + | ssh root@myserver.org |
| On the server, go to the .ssh folder of /home/user and | On the server, go to the .ssh folder of /home/user and | ||
| + | < | ||
| A line must end with your username and the name of your machine, these are the public keys allowed to connect. | A line must end with your username and the name of your machine, these are the public keys allowed to connect. | ||
| Line 40: | Line 41: | ||
| It is possible to automatically indicate to SSH to use this or that key according to the site to which one connects. | It is possible to automatically indicate to SSH to use this or that key according to the site to which one connects. | ||
| - | Suppose we have generated two RSA keys as described above. Simply specify a different name for the question "/ | + | Suppose we have generated two RSA keys as described above. Simply specify a different name for the question "/ |
| - | * cle1 pour aller sur le serveur | + | * Cle1 goes to server |
| - | * cle2 pour aller sur le serveur | + | * Cle2 goes to server |
| - | Il faut alors créer un fichier | + | It is necessary to create the file '' |
| - | <code txt config> | + | <code> |
| - | host serveur1 | + | <txt config> |
| - | HostName | + | host server1 |
| + | HostName | ||
| IdentityFile ~/.ssh/cle1 | IdentityFile ~/.ssh/cle1 | ||
| User totor | User totor | ||
| | | ||
| - | host serveur2 | + | host server2 |
| HostName 202.127.12.13 | HostName 202.127.12.13 | ||
| IdentityFile ~/.ssh/cle2 | IdentityFile ~/.ssh/cle2 | ||
| Line 59: | Line 61: | ||
| </ | </ | ||
| - | Ensuite quand on se connectera avec SSH, le système saura que pour aller sur serveur1.fr, il faut qu'il utilise la clef ~/ | + | Then when you connect with SSH, the system will know to go to " |
| - | Par exemple | + | For example |
| - | Accès au serveur 1 qui a un port standard : | + | Access to server1 that has a standard |
| <code bash> | <code bash> | ||
| ~$ ssh serveur1.fr | ~$ ssh serveur1.fr | ||
| </ | </ | ||
| - | Accès au serveur | + | Access to server |
| <code bash> | <code bash> | ||
| ~$ ssh -p 66666 202.127.12.13 | ~$ ssh -p 66666 202.127.12.13 | ||
| </ | </ | ||
| - | ===== Se connecter sans mot de passe (méthode non sécurisée) ===== | + | ===== Log in without password(insecure method) ===== |
| - | < | + | < |
| - | Se connecter sans mot de passe ouvre potentiellement une faille de sécurité. À réserver à des cas très particuliers | + | Logging in without a password potentially opens up a security vulnerability. To be reserved for very special cases! |
| </ | </ | ||
| - | Un de ces cas est la possibilité pour un serveur | + | One of these cases is the possibility for a server(A) to connect to a server(B) for data backup for example. Server(A) itself must then be __well protected__. |
| - | Il suffit de créer une clé sur le serveur | + | It is enough to create a key on the server(A), as indicated above in: ('' |
| - | Ensuite on ajoute cette clé sur le serveur | + | Then we add this key to server(B) ('' |
| - | Comme les fichiers | + | As the "id_rsa" and "id_rsa.pub" files can easily be copied from one computer to another, one can secure a little more by making sure that the server(B) only accepts the key of the server(A) if this key is used from the IP address of server(A). |
| - | Il faut alors ajouter | + | It is necessary to add " |
| - | Exemple | + | Example: |
| - | from=" | + | |
| - | ===== Se connecter sans retaper trop souvent son mot de passe (méthode sécurisée) ===== | + | ===== Log in without too often retyping your password(secure method) ===== |
| - | Il suffit d' | + | Just use an "ssh agent" |
| - | | + | |
| ssh-add ~/ | ssh-add ~/ | ||
| - | ===== Pour aller plus loin ===== | + | ===== To go further |
| - | * [[http:// | + | * [[http:// |
| - | {{tag> | + | {{tag> |





