Linux使用SSH安全登录
2015-11-19 14:38
519 查看
1.创建用户 test
[root@localhost ~]# useradd test
2.为用户test添加密码
[root@localhost ~]# passwd test
3.然后使用ssh-keygen -t rsa生成秘钥存放目录和秘钥对 -t指定加密方式
[root@localhost ~]#mkdir /home/test
[root@localhost ~]#cd /home/test
[root@localhost ~]#ssh-keygent –r rsa(秘钥文件名)
4.打开xshell→使用创建的用户远程登录服务器→选择工具→用户密钥管理者→生成→(密钥类型选择RSA)→下一步→下一步→下一步→保存为文件(不需要填写密码)
5.使用Xftp工具将生成的文件拷贝到用户家目录下的.ssh/目录下,并改名为authorized_keys;且给该文件赋予600权限
[root@localhost
test]#mv di_rsa_1024 authorized_keys
[root@localhost
test]#chmod 600 authorized_keys
6.然后编辑文件vim /etc/ssh/ssh_config;禁止root/password形式远程登录
[root@localhost ~]#vim /etc/ssh/ssh_config
permitRootlogin no(将yes改为no)
passwordauthentication no(将yes改为no)
[root@localhost ~]#systemctl restart sshd (重启sshd服务)
7.打开xshell→使用创建的用户远程登录服务器→选择工具→用户密钥管理者→(选择用户)→导出
8.登录时选择导出的该文件登录
[root@localhost ~]# useradd test
2.为用户test添加密码
[root@localhost ~]# passwd test
3.然后使用ssh-keygen -t rsa生成秘钥存放目录和秘钥对 -t指定加密方式
[root@localhost ~]#mkdir /home/test
[root@localhost ~]#cd /home/test
[root@localhost ~]#ssh-keygent –r rsa(秘钥文件名)
4.打开xshell→使用创建的用户远程登录服务器→选择工具→用户密钥管理者→生成→(密钥类型选择RSA)→下一步→下一步→下一步→保存为文件(不需要填写密码)
5.使用Xftp工具将生成的文件拷贝到用户家目录下的.ssh/目录下,并改名为authorized_keys;且给该文件赋予600权限
[root@localhost
test]#mv di_rsa_1024 authorized_keys
[root@localhost
test]#chmod 600 authorized_keys
6.然后编辑文件vim /etc/ssh/ssh_config;禁止root/password形式远程登录
[root@localhost ~]#vim /etc/ssh/ssh_config
permitRootlogin no(将yes改为no)
passwordauthentication no(将yes改为no)
[root@localhost ~]#systemctl restart sshd (重启sshd服务)
7.打开xshell→使用创建的用户远程登录服务器→选择工具→用户密钥管理者→(选择用户)→导出
8.登录时选择导出的该文件登录
相关文章推荐
- Linux设备驱动之mmap设备操作
- linux非专业常用命令
- windows和linux下的文件路径表示小结
- Linux 总结用户和用户组管理
- CentOS 7 设置静态IP
- Linux系统启动任务的写法
- 第八天- linux目录结构详细介绍
- Linux(Ubuntu)定时提醒/执行任务
- linux学习之SUID
- CentOS6设置swap分区
- gcc编译器使用方法 arm-linux-gcc常用参数
- Linux或Windows下安装Laravel5.0
- Linux下源码编译安装Mysql
- Linux设备驱动之字符设备驱动
- Linux 删除某个文件之外的所有其它文件
- linux下mysql之修改密码或者创建新用户
- linux ssh 免密码登录
- CentOS 系统查看cpu个数(物理、逻辑、线程)
- Remote Windows®-command executor for Linux
- 。linux中swap分区