Linux 23rd day: Exercises and assignments

Source: Internet
Author: User
Tags gnupg gpg man openssl openssl enc openssl rsa openssl x509 openssh server

Linux 23rd day: Exercises and assignments

CD. SSH
Cat Known_hosts Public Key
Cd/etc/ssh
Cat Ssh_host_rsa_key Private Key

Md5sum F1 F2 F3 Digest data same as md5sum hash value

Sha512sum F1


Md5sum F1 > F1.md5
Md5sum--check F1.MD5
F1:ok
Echo >> F1
Md5sum--check F1.MD5
F1:failed


OpenSSL enc-e-des3-a-salt-in fstab-out fstab.des3
RM fstab-f
Cat Fstab.des3
OpenSSL enc-d-des3-a-salt-in fstab-out fstab
Man ENC not man OpenSSL

OpenSSL dgst-md5 Fstab
Md5sum Fstab
(Umask 066;openssl genrsa-out root.key-des 2048)

OpenSSL rsa-in root.key-pubout-out root.key.pub
Cat Root.key.pub


Vim/etc/pki/tls/openssl.cnf
Rpm-qf/etc/pki/tls/openssl.cnf
Ls/etc/pki/ca
Touch/etc/pki/ca/index.txt
echo >/etc/pki/ca/serial
Cd/etc/pki/ca
Ls
(Umask 066;openssl genrsa-out PRIVATE/CAKEY.PEM 2048) Generate private key
CD private/
Cat Cakey.pem
OpenSSL Req-new-x509-key cakey.pem-days 365-out/etc/pki/ca/cacert.pem
OpenSSL x509-in Cacert.pem-noout-text
OpenSSL x509-in cacert.pem-noout-dates
OpenSSL x509-in Cacert.pem-noout-subject
OpenSSL x509-in Cacert.pem-noout-issuer


(Umask 066;openssl genrsa-out/etc/pki/tls/private/httpd.key 2048) Generate private key
Cd/etc/pki/tls/private
Cat Httpd.key
OpenSSL req-new-key/etc/httpd/ssl/httpd.key-days 365-OUT/ETC/HTTPD/SSL/HTTPD.CSR
SCP HTTPD.CSR 10.1.2.252.213:
OpenSSL ca-in httpd.csr-out certs/httpd.crt
Vi/etc/pki/tls/openssl.cnf
Cat Index.txt
Cat serial
OpenSSL x509-in Httpd.crt-noout-text

OpenSSL Ca-revoke Httpd.crt
echo >/etc/pki/ca/crlnumber
OpenSSL ca-gencrl-out/etc/pki/ca/crl/ca.crl
OpenSSL crl-in Cat Crl/ca.crl-noout-text


Gpg-c fstab Symmetric encryption
SCP FSTAB.GPG 10.1.252.213
gpg-d Fstab Symmetric decryption
Gpg-o fstab-d FSTAB.GPG

GPG--gen-key
CD. gnupg/
Ls
ll
GPG--list-key View Public key
Gpg-a--export-o wang.pub
Cat Wang.pub
SCP wang.pub 10.1.252.213:
GPG--list-key
GPG--gen-key
GPG--import wang.pub
GPG-E-R Wang F1
ll F1.GPG
SCP f1.gpg 10.1.252.210:
Gpg-d F1.GPG
Gpg-o f1-d F1.GPG
GPG--delete-secret-keys magedu
CD. gnupg/
ll
GPG--delete-keys Wang


Rpm-q OpenSSH Server
IP addr Add 10.1.252.210/16 dev eth0

Cat Known_hosts


Vim/etc/ssh/sshd_config
Port 22222
Systemctl Restart sshd
Ss-ntl
Tail/var/log/messages
Semanage port-a-T port_type-p TCP 22222 version 7 change 6 no change

Vim/etc/ssh/ssh_config Client without D
Port 22222

Ssh-x?.?.?.? Add x to run the graphics window
System-config-users either INIT3 or 5 windows

Ssh-t 10.1.252.210 ssh 10.1.253.1 forced pseudo terminal-T
Netstat-nt


Ssh-keygen
Cat Id_rsa
Cat Id_rsa.pub

Ssh-copy-id-i. Sh/id_rsa 10.1.252.213

Cat. Ssh/id_rsa.pub
Cat. Ssh/authorized_keys

SCP id_rsa* 10.1.253.1:/root/.ssh

Ssh-keygen-p Plus Password

Ssh-agent Bash Agent
Ssh-add
Ssh-add graphical interface without proxy


cat/root/id_rsa_1024\ \ (2\). Pub >> Authorized_keys import public key

SCP identity.pub 10.1.252.210:
Cat Authorized_keys
Ssh-keygen-i-F identity.pub >>. Ssh/authorized_keys


SCP F1 10.1.252.213

DD If=/dev/zero of=f1 bs=1m count=500
CD. SSH
Ls
Cat known_hosts host public key from/etc/ssh/ssh_host_rsa_key.pub
Cat Authorized_keys user public key from Ssh-keygen per user home directory generation

CP F1 F2
CP F1 F3
Scp-p F1 F2 F3 10.1.252.213:/testdir
CD. SSH
RM-RF *
Cd
Scp-p F1 F2 F3 10.1.252.213:/testdir
Echo >> F1
ll
Scp-p F1 F2 F3 10.1.252.213:/testdir


Rsync-av F1 F2 F3 10.1.252.213:/testdir only update not copy


SFTP 10.1.252.213
Put Fstab
Get 51clickup.sh


Systemctl Start Telnet.socket
Ss-ntl
Iptable-f

Telnet 10.1.252.213

Netstat-ntl


Netstat-nt

Ssh-l 9527:10.1.252.213:23-n 10.1.252.210

Telnet 127.0.0.1 9527

Linux 23rd day: Exercises and assignments

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.