Linux/Windows报错处理记录

  1. 远程登录windows桌面蓝屏
1. windows+r,打开运行,输入mstsc,回车,输入对应的服务器登录
2. 登陆后出现蓝屏,无法显示桌面,Ctrl+Alt+End键,激活远程任务管理器,打开任务管理器
3. 在进程查找explorer.exe,如果有,选中该进程,并点击右下角“结束进程”; 如果没有explorer.exe,直接执行第4步
4. 然后在任务管理器点击“文件”-“新建任务(运行...)”---“浏览”,选择“C:\WINDOWS\explorer.exe”“确定”,便可以看见桌面显示出来了
  • super block 损坏
# 主要针对存储卷类型ext4
1.查看超级块备份位置
mke2fs -n /dev/sda
2.修复超级块
e2fsck -b 32768 /dev/sda -y
  • 检查服务启动所依赖的库文件
# ldd + 执行文件
[root@mail_vm bin]# ldd sync
	linux-vdso.so.1 =>  (0x00007ffe76f6c000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fb1550b6000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fb15548b000)
  • ssh 链接报错
解决方向:
1. cat /etc/ssh/sshd_config
passwordAuthentication yes 使用账号密码登录
2. 检查防火墙配置
firewalld-cmd --list-all
Systemctl stop firewalld
3. 检查secure日志,若包含如下错误信息,则该问题通常是由于系统启用了SELinux服务所致。请参考SELinux服务引起问题的解决方法。其他情况请参考禁止root用户登录引起问题的解决方法。
error: Could not get shadow infromation for root.
4. 通过管理终端登录Linux实例,执行如下命令,查看当前SELinux服务状态。
[root@cnsz-ansible-110 ~]# getenforce 
Disabled

  • 添加错误账号密码锁定次数
echo "account required /lib/security/pam tally.so deny=10 no_magic_root rese" >> /etc/pam.d/system-auth
  • 查看是否账号被锁定
passwd -u <user> 解锁用户
Passwd -s <user> 查看用户锁定状态
Passwd -l <user> 锁定用户
  • /etc/profile修改错误修复
export PATH=/usr/bin:/usr/sbin:/bin:/sbin
执行后可正常使用命令
或者:/usr/bin/vi /etc/profile
  • Vmware 兼容行列表驱动等下载
https://my.vmware.com/group/vmware/downloads/info/slug/datacenter_cloud_infrastructure/vmware_vsphere/6_5
# Get the driver info
esxcli network nic get -n vmnic1
  • Swap空间管理
创建swapfile
dd if=/dev/zero of=swapfile bs=1024 count=500000
设置swapfile空间为swap空间
mkswap swapfile
启动交换空间
swapon swapfile
删除swapfile
spapoff swapfile
rm -f swapfile
开机自动挂载取消
  • Centos7 时间同步
阿里云提供了7个NTP时间服务器也就是Internet时间同步服务器地址
ntp1.aliyun.com
ntp2.aliyun.com
ntp3.aliyun.com
ntp4.aliyun.com
ntp5.aliyun.com
ntp6.aliyun.com
ntp7.aliyun.com
国外VPS配置利用NTP服务+Internet时间同步服务器校准为国内时间:
本例以 centos7 为例
yum install ntp
3、启动ntp服务
systemctl start ntpd.service
4、设置开机启动
systemctl enable ntpd.service
5、修改配置文件
vim /etc/ntp.conf
以下四行注释掉
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
添加
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst
server ntp3.aliyun.com iburst
server ntp4.aliyun.com iburst
server ntp5.aliyun.com iburst
server ntp6.aliyun.com iburst
server ntp7.aliyun.com iburst
6、重启ntpd服务
systemctl restart ntpd
7、检查服务(时间服务不是时时的可以间隔一会再检查)
ntpstat
date
  • 设定东八时区
Linux里面用Asia/Shanghai表示东八区,等价于Windows中的 北京、重庆、香港特别行政区,乌鲁木齐的时区设置
rm -rf /etc/localtime
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
重启服务
systemctl restart ntpd
时区设置:
列出时区:  timedatectl list-timezones
设置时区:timedatectl set-timezone Asia/Shanghai
  • linux使用pam_tally2.so模块限制登录3次失败后禁止5分钟
在线上的服务器有时需要限制用户登录次数.这个功能可以通过pam的pam_tally2.so模块来实现
PAM模块是用sun提出的一种认证机制
pam_tally2.so模块
一.格式
pam_tally2.so [file=/path/to/counter] [onerr=[fail|succeed]] [magic_root] [even_deny_root] [deny=n] [lock_time=n] [unlock_time=n]
[root_unlock_time=n] [serialize] [audit] [silent] [no_log_info]
参数:
  file:指定统计次数用的文件,默认是/var/log/tallylog
  magic_root:如果用户uid=0,在帐户认证时调用该模块发现失败时,不计入统计
  even_deny_root:root用户一样被锁定
  deny:普通用户锁定次数
lock_time:普通用户锁定后等待的时间
unlock_time:普通用户锁定后解锁要等待的时间
二.实例
auth required pam_tally2.so deny=3 unlock_time=300 even_deny_root root_unlock_time=300 
/etc/pam.d/login中配置只在本地文本终端上做限制
/etc/pam.d/kde在配置时在kde图形界面调用时限制
/etc/pam.d/sshd中配置时在通过ssh连接时做限制
/etc/pam.d/system-auth中配置凡是调用 system-auth 文件的服务,都会生效
三.查看命令
查看root用户的登录失败的次数
pam_tally2   --user root
重置计数器,即手动解锁
pam_tally2   --user root --reset
  • su到普通用户,使用计划任务报错
报错:/lib/security/pam  无该文件,原因路径错误,正确路径:/lib64/security/pam_tally2.so	
  • Centos Failed to start LSB:Bring up/down
systemctl restart network  报错如上
查看报错日志
journalctl -xe
日志: Bringing up interface ens33.old
删除多余的ifcfg-**配置文件,重启成功
  • sudo: effective uid is not 0, is sudo installed setuid root
当普通用户需要临时使用root权限的时候需要执行sudo命令,但是在执行sudo命令的时候需要使用root的权限去执行/usr/bin/sudo二进制文件。
如果报错出现sudo: effective uid is not 0, is sudo installed setuid root
证明/usr/bin/sudo文件没有设置s权限(用户在执行文件的时候,临时拥有文件所有者的权限)

解决方法:
chmod u+s /usr/bin/sudo
加上权限之后再查看文件 ll  /usr/bin/sudo会看到:
---s--x--x 1 root root 123832 Jan  2 18:57 /usr/bin/sudo
  • ubuntu默认使用nano修改
sudo update-alternatives --config editor ->3
nano基本操作:
编辑后ctrl+o ->Enter->ctrl + x 退出
  • 解决umount target is busy的报错
原因:磁盘正在被使用
方法1: yum install psmic -y
fuser -mv /mnt
fuser -kv /mnt
umount /mnt 
参数说明:
-k,--kill kill   processes accessing the named file
-m,--mount    show all processes using the named filesystems or block device
-v,--verbose    verbose output
方法2:
lsof | grep /mnt
kill -9  进程号
  • 设置系统语言
locale #查看系统拥有的语言包
永久修改
vi /etc/locale.conf
LANG=en_US.UTF8
或者
localectl set-locale LANG=en_US.UTF8
posted @ 2021-03-24 17:17  独孤云翔  阅读(173)  评论(0)    收藏  举报