-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modificacion a PR0203 y comienzo de PR0204
- Loading branch information
Diego Calles Fernández
committed
Oct 15, 2024
1 parent
5c14e69
commit 7b3595f
Showing
5 changed files
with
268 additions
and
1 deletion.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
...a_Linux_Server/Practicas/UT0203_ConexionSSH_VariosUsuarios/PR0203_DCF_README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
[Volver al indice de la unidad](../../index.md) | ||
|
||
# Conexión SSH en Varios usuarios | ||
|
||
## 1. Preparación MV: | ||
|
||
El **VagrantFile** que vamos a generar tendrá la siguiente configuración: | ||
|
||
```ruby | ||
Vagrant.configure("2") do |config| | ||
config.vm.box = "generic/ubuntu2204" | ||
config.vm.network "public_network", ip: "172.16.0.59", netmask: "255.255.0.0" | ||
config.vm.hostname = "vusersdcf" | ||
config.vm.provider "virtualbox" do |vb| | ||
vb.name = "Conexion SSH varios usuarios" | ||
vb.memory = 3076 | ||
vb.cpus = 2 | ||
end | ||
end | ||
``` | ||
|
||
Como vemos en la configuración le hemos asignado la **public_network** de manera que mis compañero tendrán también una dirección IP en el mismo rango. | ||
|
||
Para comprobar que tenemos conexión entre todos haremos un ping : | ||
|
||
```bash | ||
vagrant@vusersdcf:~$ ping 172.16.0.58 | ||
PING 172.16.0.58 (172.16.0.58) 56(84) bytes of data. | ||
64 bytes from 172.16.0.58: icmp_seq=1 ttl=64 time=6.66 ms | ||
64 bytes from 172.16.0.58: icmp_seq=2 ttl=64 time=2.01 ms | ||
64 bytes from 172.16.0.58: icmp_seq=3 ttl=64 time=2.02 ms | ||
^C | ||
--- 172.16.0.58 ping statistics --- | ||
3 packets transmitted, 3 received, 0% packet loss, time 2002ms | ||
rtt min/avg/max/mdev = 2.011/3.564/6.661/2.189 ms | ||
vagrant@vusersdcf:~$ | ||
``` | ||
|
||
Ahora voy a crear los usuarios para mis compañeros | ||
|
||
```bash | ||
vagrant@vusersdcf:~$ sudo useradd -s /bin/bash david -m | ||
vagrant@vusersdcf:~$ sudo useradd -s /bin/bash hugo -m | ||
vagrant@vusersdcf:~$ sudo useradd -s /bin/bash alex -m | ||
vagrant@vusersdcf:~$ sudo passwd david | ||
New password: | ||
Retype new password: | ||
passwd: password updated successfully | ||
vagrant@vusersdcf:~$ sudo passwd hugo | ||
New password: | ||
Retype new password: | ||
passwd: password updated successfully | ||
vagrant@vusersdcf:~$ sudo passwd alex | ||
New password: | ||
Retype new password: | ||
passwd: password updated successfully | ||
vagrant@vusersdcf:~$ | ||
``` | ||
|
||
Ya tendria los usuarios creados para cada usuario junto con sus contraseñas | ||
|
||
Ahora creare la clave para mi usuario y se la pasare a mis compañeros | ||
|
||
1. Crear el ssh-keygen en el usuario desde donde nos vamos a conectar | ||
2. Pasar a traves de scp la clave publica | ||
|
||
scp /home/diego/.ssh/id_rsa.pub 172.16.0.56:/home/diego/.ssh/ | ||
|
||
3. Copiar y sustituiy la clave publica por el authorized_keys | ||
4. Probar el ssh y comprobar que no pide contraseña. |
83 changes: 83 additions & 0 deletions
83
...n_y_puesta_en_marcha_Linux_Server/Practicas/UT0203_ConexionSSH_VariosUsuarios/Vagrantfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
# All Vagrant configuration is done below. The "2" in Vagrant.configure | ||
# configures the configuration version (we support older styles for | ||
# backwards compatibility). Please don't change it unless you know what | ||
# you're doing. | ||
Vagrant.configure("2") do |config| | ||
# The most common configuration options are documented and commented below. | ||
# For a complete reference, please see the online documentation at | ||
# https://docs.vagrantup.com. | ||
|
||
# Every Vagrant development environment requires a box. You can search for | ||
# boxes at https://vagrantcloud.com/search. | ||
config.vm.box = "generic/ubuntu2204" | ||
config.vm.network "public_network", ip: "172.16.0.59", netmask: "255.255.0.0" | ||
config.vm.hostname = "vusersdcf" | ||
config.vm.provider "virtualbox" do |vb| | ||
vb.name = "Conexion SSH varios usuarios" | ||
vb.memory = 3076 | ||
vb.cpus = 2 | ||
end | ||
# Disable automatic box update checking. If you disable this, then | ||
# boxes will only be checked for updates when the user runs | ||
# `vagrant box outdated`. This is not recommended. | ||
# config.vm.box_check_update = false | ||
|
||
# Create a forwarded port mapping which allows access to a specific port | ||
# within the machine from a port on the host machine. In the example below, | ||
# accessing "localhost:8080" will access port 80 on the guest machine. | ||
# NOTE: This will enable public access to the opened port | ||
# config.vm.network "forwarded_port", guest: 80, host: 8080 | ||
|
||
# Create a forwarded port mapping which allows access to a specific port | ||
# within the machine from a port on the host machine and only allow access | ||
# via 127.0.0.1 to disable public access | ||
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" | ||
|
||
# Create a private network, which allows host-only access to the machine | ||
# using a specific IP. | ||
# config.vm.network "private_network", ip: "192.168.33.10" | ||
|
||
# Create a public network, which generally matched to bridged network. | ||
# Bridged networks make the machine appear as another physical device on | ||
# your network. | ||
# config.vm.network "public_network" | ||
|
||
# Share an additional folder to the guest VM. The first argument is | ||
# the path on the host to the actual folder. The second argument is | ||
# the path on the guest to mount the folder. And the optional third | ||
# argument is a set of non-required options. | ||
# config.vm.synced_folder "../data", "/vagrant_data" | ||
|
||
# Disable the default share of the current code directory. Doing this | ||
# provides improved isolation between the vagrant box and your host | ||
# by making sure your Vagrantfile isn't accessible to the vagrant box. | ||
# If you use this you may want to enable additional shared subfolders as | ||
# shown above. | ||
# config.vm.synced_folder ".", "/vagrant", disabled: true | ||
|
||
# Provider-specific configuration so you can fine-tune various | ||
# backing providers for Vagrant. These expose provider-specific options. | ||
# Example for VirtualBox: | ||
# | ||
# config.vm.provider "virtualbox" do |vb| | ||
# # Display the VirtualBox GUI when booting the machine | ||
# vb.gui = true | ||
# | ||
# # Customize the amount of memory on the VM: | ||
# vb.memory = "1024" | ||
# end | ||
# | ||
# View the documentation for the provider you are using for more | ||
# information on available options. | ||
|
||
# Enable provisioning with a shell script. Additional provisioners such as | ||
# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the | ||
# documentation for more information about their specific syntax and use. | ||
# config.vm.provision "shell", inline: <<-SHELL | ||
# apt-get update | ||
# apt-get install -y apache2 | ||
# SHELL | ||
end |
33 changes: 33 additions & 0 deletions
33
..._Linux_Server/Practicas/UT0204_Programacion_de_tareas_cron/PR0204_DCF_README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[Volver al indice de la unidad](../../index.md) | ||
|
||
# Programación de tareas con ```cron``` | ||
|
||
Para esta práctica utilizare un ubuntu 22.04 | ||
|
||
## 1. ¿Con qué orden pondría con crontab los siguientes casos? | ||
|
||
1. La tarea se ejecuta cada hora | ||
- 0 * * * * | ||
|
||
2. La tarea se ejecuta los domingos cada 3 horas | ||
- 0 */3 * * 0 | ||
|
||
2. La tarea se ejecuta a las 12 de la mañana los días pares del mes. | ||
- 0 0 */2 * * | ||
|
||
2. La tarea se ejecuta el primer día de cada mes a las 8 de la mañana y a las 8 de la tarde. | ||
- 0 8 1 * * | ||
- 0 20 1 * * | ||
|
||
2. La tarea se ejecuta cada media hora de lunes a viernes. | ||
- */30 * * * 1-5 | ||
|
||
2. La tarea se ejecuta cada cuarto de hora, entre las 3 y las 8, de lunes a viernes, durante todo el mes de agosto | ||
- */15 3-8 * 8 1-5 | ||
|
||
2. La tarea se ejecuta cada 90 minutos | ||
- */90 * * * * | ||
|
||
## 2. Como comprobar que el servicio cron está ejecutándose | ||
|
||
Para saber si el servicio ```cron``` está activo tendremos que hacer lo siguiente: |
77 changes: 77 additions & 0 deletions
77
..._y_puesta_en_marcha_Linux_Server/Practicas/UT0204_Programacion_de_tareas_cron/Vagrantfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# -*- mode: ruby -*- | ||
# vi: set ft=ruby : | ||
|
||
# All Vagrant configuration is done below. The "2" in Vagrant.configure | ||
# configures the configuration version (we support older styles for | ||
# backwards compatibility). Please don't change it unless you know what | ||
# you're doing. | ||
Vagrant.configure("2") do |config| | ||
# The most common configuration options are documented and commented below. | ||
# For a complete reference, please see the online documentation at | ||
# https://docs.vagrantup.com. | ||
|
||
# Every Vagrant development environment requires a box. You can search for | ||
# boxes at https://vagrantcloud.com/search. | ||
config.vm.box = "generic/ubuntu2204" | ||
|
||
# Disable automatic box update checking. If you disable this, then | ||
# boxes will only be checked for updates when the user runs | ||
# `vagrant box outdated`. This is not recommended. | ||
# config.vm.box_check_update = false | ||
|
||
# Create a forwarded port mapping which allows access to a specific port | ||
# within the machine from a port on the host machine. In the example below, | ||
# accessing "localhost:8080" will access port 80 on the guest machine. | ||
# NOTE: This will enable public access to the opened port | ||
# config.vm.network "forwarded_port", guest: 80, host: 8080 | ||
|
||
# Create a forwarded port mapping which allows access to a specific port | ||
# within the machine from a port on the host machine and only allow access | ||
# via 127.0.0.1 to disable public access | ||
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1" | ||
|
||
# Create a private network, which allows host-only access to the machine | ||
# using a specific IP. | ||
# config.vm.network "private_network", ip: "192.168.33.10" | ||
|
||
# Create a public network, which generally matched to bridged network. | ||
# Bridged networks make the machine appear as another physical device on | ||
# your network. | ||
# config.vm.network "public_network" | ||
|
||
# Share an additional folder to the guest VM. The first argument is | ||
# the path on the host to the actual folder. The second argument is | ||
# the path on the guest to mount the folder. And the optional third | ||
# argument is a set of non-required options. | ||
# config.vm.synced_folder "../data", "/vagrant_data" | ||
|
||
# Disable the default share of the current code directory. Doing this | ||
# provides improved isolation between the vagrant box and your host | ||
# by making sure your Vagrantfile isn't accessible to the vagrant box. | ||
# If you use this you may want to enable additional shared subfolders as | ||
# shown above. | ||
# config.vm.synced_folder ".", "/vagrant", disabled: true | ||
|
||
# Provider-specific configuration so you can fine-tune various | ||
# backing providers for Vagrant. These expose provider-specific options. | ||
# Example for VirtualBox: | ||
# | ||
# config.vm.provider "virtualbox" do |vb| | ||
# # Display the VirtualBox GUI when booting the machine | ||
# vb.gui = true | ||
# | ||
# # Customize the amount of memory on the VM: | ||
# vb.memory = "1024" | ||
# end | ||
# | ||
# View the documentation for the provider you are using for more | ||
# information on available options. | ||
|
||
# Enable provisioning with a shell script. Additional provisioners such as | ||
# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the | ||
# documentation for more information about their specific syntax and use. | ||
# config.vm.provision "shell", inline: <<-SHELL | ||
# apt-get update | ||
# apt-get install -y apache2 | ||
# SHELL | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters