跳转到主要内容

Linux

Linux集群SSH免密登陆

分类
故障描述

  无

故障分析

  无

处理过程

      Linux集群规模20台,需相互间免密登陆。

      先选择一台主机保存所有主机的密钥,然后将密钥复制到所有主机。

1.登陆每台主机创建ssh.pub:

[root@master-1 ~]# ssh-keygen
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:
SHA256:Z0rzrrX1DA+Yjw6S9iFnoGQfQc9NVn1PXEXHohC/gno root@jumpserver
The key's randomart image is:
+---[RSA 3072]----+
|      .   +o.. +B|
|     . o +..  o *|
|      . o .... +.|
|       . .  ..  .|
|    o o S + .    |
|   o o * * +     |
|    . B E = +    |
|     . B = = *   |
|        oo= . +  |
+----[SHA256]-----+

 

2. 每台主机执行ssh-copy-id root@master-1复制到Master-1

3.登陆Master-1将密码复制到所有主机:

scp .ssh/authorized_keys root@master-2:/root/ssh.txt

scp .ssh/authorized_keys root@master-3:/root/ssh.txt

scp .ssh/authorized_keys root@node-1:/root/ssh.txt

....

4.登陆每台主机,将ssh.txt追加到.ssh/authorized_keys即可。

cat /root/ssh.txt >> /root/.ssh/authorized_keys

建议/总结

  无

OpenEulerOS 22如何修改docker默认IP172.17.0.1/16

故障描述

  无

故障分析

  无

处理过程

  安装好docker后执行下面命令

 sed -i "s/^DOCKER_NETWORK_OPTIONS=/DOCKER_NETWORK_OPTIONS=\'--bip=192.168.255.1\/24\'/g" /etc/sysconfig/docker-network 

即在/etc/sysconfig/docker-network 文件中DOCKER_NETWORK_OPTIONS=后添加'--bip=192.168.255.1/24';192.168.255.1/24根据实际情况进行修改。避免冲突

建议/总结

  无

如何处理Redhat及CentOS虚拟机关机时卡住

分类
故障描述

按照操作系统缺省配置的Red Hat Enterprise Linux 4.4 (32位及64位)或者CentOS 4.4 (32位及64位)系统虚拟机,在优雅关机时,概率性出现卡住的问题,表现为连接VNC花屏。如图1所示。

图1 CentOS 4.4 64位系统优雅关机卡住界面

故障分析

  无

处理过程

关闭系统的电源管理服务acpid。

在Red Hat Enterprise Linux 4.4 (32位及64位)或者CentOS 4.4 (32位及64位)系统中,关闭电源管理服务acpid的操作方法如下:
(1) 在Linux终端中执行命令,关闭acpid服务。
chkconfig acpid off
(2) 重启虚拟机,使修改生效。

建议/总结

Red Hat Enterprise Linux 4.4 (32位及64位)和CentOS 4.4 (32位及64位)系统的电源管理模块在内核启动过程中默认进行加载,但该模块在低版本的Linux内核中存在缺陷,会导致虚拟机关机概率性卡死。

opensuse安装virtualbox

故障描述

  无

故障分析

  无

处理过程

1、进入“安装/移除软件”,并输入root密码

2、搜索virtualbox。

3、选中virtualbox(基础)和virtualbox-qt(界面)

4、点接入安装。

5、进入Yast/安全和用户/用户和组管理。

6、选中你要使用virtualbox的用户>编辑>细节>附加的组先中vboxusers>确定。

7、重启opensuse登陆即可使用virtualBox

建议/总结

  无

Centos 删除图形界面后无法登陆

故障描述

  客户安装Centos后默认安装有图形界面,客户删除图形界面后启动不提示登录。但可以用ssh或telnet登录。

故障分析

  无

处理过程

1、ssh登陆服务器

2、修改/etc/inittab 文件,将id:5:initdefault:(默认的 run level 等级为 5,即图形界面改为3即纯文本环境)

3.保存文件后重启系统你就可以看见是启动的文本界面了。

建议/总结

  无

Linux选用国内163镜像

故障描述

  Linux国外源速度较慢。如何使用国内源。

故障分析

  无

处理过程

  建议使用国内163镜像。

登陆http://mirrors.163.com/。查看每个版本对应的使用方法。以下以Centos为例

1、首先备份/etc/yum.repos.d/CentOS-Base.repo

    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份)

3、运行以下命令生成缓存

    yum clean all
    yum makecache
建议/总结

  无

Centos 7.0 iptables服务管理

故障描述

  Centos7.0使用service iptables restart提示错误

[root@FileServer etc]# service iptables restart
Redirecting to /bin/systemctl restart  iptables.service
Failed to issue method call: Unit iptables.service failed to load: No such file or directory.

故障分析

  无

处理过程

  Iptables默认没有安装服务。

yum -y install iptables-services

[root@FileServer etc]# service iptables start
Redirecting to /bin/systemctl start  iptables.service

建议/总结

  无

Linux添加FTP用户设置为/bin/false无法登陆

故障描述

[root@Radius ftp]# useradd -d /home/huawei -g ftp -s /bin/false huawei
[root@Radius ftp]#passwd huawei
[root@Radius ftp]# passwd huawei
更改用户 huawei 的密码 。
新的 密码:
重新输入新的 密码:
passwd: 所有的身份验证令牌已经成功更新。
[root@Radius ftp]# ftp 127.0.0.1
Connected to 127.0.0.1 (127.0.0.1).
220 (vsFTPd 2.2.2)
Name (127.0.0.1:root): huawei
331 Please specify the password.
Password:
530 Login incorrect.
ftp>

故障分析

  [root@Radius ftp]# tail /var/log/secure
Sep 11 10:16:39 radius proftpd[11888]: localhost (192.168.1.199[192.168.1.199]) - USER huawei (Login failed): Invalid shell: '/bin/false'
Sep 11 10:16:56 radius proftpd[11889]: localhost (192.168.1.199[192.168.1.199]) - USER huawei (Login failed): Invalid shell: '/bin/false'
Sep 11 10:23:53 radius proftpd[12044]: localhost (192.168.1.199[192.168.1.199]) - USER huawei (Login failed): Invalid shell: '/bin/false'

上述错误日志确定为用户shell为/bin/false后,用户无法登陆FTP,vsftpd默认会检查用户的shell,如果用户的shell在/etc/shells没有记录,则无法登陆ftp

处理过程

 1.在/etc/shells中添加一行"/bin/false";
2.重启vsftpd服务。

[root@Radius opt]# vi /etc/shells

/bin/sh
/bin/bash
/sbin/nologin
/bin/dash
/bin/false

 

建议/总结

  无