在你知道对方的IP和密码的情况下,可以友好的帮助对方完成一下操作。
声明:本操作一定要在合法合规情况下操作,如果被打与博主无关哈~
1、远程登录
本操作使用ssh远程连接对方
[root@zhan ~]# ssh root@10.36.xxx.x
输入密码,登录成功
2、检查时间、防火墙的信息配置
时间配置错误,配置最新时间
root@zhan ~]# date
2024年 03月 30日 星期六 11:53:27 CST
[root@zhan ~]# yum -y install ntpdate
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
base | 2.2 kB 00:00
docker-ce-stable | 2.0 kB 00:00
epel | 3.3 kB 00:00
extras | 1.5 kB 00:00
kubernetes | 1.4 kB 00:00
mysql-connectors-community | 1.3 kB 00:00
mysql-tools-community | 1.3 kB 00:00
mysql57-community | 1.3 kB 00:00
updates | 1.5 kB 00:00
(1/2): epel/x86_64/updateinfo | 1.0 MB 00:00
(2/2): epel/x86_64/primary | 3.9 MB 00:00
epel 13798/13798
软件包 ntpdate-4.2.6p5-29.el7.centos.2.x86_64 已安装并且是最新版本
无须任何处理
[root@zhan ~]# ntpdate ntp.aliyun.com
date
1 Apr 19:51:18 ntpdate[53285]: step time server 203.107.6.88 offset 201420.209536 sec
[root@zhan ~]# date
2024年 04月 01日 星期一 19:51:18 CST
[root@zhan ~]# hwclock --systohc
[root@zhan ~]# date
2024年 04月 01日 星期一 19:51:55 CST
[root@zhan ~]# hwclock -w
防火墙已经关闭,不用管
[root@zhan ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
selinux关闭,不用管
[root@zhan ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
3。登录太单调,来点登录和远程登录欢迎词
- 登录欢迎词
- 更改文件sshd_config中信息
[root@zhan ~]# vi /etc/ssh/sshd_config
# $OpenBSD: ssh_config,v 1.30 2016/02/20 23:06:23 sobrado Exp $
# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.
# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
# 3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.
# Site-wide defaults for some commonly used options. For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.
# Host *
# ForwardAgent no
# ForwardX11 no
# RhostsRSAAuthentication no
# RSAAuthentication yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
在banner中贴入Banner /etc/ssh/banner
更改 、etc/ssh/banner中的登录欢迎词
/**[root@zhan ~]# vi /etc/ssh/banner
* .::::.
* .::::::::.
* ::::::::::: FUCK YOU
* ..:::::::::::'
* '::::::::::::'
* .::::::::::
* '::::::::::::::..
* ..::::::::::::.
* ``::::::::::::::::
* ::::``:::::::::' .:::.
* ::::' ':::::' .::::::::.
* .::::' :::: .:::::::'::::.
* .:::' ::::: .:::::::::' ':::::.
* .::' :::::.:::::::::' ':::::.
* .::' ::::::::::::::' ``::::.
* ...::: ::::::::::::' ``::.
* ```` ':. ':::::::::' ::::..
* '.:::::' ':'````..
*/
更改输入密码后的欢迎信息
[root@zhan ~]# vi /etc/ssh/banner
更新登录信息 `systemctl restart sshd`
退出远程登录 exit
4.建立免密登录
- 生成密钥ssk-keygen
- 将密钥拷贝给另一个服务器 :ssh-copy-id IP地址
备注:其中生成的秘钥中,rsa 为私钥 rsa.pub 为公共秘钥,Koown 我登录过的 authouized 远程登录过的账号
5.打包压缩,留下自己的痕迹
建立一个标志性的目录,目录下可以建立文件,mkdir 建立目录,touch建立文件
- 使用tar压缩和解压文件
- 解压zip压缩包,使用unzip进行解压。
- 进行打包:tar cvf tar cvf 打包后的名称.tar 压缩前的目录
Tar cvf root.tar root/
- 解压 tar xvf 解压的文件。
- Gzip -d 进行解压
- Gzip 压缩文件,但是源文件被删除,只压缩文件
- Dd if=/dev/zero of=/xa2402.txt bs=1024M count=5 查看磁盘写的速率,创建一个文件并指定大小。文件大小等于 bs*count
- 解压到对应的位置 :tar xzvf 文件名称 -C路径
- 解包&解压缩:tar xzvf 文件名称
- 压缩并打包:tar czvf tar czvf root.tar.gz root/
扩展:
Ll-h 查看文件的大小。
Du -sh 文件名 查看指定目录的空间大小,不包含快捷内容(工作中可以使用此命令看磁盘大小,进行相应的清理)
Du -sh *