Вы находитесь на странице: 1из 8

[estudiante@localhost ~]$ root

-bash: root: no se encontr� la orden


[estudiante@localhost ~]$ su
Contrase�a:
[root@localhost estudiante]# m
bash: m: no se encontr� la orden
[root@localhost estudiante]# ?
bash: ?: no se encontr� la orden
[root@localhost estudiante]#
[root@localhost estudiante]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 82M 0 rom /media/VBox_GAs_6.0.4
sda 8:0 0 100G 0 disk
+-sda1 8:1 0 500M 0 part /boot
+-sda2 8:2 0 99,5G 0 part
+-VolGroup-lv_root (dm-0) 253:0 0 50G 0 lvm /
+-VolGroup-lv_swap (dm-1) 253:1 0 2G 0 lvm [SWAP]
+-VolGroup-lv_home (dm-2) 253:2 0 47,6G 0 lvm /home
sdb 8:16 0 401,7M 0 disk
sdc 8:32 0 412,3M 0 disk
[root@localhost estudiante]# fdisk /dev/sdb
El dispositivo no contiene una tabla de particiones DOS v�lida ni una etiqueta de
disco Sun o SGI o OSF
Building a new DOS disklabel with disk identifier 0x7b28ab3d.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Atenci�n: el indicador 0x0000 inv�lido de la tabla de particiones 4 se corregir�


mediante w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to


switch off the mode (command 'c') and change display units to
sectors (command 'u').

Orden (m para obtener ayuda): n


Acci�n de la orden
e Partici�n extendida
p Partici�n primaria (1-4)
p
N�mero de partici�n (1-4): 1
Primer cilindro (1-51, default 1):
Using default value 1
Last cilindro, +cilindros or +size{K,M,G} (1-51, default 51): 50

Orden (m para obtener ayuda): l

0 Vac�a 24 NEC DOS 81 Minix / old Lin bf Solaris


1 FAT12 39 Plan 9 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 3c PartitionMagic 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 40 Venix 80286 84 Unidad C: ocult c6 DRDOS/sec (FAT-
4 FAT16 <32M 41 PPC PReP Boot 85 Linux extendida c7 Syrinx
5 Extendida 42 SFS 86 Conjunto de vol da Datos sin SF
6 FAT16 4d QNX4.x 87 Conjunto de vol db CP/M / CTOS / .
7 HPFS/NTFS 4e QNX4.x segunda 88 Linux plaintext de Utilidad Dell
8 AIX 4f QNX4.x tercera 8e Linux LVM df BootIt
9 AIX bootable 50 OnTrack DM 93 Amoeba e1 DOS access
a OS/2 Boot Manag 51 OnTrack DM6 Aux 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 52 CP/M 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 53 OnTrack DM6 Aux a0 Hibernaci�n de eb BeOS fs
e W95 FAT16 (LBA) 54 OnTrackDM6 a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 55 EZ-Drive a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 56 Golden Bow a7 NeXTSTEP f0 inicio Linux/PA
11 FAT12 oculta 5c Priam Edisk a8 UFS de Darwin f1 SpeedStor
12 Compaq diagnost 61 SpeedStor a9 NetBSD f4 SpeedStor
14 FAT16 oculta <3 63 GNU HURD o SysV ab arranque de Dar f2 DOS secondary
16 FAT16 oculta 64 Novell Netware af HFS / HFS+ fb VMware VMFS
17 HPFS/NTFS ocult 65 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 SmartSleep de A 70 DiskSecure Mult b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 75 PC/IX bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 80 Old Minix be arranque de Sol ff BBT
1e Hidden W95 FAT1

Orden (m para obtener ayuda):

disco dos
[root@localhost estudiante]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 82M 0 rom /media/VBox_GAs_6.0.4
sda 8:0 0 100G 0 disk
+-sda1 8:1 0 500M 0 part /boot
+-sda2 8:2 0 99,5G 0 part
+-VolGroup-lv_root (dm-0) 253:0 0 50G 0 lvm /
+-VolGroup-lv_swap (dm-1) 253:1 0 2G 0 lvm [SWAP]
+-VolGroup-lv_home (dm-2) 253:2 0 47,6G 0 lvm /home
sdb 8:16 0 401,7M 0 disk
+-sdb1 8:17 0 392,2M 0 part
sdc 8:32 0 412,3M 0 disk
[root@localhost estudiante]# fdisk /dev/sdc
El dispositivo no contiene una tabla de particiones DOS v�lida ni una etiqueta de
disco Sun o SGI o OSF
Building a new DOS disklabel with disk identifier 0x1eef26fc.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Atenci�n: el indicador 0x0000 inv�lido de la tabla de particiones 4 se corregir�


mediante w(rite)

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to


switch off the mode (command 'c') and change display units to
sectors (command 'u').

Orden (m para obtener ayuda): n


Acci�n de la orden
e Partici�n extendida
p Partici�n primaria (1-4)
p
N�mero de partici�n (1-4): 1
Primer cilindro (1-52, default 1):
Using default value 1
Last cilindro, +cilindros or +size{K,M,G} (1-52, default 52):
Using default value 52
Orden (m para obtener ayuda): t
Se ha seleccionado la partici�n 1
C�digo hexadecimal (escriba L para ver los c�digos): fd
Se ha cambiado el tipo de sistema de la partici�n 1 por fd (Linux raid autodetect)

Orden (m para obtener ayuda): p

Disco /dev/sdc: 432 MB, 432315904 bytes


255 heads, 63 sectors/track, 52 cylinders
Units = cilindros of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1eef26fc

Disposit. Inicio Comienzo Fin Bloques Id Sistema


/dev/sdc1 1 52 417658+ fd Linux raid autodetect

Orden (m para obtener ayuda): w


�Se ha modificado la tabla de particiones!

Llamando a ioctl() para volver a leer la tabla de particiones.


Se est�n sincronizando los discos.
[root@localhost estudiante]#

===============================
[root@localhost estudiante]# mdadm --create --verbose /dev/md0 --level=1 --raid-
devices=2 /dev/sdb1 /dev/sdc1
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
mdadm: size set to 401280K
mdadm: largest drive (/dev/sdc1) exceeds size (401280K) by more than 1%
Continue creating array? y
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
[root@localhost estudiante]#

formateamos
=============================
[root@localhost estudiante]# mkfs.ext4 /dev/md0
mke2fs 1.41.12 (17-May-2010)
Etiqueta del sistema de ficheros=
Tipo de SO: Linux
Tama�o del bloque=1024 (bit�cora=0)
Tama�o del fragmento=1024 (bit�cora=0)
Stride=0 blocks, Stripe width=0 blocks
100352 nodos-i, 401280 bloques
20064 bloques (5.00%) reservados para el superusuario
Primer bloque de datos=1
N�mero m�ximo de bloques del sistema de ficheros=67633152
49 bloque de grupos
8192 bloques por grupo, 8192 fragmentos por grupo
2048 nodos-i por grupo
Respaldo del superbloque guardado en los bloques:
8193, 24577, 40961, 57345, 73729, 204801, 221185

Escribiendo las tablas de nodos-i: hecho


Creating journal (8192 blocks): hecho
Escribiendo superbloques y la informaci�n contable del sistema de ficheros: hecho

Este sistema de ficheros se revisar� autom�ticamente cada 34 montajes o


180 d�as, lo que suceda primero. Utilice tune2fs -c o -i para cambiarlo.
[root@localhost estudiante]#

===========
ta estan trabajando como un solo disco
[root@localhost estudiante]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 82M 0 rom /media/VBox_GAs_6.0.4
sda 8:0 0 100G 0 disk
+-sda1 8:1 0 500M 0 part /boot
+-sda2 8:2 0 99,5G 0 part
+-VolGroup-lv_root (dm-0) 253:0 0 50G 0 lvm /
+-VolGroup-lv_swap (dm-1) 253:1 0 2G 0 lvm [SWAP]
+-VolGroup-lv_home (dm-2) 253:2 0 47,6G 0 lvm /home
sdb 8:16 0 401,7M 0 disk
+-sdb1 8:17 0 392,2M 0 part
+-md0 9:0 0 391,9M 0 raid1
sdc 8:32 0 412,3M 0 disk
+-sdc1 8:33 0 407,9M 0 part
+-md0 9:0 0 391,9M 0 raid1
[root@localhost estudiante]#

======================
comprobamos que se ha creado la carpeta info en ambos discos o arrays

[root@localhost estudiante]# mkdir /info


[root@localhost estudiante]# mount /dev/md0 /info/
[root@localhost estudiante]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 82M 0 rom /media/VBox_GAs_6.0.4
sda 8:0 0 100G 0 disk
+-sda1 8:1 0 500M 0 part /boot
+-sda2 8:2 0 99,5G 0 part
+-VolGroup-lv_root (dm-0) 253:0 0 50G 0 lvm /
+-VolGroup-lv_swap (dm-1) 253:1 0 2G 0 lvm [SWAP]
+-VolGroup-lv_home (dm-2) 253:2 0 47,6G 0 lvm /home
sdb 8:16 0 401,7M 0 disk
+-sdb1 8:17 0 392,2M 0 part
+-md0 9:0 0 391,9M 0 raid1 /info
sdc 8:32 0 412,3M 0 disk
+-sdc1 8:33 0 407,9M 0 part
+-md0 9:0 0 391,9M 0 raid1 /info
[root@localhost estudiante]#

creando archivos en el array


=============================
[root@localhost estudiante]#
[root@localhost estudiante]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
50G 4,3G 43G 10% /
tmpfs 939M 448K 939M 1% /dev/shm
/dev/sda1 477M 66M 386M 15% /boot
/dev/mapper/VolGroup-lv_home
47G 85M 45G 1% /home
/dev/sr0 82M 82M 0 100% /media/VBox_GAs_6.0.4
/dev/md0 372M 2,1M 350M 1% /info
[root@localhost estudiante]#
[root@localhost estudiante]# cd /info/
[root@localhost info]# mkdir COMCIBERDEF
[root@localhost info]# cd COMCIBERDEF/
[root@localhost COMCIBERDEF]# touch archivo{1..100}.txt
[root@localhost COMCIBERDEF]# ls
archivo100.txt archivo28.txt archivo46.txt archivo64.txt archivo82.txt
archivo10.txt archivo29.txt archivo47.txt archivo65.txt archivo83.txt
archivo11.txt archivo2.txt archivo48.txt archivo66.txt archivo84.txt
archivo12.txt archivo30.txt archivo49.txt archivo67.txt archivo85.txt
archivo13.txt archivo31.txt archivo4.txt archivo68.txt archivo86.txt
archivo14.txt archivo32.txt archivo50.txt archivo69.txt archivo87.txt
archivo15.txt archivo33.txt archivo51.txt archivo6.txt archivo88.txt
archivo16.txt archivo34.txt archivo52.txt archivo70.txt archivo89.txt
archivo17.txt archivo35.txt archivo53.txt archivo71.txt archivo8.txt
archivo18.txt archivo36.txt archivo54.txt archivo72.txt archivo90.txt
archivo19.txt archivo37.txt archivo55.txt archivo73.txt archivo91.txt
archivo1.txt archivo38.txt archivo56.txt archivo74.txt archivo92.txt
archivo20.txt archivo39.txt archivo57.txt archivo75.txt archivo93.txt
archivo21.txt archivo3.txt archivo58.txt archivo76.txt archivo94.txt
archivo22.txt archivo40.txt archivo59.txt archivo77.txt archivo95.txt
archivo23.txt archivo41.txt archivo5.txt archivo78.txt archivo96.txt
archivo24.txt archivo42.txt archivo60.txt archivo79.txt archivo97.txt
archivo25.txt archivo43.txt archivo61.txt archivo7.txt archivo98.txt
archivo26.txt archivo44.txt archivo62.txt archivo80.txt archivo99.txt
archivo27.txt archivo45.txt archivo63.txt archivo81.txt archivo9.txt
[root@localhost COMCIBERDEF]#

activacion permanente del array


==============================
#
# /etc/fstab
# Created by anaconda on Fri Jan 25 09:31:31 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root / ext4 defaults 1 1
UUID=a662cba8-6aed-4d1c-ae80-f957e1c91e15 /boot ext4 defaults
1 2
/dev/mapper/VolGroup-lv_home /home ext4 defaults 1 2
/dev/mapper/VolGroup-lv_swap swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
/dev/md0 /info ext4 defaults 1 3

autenticacion con llaves rsa asimetrica


======================================
generando un par de llaves una publica y una privada

primer factor de autenticacion : lo que yo se


lo que yo tengo : las llaves privadas un token
lo que yo soy : autenticacion bimetrica, fasial, huella, etc
====
[root@localhost estudiante]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
cc:1d:56:3e:bf:30:7b:46:75:78:a1:ba:06:36:9d:06 root@localhost.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
| . . |
| o ...|
| Eo o.. +|
| o oo.oo o.|
| S+.=o o |
| . + .= . |
| o. + |
| . o |
| |
+-----------------+
[root@localhost estudiante]#

==============================================
[root@localhost estudiante]# cd /root/.ssh/
[root@localhost .ssh]# ls
id_rsa id_rsa.pub known_hosts
[root@localhost .ssh]# cat id_rsa
-----BEGIN RSA PRIVATE KEY-----
MIIEoQIBAAKCAQEA3yV0aiY407PZGyOWAsRHBa0WwD0rxZZew8yKSXLccXiuxEME
GWStM68C8FkdqC8+Af/qofUsF7rFY0S9uN28YKQaA54v6gyDbmqXVpyV2O8s7+xx
25NULVhPnfYBYu9EcxXc6WVeJtNKZcyZIEDVB+7E+zw0cC98eOXEF+Z7X0aAYPzz
aw7gFk4JhoyHzFumJhQazAB7gVJmTSEwBbJGwQmvRw7EB9TSQbE7h63Twfwu9Dn4
oEdR9MMAAK5XtT47EjSwVjwHNO+Qhtc1aJCXSGj3YisMvEw9tXWRRwNgTv/4shtZ
/Q4FC2zKZ1dhc5+UNCiFd1HEKxETFSKgzkib2wIBIwKCAQAMwE/LjSfRlT+bJprb
li/xsh6OpGjmuCKsGlELgugGe+y6wgA79x/XEVCgBRejNeZJQdLkruyTpEXLKH/e
rZW8YSYO1dbaLJnLy5OejJrZMj0VBjJkUY/IE6zHMqD+VtC2HoGm79l+j7sbwoxo
PjgPFPVQL1N0H/h7799R0qf20LjFCA61t9xIBm7eHOpahhrOBh0cvYox1yBnoRIM
574UeGG0MwBTToT8oY1U9FyOQq31Fugl61x4MAzPHAaFmDuioZiErXwOcGG6BqeW
pbCnyo7KeEZEl3n+FIEJAhhDth3t9m1qReIxYhcbA6lktYjCzbxroEmcbBWzbsif
bdOrAoGBAP4Omow+eXVzDy5eEDiGQNX3xZfrFeIL3VToZS0XGwSZQM/+h3x+BLh2
VyHUcY7rFPmr1g+QnqebNcV19vtrTW5TilbF4RJWRM2XzaxFO61hRf1FA3kcK5Vg
/+fIbZh1PzXtRYvtqR8EJjJHrz3/UOJJzCQ5R4vfz9CkeHxx9/FTAoGBAODaVWXA
g9u2zkb5gkoV7/sY44Vp9acNQFpPOUcMv8PBjjF3CsHX8gKGTvBkh/EdWFEHUwp4
EdgiRFpiTOooCLkgnmx+fvnh/BS3lRRXAVZuyjdF7sXvxdF2Dtdg8R84zbcAfVNL
ne+nEgPG6A8R5diZS//ilTAZ3casl212TrJZAoGAQVQ2XpO41Q71Rm/1iuCxlhsk
LmEFoIa1QbgaBEfFHnCNAkjDwO00afKLbxlfB35HOOMLKJLm9+YVJCWl6OET6Sts
tzoyj6/IjKNgxeXqxi70vXgldun8lCBBzeMU3g+FSGGVimGvJTuUyxm/WRXEV3IP
7A66oE9+lLyUAr44cUECgYEArXU6kFKu3LGX0FoUDUQfhzB1AITwtBGJaj0djpTO
cnC+Jiih5f5bm4wuRGrPRPlhYxRHX9j30p4XeOy+/cccrBHZTGGVJyqshQKmNEMe
Sf2x8CABVt2J+VsSw2gKdyvR5PG/w+ngPIgyd/E2rIomVqIkr3RHM7wuvdWZYxIf
c6MCgYAp8XR75OwqnENtb1eFLoF+FNTmTU6cY91uQuHSb4mQAoQJX98jV2w4DPEF
+bjOoPkpjUzQF9dRq3v3k3zgZq/at3+1zfI8gzlKprrCsHfnUTlhNxkoclfHUzvB
g2CP5f3CF6DVeZDBNBYr6EGm7GOtDtaqo84ndQBOt1Ue6m/SqA==
-----END RSA PRIVATE KEY-----
[root@localhost .ssh]#

modificar
cat /etc/ssh/sshd_config
======
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
#AuthorizedKeysCommand none

[root@localhost .ssh]# ls
id_rsa id_rsa.pub known_hosts
[root@localhost .ssh]# cat id_rsa.pub > /etc/ssh/authorized_keys
[root@localhost .ssh]# ls /etc/ssh/
authorized_keys ssh_config ssh_host_dsa_key ssh_host_key
ssh_host_rsa_key
moduli sshd_config ssh_host_dsa_key.pub ssh_host_key.pub
ssh_host_rsa_key.pub
[root@localhost .ssh]#

pasamos a root .ssh


=====================
copiamos al home estudiante
[root@localhost .ssh]# cp -rf id_rsa /home/estudiante/
[root@localhost .ssh]#

cambiando los permisos porque no deja copiar


===========================================
[root@localhost .ssh]# chown -R estudiante:estudiante /home/estudiante/id_rsa
[root@localhost .ssh]# ll /home/estudiante/id_rsa
-rw-------. 1 estudiante estudiante 1675 mar 5 12:34 /home/estudiante/id_rsa

[root@localhost .ssh]#
}reiniciamos los servicios
==========================
[root@localhost .ssh]# service sshd restart
Parando sshd: [ OK ]
Iniciando sshd: [ OK ]
[root@localhost .ssh]#

Вам также может понравиться