diff --git a/docs/en/SUMMARY.md b/docs/en/SUMMARY.md index e892888ca..edf3014fb 100644 --- a/docs/en/SUMMARY.md +++ b/docs/en/SUMMARY.md @@ -18,6 +18,7 @@ * [Development Mail Server](getting_started/dev_mailserver.md) * [Production and Staging servers](getting_started/servers.md) * [Digital Ocean](getting_started/digital_ocean.md) + * [Create a deploy user](getting_started/create_deploy_user.md) * [Generating SSH Key](getting_started/generating_ssh_key.md) * [Heroku](getting_started/deploying-on-heroku.md) * [Docker](getting_started/docker.md) diff --git a/docs/en/getting_started/create_deploy_user.md b/docs/en/getting_started/create_deploy_user.md new file mode 100644 index 000000000..2f079273f --- /dev/null +++ b/docs/en/getting_started/create_deploy_user.md @@ -0,0 +1,78 @@ +# Create a deploy user + +[The installer](https://github.com/consul/installer) by default connects as the `root` user only to create a `deploy` user. This `deploy` user is the one who installs all libraries. If you do not have `root` access, please ask your system administrator to follow these instructions to create a user manually. + +You could create a user called `deploy` or any other name. As as example, we are going to create a user named `jupiter`. + + ``` + adduser jupiter + ``` + +I'm using jupiter as the user name, you should change that for whatever makes sense to you. Input a password when prompted, and just leave empty the rest of the options. + +Let's create a `wheel` group and add the user `jupiter` to this group. + + ``` + sudo groupadd wheel + sudo usermod -a -G wheel jupiter + ``` + +Now let's give sudo privileges to the `wheel` group and allow it to not use a password, this is important so that the installer doesn't get stalled waiting for a password. + +First we open the sudoers file: +``` +sudo visudo -f /etc/sudoers +``` + +And we add this line at the end: +``` +%wheel ALL=(ALL) NOPASSWD: ALL +``` + +Now we need to give the keys of the server to the new user. Don’t close the server terminal window, because you can lock yourself out of your server if there is a mistake. + +Let's create the necessary directory in the server to upload the public key: +``` +su jupiter +cd ~ +mkdir .ssh +cd .ssh +nano authorized_keys +``` + + +Make sure you have [generated a public key](generating_ssh_key.md) in your local terminal. + +Open another local terminal window (not in the server) and type: + +``` +cat ~/.ssh/id_rsa.pub +``` + +Copy the content of your public key to the file authorized_keys that should still be open in the server. + +Test that your user can log in by typing: + + ``` + ssh jupiter@your-copied-ip-address + ``` + +You should see the server welcome page and a prompt like this: + + ``` + jupiter@consulserver:~$ + ``` + +Note the username at the prompt is not "root", but your username. So everything is fine and we can now block the root account from outside access and also stop allowing password access so only people with SSH keys can log in. + +Type the following command to edit the SSH config file of the server: + + ``` + sudo nano /etc/ssh/sshd_config + ``` + +Look for the "PasswordAuthentication yes" line and change it to "PasswordAuthentication no". Type Control-K to close the nano editor and type: + + ``` + sudo service ssh restart + ``` diff --git a/docs/es/SUMMARY.md b/docs/es/SUMMARY.md index bd5a3585d..112f631bd 100644 --- a/docs/es/SUMMARY.md +++ b/docs/es/SUMMARY.md @@ -18,6 +18,7 @@ * [Servidor local de correo](getting_started/dev_mailserver.md) * [Servidores de prueba y producción](getting_started/servers.md) * [Digital Ocean](getting_started/digital_ocean.md) + * [Crear usuario](getting_started/create_deploy_user.md) * [Generación de claves SSH](getting_started/generating_ssh_key.md) * [Heroku](getting_started/deploying-on-heroku.md) * [Docker](getting_started/docker.md) diff --git a/docs/es/getting_started/create_deploy_user.md b/docs/es/getting_started/create_deploy_user.md new file mode 100644 index 000000000..6abaa5165 --- /dev/null +++ b/docs/es/getting_started/create_deploy_user.md @@ -0,0 +1,79 @@ +# Crear un usuario para hacer la instalación + +[El instalador](https://github.com/consul/installer) de forma predeterminada se conecta como el usuario `root` sólo para crear un usuario` deploy`. Este usuario `deploy` es el que instala todas las librerías. Si no tiene acceso `root`, por favor pídale a su administrador de sistemas que siga estas instrucciones para crear un usuario manualmente. + +Puede crear un usuario llamado `deploy` o utilizar cualquier otro nombre. Como ejemplo, vamos a crear un usuario llamado `jupiter`. + + ``` + adduser jupiter + ``` + +Estoy usando jupiter como nombre de usuario, debería cambiar eso por lo que sea que tenga sentido para usted. Introduzca una contraseña cuando se le pida y deje vacías el resto de las opciones. + +Creemos un grupo `wheel` y añadamos al usuario `jupiter` al grupo. + + ``` + sudo groupadd wheel + sudo usermod -a -G wheel jupiter + ``` + +**Recuerde cambiar jupiter** por cualquier nombre de usuario que haya elegido en el paso anterior. + +Ahora démosle al grupo `wheel` derechos de superadministración sin necesidad de usar contraseña, esto es importante para que el instalador no se quede parado esperando una contraseña. + +Primero debemos abrir el archivo `sudoers`: +``` +sudo visudo -f /etc/sudoers +``` + +Y añadimos esta línea al final del archivo: +``` +%wheel ALL=(ALL) NOPASSWD: ALL +``` + +Ahora tenemos que dar las claves del servidor al nuevo usuario. No cierre la ventana de la terminal del servidor, porque puede bloquearse si hay un error. + +Y escriba los siguientes comandos para crear el archivo necesario donde subir la clave pública: +``` +su jupiter +cd ~ +mkdir .ssh +cd .ssh +nano authorized_keys +``` + +Asegúrese que ha [generado una clave pública](generating_ssh_key.md) en su terminal local. + +Abra otra ventana de terminal local (no en el servidor) y escriba: + +``` +cat ~/.ssh/id_rsa.pub +``` + +Copie el contenido de ese comando al archivo `authorized_keys` que debería seguir abierto en el servidor. + +Compruebe que su usuario puede iniciar sesión escribiendo: + + ``` + ssh jupiter@your-copied-ip-address + ``` + +Debería ver la página de bienvenida del servidor y un mensaje como este: + + ``` + jupiter@consulserver:~$ + ``` + +Note que el nombre de usuario en el prompt no es "root", sino su nombre de usuario. Así que todo está bien y ahora podemos bloquear la cuenta root del acceso externo y también dejar de permitir el acceso con contraseña para que sólo las personas con claves SSH puedan iniciar sesión. + +Escriba el siguiente comando para editar el archivo de configuración SSH del servidor: + + ``` + sudo nano /etc/ssh/sshd_config + ``` + +Busque la línea "PasswordAuthentication yes" y cámbiela por "PasswordAuthentication no". Escriba Control-K para cerrar el editor nano y escriba: + + ``` + sudo service ssh restart + ```