导航:首页 > 器材知识 > 怎么用rsa设备登录公司远程

怎么用rsa设备登录公司远程

发布时间:2022-01-16 05:42:06

『壹』 关于思科设备SSH登录中RSA认证的疑问

不是怎样的。RSA是非对称的加密算法,通信的同时双方都各自产生一对公钥和私钥,通信时,使用对方发送过来的公钥进行加密,然后对方使用自己的私钥解密数据,这个就是RSA的基本原理了
A要向B发送信息,A和B都要产生一对用于加密和解密的公钥和私钥。
2.A的私钥保密,A的公钥告诉B;B的私钥保密,B的公钥告诉A。
3.A要给B发送信息时,A用B的公钥加密信息,因为A知道B的公钥。
4.A将这个消息发给B(已经用B的公钥加密消息)。
5.B收到这个消息后,B用自己的私钥解密A的消息。其他所有收到这个报文的人都无法解密,因为只有B才有B的私钥。

双方使用RSA通信时双方都会产生公钥和密钥的,不会说一方只产生公钥,一方只产生私钥的,这样的话数据就没法解密了,
对于算法我不太懂,具体可参见网络的RSA词条:http://ke..com/view/7520.htm
和非对称算法词条:http://ke..com/view/1490349.htm

『贰』 如何在 Eclipse 中通过 SSH 密钥登录远程服务器

安装了远程系统资源管理器插件后,已经可以从 Eclipse 中直接登录远程服务器。这里要说的是如何使用现有的密钥或创建一个新的密钥,免口令建立 SSH 连接。这样做的好处是既省事又更安全。
使用现有的密钥
首先,到菜单 Window/Preferences

选择 General/Network Connections/SSH2

在这里,可以指定现有的 SSH2 密钥(必须是OpenSSH的标准)
提示:为了避免出现问题,更改SSH配置后,重新启动Eclipse。

创建一个新的密钥 (Key)
点选密钥管理 (Key Management) 标签窗口,创建一个新的密钥。

点击 Generate RSA Key... 按钮,生成一个RSA密钥 。
然后:
添加 comment(inria-gforge-key, 通常可输入:user@host)
输入密码,并确认密码。(连接服务器时需输入一次该密码。如果是专用电脑,可以不设此密码)
复制公共密钥框中的内容,将此公共密钥粘贴到服务器上的 ~/.ssh/authorized_keys 文件中去。
点击保存私钥 (Save Private Key...) 按钮,把私钥保存在一个文件 id_rsa 中。

这样当再从 Eclipse 登录远程服务器时,就不需要服务器上的用户口令了。

『叁』 如何使用RSA密钥登陆ssh

设置root密码

1
使用原密钥登陆远程主机,默认登陆用户为ubuntu
得到远程机IP
如果是aws,在EC2控制台查看一下实例的公有 IP,复制一下
cmd
ssh -i 密钥 [email protected]
2
空密码不让登陆的,所以要给root一个新密码
su
passwd root
输入两次新密码就可以了
END
修改/etc/ssh/sshd_config

修改
vi /etc/ssh/sshd_config

密码登陆

PermitRootLogin yes
StrictModes no
PermitEmptyPasswords yes
PasswordAuthentication yes

密钥登陆

HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_rsa1_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys

如果不想一个个改,也可以复制粘贴

全文如下
#/etc/ssh/sshd_config
# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_rsa1_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes no

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords yes

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM moles and threads)
no

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and to 'no'.
UsePAM yes
生成私钥
ssh-keygen -t dsa /etc/ssh/ssh_host_dsa_key
ssh-keygen -t ecdsa /etc/ssh/ssh_host_ecdsa_key
ssh-keygen -t ed25519 /etc/ssh/ssh_host_ed25519_key
ssh-keygen -t rsa /etc/ssh/ssh_host_rsa_key
ssh-keygen -t rsa1 /etc/ssh/ssh_host_rsa1_key

chmod 600 /etc/ssh/*key
复制公钥到authorized_keys

cat /etc/ssh/ssh*pub>>/home/ubuntu/.ssh/authorized_keys
cat /home/ubuntu/.ssh/authorized_keys >/root/.ssh/authorized_keys
chmod 644 /root/.ssh/authorized_keys

使用ubuntu的私钥就可以登陆了

也可以把/etc/ssh/下的key复制粘贴过来
/etc/ssh/ssh_host_dsa_key
/etc/ssh/ssh_host_ecdsa_key
/etc/ssh/ssh_host_ed25519_key
/etc/ssh/ssh_host_rsa_key

重启远程机

就可以直接用root登陆了
使用密码
ssh [email protected]

或者使用密钥

ssh -i ssh_host_dsa_key root@ip
ssh -i ssh_host_ecdsa_key root@ip
ssh -i ssh_host_ed25519_key root@ip
ssh -i ssh_host_rsa_key root@ip
ssh -i ssh_host_rsa1_key root@ip

『肆』 linux中ssh如何远程执行一条命令,而且不登录远程服务器

一 SSH命令使用技巧

- 远程登录

ssh [email protected]

- 远程执行

ssh [email protected] 'command ...'

- 远程复制

scp [email protected]:/remote/path /local/path

scp /local/path [email protected]:/remote/path

- X forward

ssh -X [email protected]

xcommand ...

- Tunnel / Portforward

ssh -L 1234:remote.machine:4321 [email protected]

ssh -R 1234:local.machine:4321 [email protected]

ssh -L 1234:other.machine:4321 [email protected]

二, 实作

1) 禁止 root 登录

# vi /etc/ssh/sshd_config

PermitRootLogin no

2) 废除密码登录, 强迫使用 RSA 验证(假设 ssh 账户为 user1 )

# vi /etc/ssh/sshd_config

RSAAuthentication yes

PubkeyAuthentication yes

AuthorizedKeysFile .ssh/authorized_keys

PasswordAuthentication no

# service sshd restart

# su - user1

$ mkdir ~/.ssh 2>/dev/null

$ chmod 700 ~/.ssh

$ touch ~/.ssh/authorized_keys

$ chmod 644 ~/.ssh/authorized_keys

登入端:

$ ssh-keygen -t rsa

(按三下 enter 完成﹔不需设密码,除非您会用 ssh-agent 。)

$ scp ~/.ssh/id_rsa.pub [email protected]:id_rsa.pub

(若是 windows client, 可用 puttygen.exe 产生 public key,

然后复制到 server 端后修改之, 使其内容成为单一一行.)

回到 server 端:

$ cat ~/id_rsa.pub >> ~/.ssh/authorized_keys

$ rm ~/id_rsa.pub

$ exit

3) 限制 su / sudo 名单:

# vi /etc/pam.d/su

auth required /lib/security/$ISA/pam_wheel.so use_uid

# visudo

%wheel ALL=(ALL) ALL

# gpasswd -a user1 wheel

4) 限制 ssh 使用者名单

# vi /etc/pam.d/sshd

auth required pam_listfile.so item=user sense=allow file=/etc/ssh_users ōnerr=fail

# echo user1 >> /etc/ssh_users

『伍』 如何在华为交换机中使用ssh登录

用户通过 STelnet登录系统进行ssh登录。

『陆』 使用RSA/DSA秘钥认证协议的ssh登陆过程

生成RSA/DSA过程忽略
认证过程:local 发起请求到remote, remote 生成一个随机数并且使用公钥加密后发送给local, local接收加密数据然后使用私钥解密后再发回remote,remote 验证后判断是正确的私钥,进而允许登录
http://jianjian.blog.51cto.com/35031/123391

『柒』 如何通过ssh远程登录linux系统

1、使用用户名密码登录
在命令行中输入命令:ssh username@ip_address -p port
之后系统会提示输入密码,输入后即可登录
如果不添加-p选项,则默认是22端口
还可以使用-l选项输入用户名:
ssh -l username ip_address -p port
2、使用密钥登录(不使用密码)
首先生成密钥,在任意目录下输入命令:
ssh-keygen -t rsa -P ''
-P表示密码,-P ''表示空密码
之后系统会提示输入生成的密钥文件的文件名,可以输入任意名称,比如id_rsa,回车
系统会在当前目录下生成id_rsa与id_rsa.pub两个文件
在根目录下新建.ssh文件夹,将生成的密钥文件拷贝过去
mkdir -p ~/.ssh
-p选项表示如果文件夹已经存在则不再新建。
然后将之前生成的两个文件都拷贝到.ssh文件夹中
cp id_rsa* ~/.ssh/
把公钥文件id_rsa.pub拷贝到需要登录的服务器上
用scp命令
scp -P port ~/.ssh/id_rsa.pub username@ip_address:~
-P表示要登录服务器的端口好,不加默认为22。
之后系统会提示输入密码,输入即可完成拷贝
登录远程服务器,在用户根目录下新建.ssh文件夹(如果不存在),在其中新建authorized_keys文件(如果不存在),把id_rsa.pub添加到authorized_keys文件中
mkdir -p ~/.ssh
这是在远程服务器上新建ssh文件夹
cat id_rsa.pub >> .ssh/authorized_keys
将id_rsa.pub文件添加到authorized_keys文件中(如文件不存在则新建)
注意:要保证.ssh与authorized_keys用户自己都有写权限
退出当前远程登录,之后就可以不使用密码远程登录了

『捌』 在windows下如何使用密钥对远程登录服务器

在企业的生产中相信各位朋友都会使用远程登录服务器,这样即高效也非常方便,(服务器在西藏,没有远程技术,公司在北京,你只能到西藏与机器相伴,在这里我使用xshell软件),我们使用ssh 服务登录服务器时,如果用用户名和密码登录时(超户基本都叫root,名字知道了,下面你们懂得),极其不安全。如果使用密钥对登录的方式,对咱们的服务器来说,等于又添加了一道枷锁,(让坏人更加难以进入我们的服务器为所欲为)。那么我们就来看一下密钥对如何设置吧

以下过程全程截图

第一步:进入xshell

『玖』 请教如何用ssh连接远程服务器

目前,远程连接服务器的类型有以下几种:
① 文字接口的明文传输:Telnet、RSH为主,很少用到。
② 文字接口的加密传输:以SSH为主,已经取代了上面的明文传输方式。
③ 图形接口:XDMCP、VNC、XRDP等较为常见。
这篇文章只为实战,不为普及概念性知识。所以我只讲解在工作中最常用到的技术SSH。关于SFTP技术和VNC技术,请查阅我的其他博客。
好,先来看一下SSH的相关技术:
SSH,英文全程是Secure Shell Protocol(安全的壳程序协议)。SSH是现在公司基本上都在使用的一种文字接口的加密传输技术,采用的是非对称秘钥系统。

对于SSH的原理,你们可以参考我的另外一篇博客,我把链接贴在这里:
SSH原理

⑴来吧,我们先来查看一下sshd这个服务(这就是SSH的远程连接必须开启的服务,属于系统自带),注意,一般这个sshd服务是默认自动开启的。

注意:切记authorized_keys这个文件的权限必须是644

阅读全文

与怎么用rsa设备登录公司远程相关的资料

热点内容
steam令牌换设备了怎么办 浏览:246
新生测听力仪器怎么看结果 浏览:224
化学试验排水集气法的实验装置 浏览:156
家用水泵轴承位置漏水怎么回事 浏览:131
羊水镜设备多少钱一台 浏览:125
机械制图里型钢如何表示 浏览:19
测定空气中氧气含量实验装置如图所示 浏览:718
超声波换能器等级怎么分 浏览:800
3万轴承是什么意思 浏览:110
鑫旺五金制品厂 浏览:861
苏州四通阀制冷配件一般加多少 浏览:153
江北全套健身器材哪里有 浏览:106
水表阀门不开怎么办 浏览:109
花冠仪表盘怎么显示时速 浏览:106
洗砂机多少钱一台18沃力机械 浏览:489
超声波碎石用什么材料 浏览:607
组装实验室制取二氧化碳的简易装置的方法 浏览:165
怎么知道天然气充不了阀门关闭 浏览:902
公司卖旧设备挂什么科目 浏览:544
尚叶五金机电 浏览:59