当前位置:   article > 正文

Centos创建用户密钥_contos php 重新生成秘钥

contos php 重新生成秘钥

## SSH 版本查询

[root@localhost .ssh]# ssh -V

OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017

## 新生成密钥

> ssh-keygen -t rsa

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:

SHA256:vmguq2+TYSRdUlPfnlS76bOW+Oi9C/t+KGs/Y1mL/ZQ root@localhost.localdomain

The key's randomart image is:

+---[RSA 2048]----+

|     .o..     .  |

|    . .. . . . . |

|   . o    . o .  |

|  . o      o . o |

|   o    S   o o  |

|    o  .     .  o|

|   . o  .   ..=Eo|

|    = .. .  +*O*.|

|  .+o*o .  o=XX*o|

+----[SHA256]-----+

## 查看生成文件

id_rsa是私钥文件, id_rsa.pub是公钥文件

> [root@localhost .ssh]# ll

总用量 12

-rw-r--r--. 1 root root  398 9月  24 11:12 authorized_keys

-rw-------. 1 root root 1675 9月  24 11:48 id_rsa

-rw-r--r--. 1 root root  408 9月  24 11:48 id_rsa.pub

[root@localhost .ssh]# cat id_rsa

-----BEGIN RSA PRIVATE KEY-----

MIIEogIBAAKCAQEAnrYx94W1iHWnMoGuTT9Bl67kr5ngBdfJT6Rm/qRPaJMjQUjR

aIKYnhscy8zetH1nBCKhsT3uHz33UX6giKlNSUV5/5gqx5O/gdvtoGT8bXQJ1Aob

V5F0RDeZDQY35VfomTOBjEm7hiIP91oUjucgq1FRPZ9XGSF0o8WPaAVp3HvloZtn

yP6qN0ZJ7fXQVHxDtIozkqK5SxnJyb60TI/DjXgw9z+Sed0IgnyXNi26YJdZzgAJ

zson2w9BCAShBGlK78nnWgeLgae4w7JyhkK7mFmOmnNbaBXoGhkH4IVydfCblrb9

iStQzrnCVGsCz8JLgrd0rocAuzZUML7mG459IwIDAQABAoI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9w6Gowdg1eW89xXoUgd6kYDPuoAZ2bnixBDrz9eehPL9kQy4sL

fJdC2mIMD3uO8CU6BjK0MrTI7I3d//Uw+e6ce3xeYzxEYtFxnhfyac1cjqPraTgB

sEBy+jLC5o2NoP+T42H4ivQU1VQ07WySP3LfT3ur4RVibCNwCa4=

-----END RSA PRIVATE KEY-----

> [root@localhost .ssh]# cat id_rsa.pub

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCetjH3hbWIdacyga5NP0GXruSvmeAF18lPpGb+pE9okyNBSNFogpieGxzLzN60fWcEIqGxPe4fPfdRfqCIqU1JRXn/mCrHk7+B2+2gZPxtdAnUChtXkXREN5kNBjflV+iZM4GMSbuGIg/3WhSO5yCrUVE9n1cZIXSjxY9oBWnce+Whm2fI/qo3Rknt9dBUfEO0ijOSorlLGcnJvrRMj8ONeDD3P5J53QiCfJc2Lbpgl1nOAAnOyifbD0EIBKEEaUrvyedaB4uBp7jDsnKGQruYWY6ac1toFegaGQfghXJ18JuWtv2JK1DOucJUawLPwkuCt3SuhwC7NlQwvuYbjn0j root@localhost.localdomain

## 将公钥添加到authorized_keys文件

cat id_rsa.pub >> authorized_keys

### 使用ssh 远程登录操作

> ssh centos@192.168.1.147

### window下, 远程登录操作

C:\Users\bx>ssh centos@192.168.1.147 -i/c:/users/bx/.ssh/centos/rsa-key.pem

Last login: Wed Sep 29 08:34:31 2021 from 192.168.1.249

## windows scp 上传文件

$ scp -i/c:/users/bx/.ssh/root/rsa-key.pem fisco-bcos-logo.3a5e45c.png root@119.23.55.96:/root/fisco/fisco-bcos-browser/deploy/web/static/img

### centos 无法修改/home/centos目录

1.更改所有者:

> chown -R 用户 目录  

eg.

> chown -R centos /home/centos

2.更改权限:

> chmod -R 755 目录

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/158122
推荐阅读
相关标签
  

闽ICP备14008679号