lvxianchao / notes

狗屁不通瞎写的博客
https://coderlxc.com
1 stars 0 forks source link

Jenkins 配置从节点 #33

Open lvxianchao opened 1 year ago

lvxianchao commented 1 year ago

服务端

修改配置文件:/etc/ssh/sshd_config

# 是否允许 root 远程登录
PermitRootLogin yes

# 开启公钥认证
PubkeyAuthentication yes

# 存放登录用户公钥的文件位置
AuthorizedKeysFile .ssh/authorized_keys

客户端

# 一路回车
ssh-keygen -t rsa

客户端~/.ssh/id_rsa.pub 里的内容粘贴到 服务器~/.ssh/authorized_keys 里。

配置别名

# 登录的服务器别名 ssh server 就可以了
Host server 
    # 要登录的服务器ip
    HostName 0.0.0.0
    # 端口
    Port 22
    # 登录名
    User root 
    # 私钥路径
    IdentityFile ~/.ssh/id_rsa 
    ServerAliveInterval 30
    TCPKeepAlive yes