我是靠谱客的博主 秀丽百合,这篇文章主要介绍linux普通用户生成密钥,CentOS下非root用户ssh key设置请教,现在分享给大家,希望可以做个参考。

服务器操作系统:CentOS 6.6

想为非root用户建立ssh免密码登录,假设该用户名为otheruser。

我执行的步骤为:

1. 在服务器上生成公钥和密钥

[otheruser@localhost ~]# ssh-keygen -t rsa

所有提示均采用默认选项。将生成的.ssh/id_rsa.pub改名字为authorized_keys,查看.ssh和authorized_keys的权限

[otheruser@localhost ~/.ssh]# cpid_rsa.pub authorized_keys

[otheruser@localhost~/.ssh]# ls -al ~drwx------ 2 otheruser otheruser 4096 May 13 06:50 .ssh[otheruser@localhost~/.ssh]# ls -al ~/.sshdrwx------ 2 otheruser otheruser 4096 May 13 06:50.

drwxrwxr--. 4 otheruser otheruser 4096 May 9 07:23..-rw------- 1 otheruser otheruser 412 May 13 06:50authorized_keys-rw------- 1 otheruser otheruser 1675 May 13 06:48id_rsa-rw------- 1 otheruser otheruser 412 May 13 06:48 id_rsa.pub

可以看出~/.ssh的权限是700,~/.ssh/authorized_keys的权限是600,用户和组均为otheruser。

然后将私钥通过scp拷贝到本地机上。

2. 修改/etc/ssh/sshd_config

添加配置ÿ

最后

以上就是秀丽百合最近收集整理的关于linux普通用户生成密钥,CentOS下非root用户ssh key设置请教的全部内容,更多相关linux普通用户生成密钥,CentOS下非root用户ssh内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(117)

评论列表共有 0 条评论

立即
投稿
返回
顶部