ssh-远程登录免密

首先,了解几个常用的linux命令

用户操作

添加用户(useradd),添加密码(passwd),删除用户(useradd)

  1. 添加用户

    useradd +用户名=====================passwd +用户名

  2. 删除用户

    userdel -r +用户名

ssh免密登录

先来两个链接
https://blog.csdn.net/wangzhkai/article/details/80288894
https://blog.csdn.net/m0_37822234/article/details/82494556

  1. 首先创建公钥和私钥

    ssh-keygen 默认生成在 /root/.ssh/id_rsa

  2. 吧公钥传输给需要的登录的linux

    ssh-copy-id username@ip(host) -p port #基本上和ssh 登录一样的操作

设置成功,就是这样子的了
[root@localhost .ssh]# ssh-copy-id yy@192.168.107.133
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
yy@192.168.107.133's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'yy@192.168.107.133'"
and check to make sure that only the key(s) you wanted were added.

posted @ 2019-08-05 22:14  你是猪啊!  阅读(307)  评论(0编辑  收藏  举报