去安全加固(放开22端口,开启root登录,其他主机可以用root用户ssh访问本主机)命令集锦:
sed -i 's/^#Port 22/Port 22/g' /etc/ssh/sshd_config
sed -i 's/#PermitRootLogin yes/PermitRootLogin yes/g' /etc/ssh/sshd_config
yum install openssh-server -y
systemctl enable sshd.service
/bin/systemctl restart sshd.service
/bin/systemctl stop iptables.service
systemctl disable iptables.service
/usr/lib/systemd/system/sshd.service
禁掉该行:ExecStart=/usr/local/openssh-7.4p1/sbin/sshd -D $OPTIONS
放开该行:ExecStart=/usr/sbin/sshd -D $OPTIONS
挂载磁盘的3大步骤:
主要步骤是:
1、新机器,格式化新 的分区,如果本身就是可用的未被挂载的分区,可以直接进入第二步
2、格式为该盘为ext4系统盘:mkfs -t ext4 /dev/xvda3
3、然后在文件/etc/fstab中写入挂载信息,mount -a后就挂载成功
/dev/vdb /data ext4 defaults 0 0
具体步骤如下:
对新环境进行分区的操作,及中间格式化时新区遇到的问题:
[root@host-10-20-16-27 /]# fdisk -l
Disk /dev/vda: 161.1 GB, 161061273600 bytes, 314572800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b2f10
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 16777215 8387584 83 Linux
分区:/dev/vda盘是161G,/dev/vda1大小是8G,把剩余的空间分给一个新区的操作如下:
把/dev/vda剩下的盘进行分区,执行fdisk /dev/vda,然后执行n是新增一个分区,点p,如果剩余存储都给该分区,则后面就enter即可,最后w写入;
[root@host-10-20-16-27 /]# fdisk /dev/vda
Welcome to fdisk (util-linux 2.23.2).
Select (default p):
Using default response p
Partition number (2-4, default 2):
First sector (16777216-314572799, default 16777216):
Using default value 16777216
Last sector, +sectors or +size{K,M,G} (16777216-314572799, default 314572799):
Using default value 314572799
Partition 2 of type Linux and of size 142 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
分区成功:
[root@host-10-20-16-27 /]# fdisk -l
Disk /dev/vda: 161.1 GB, 161061273600 bytes, 314572800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b2f10
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 16777215 8387584 83 Linux
/dev/vda2 16777216 314572799 148897792 83 Linux
遇到的问题:格式化新的分区时,有下面的报错:
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 16777215 8387584 83 Linux
/dev/vda2 16777216 314572799 148897792 83 Linux