linux 问题

Last updated on November 20, 2024 am

🧙 Questions

☄️ Ideas

ssh无法登录

Operation not permitted
解决方案

可能ssh的配置文件出错

cd .ssh
lsattr
chattr -i authorized_keys

无法切换jenkins用户

解决方案
# su jenkins 无法切换用户
vim /etc/passwd
# 搜索/jenkins
# 修改内容 /bin/false -> /bin/bash

scp远程执行命令 java:command not found

<!-- 远程不行  -->
D:\definesys\ispong_framework>ssh ispong@39.103.180.147 "java -version"
ispong@39.103.180.147's password:
bash: java: command not found

<!-- 本地可以 -->
[ispong@ispong-demo ispong-demo]$ java -version
java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)
解决方案

scp执行的时候指定了用户,是ispong用户,但是ispong用户下并没有java环境配置,只配置了/etc/profile的环境变量

vim ~/.bashrc

# === vim ~/.bashrc === 
export JAVA_HOME=/opt/jdk-1.8
PATH=$PATH:$JAVA_HOME/bin
# === vim ~/.bashrc ===

source ~/.bashrc

ssh-copy-id异常

ssh_exchange_identification: read: Connection reset by peer
解决方案
sudo vim /etc/hosts.allow

# === sudo vim /etc/hosts.allow ===
sshd:ALL
# === sudo vim /etc/hosts.allow ===

sudo service sshd restart

su权限无法免密登录

解决方案
sudo vim /etc/ssh/sshd_config

# === sudo vim /etc/ssh/sshd_config ===
PermitRootLogin yes
# === sudo vim /etc/ssh/sshd_config ===

sudo service sshd restart

sudo vim /etc/sudoers

# === sudo vim /etc/sudoers === 
cloudera ALL =(ALL) NOPASSWD: ALL
# === sudo vim /etc/sudoers ===

Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

解决方案

sudo vi /etc/ssh/sshd_config

- old
PermitRootLogin yes
UsePAM yes
PubkeyAuthentication no


- new
PermitRootLogin no
UsePAM no
PubkeyAuthentication yes


sudo systemctl restart sshd.service
线程数太低
cat /proc/sys/net/core/somaxconn
sysctl -w net.core.somaxconn=1024
# echo 1024 > /proc/sys/net/core/somaxconn

vim /etc/sysctl.conf
net.core.somaxconn=1024
s

linux 问题
https://ispong.isxcode.com/os/linux/linux 问题/
Author
ispong
Posted on
April 19, 2021
Licensed under