-
方式1-基于用户密码主控端执行:# 有询问的话一路回车,这将在用户家目录~/.ssh/下生成一对密钥,其中id_rsa为私钥,id_rsa.pub为公钥 ssh-keygen -t rsa主控端执行:# 假设被控端的IP为192.168.0.21 ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.0.21根据提示输入用户密码方式2-直接编辑文件环境192.168.0.10和192.168.0.11两台centos 7服务器需要配置192.168.0.10免密访问192.168.0.11步骤在192.168.0.10执行命令生成ssh密钥,如果没什么特殊需求可以直接回车使用默认配置。公钥文件默认为$HOME/.ssh/id_ed25519.pubssh-keygen -t ed25519拷贝192.168.0.10服务器的$HOME/.ssh/id_ed25519.pub内容在192.168.0.11服务器执行命令mkdir -p $HOME/.ssh touch $HOME/.ssh/authorized_keys chmod 700 $HOME/.ssh chmod 600 $HOME/.ssh/authorized_keys将192.168.0.10的$HOME/.ssh/id_ed25519.pub内容粘贴到192.168.0.11的$HOME/.ssh/authorized_keys从192.168.0.10使用ssh登录192.168.0.11测试是否免密登录。转载自https://www.cnblogs.com/XY-Heruo/p/17477967.html
-
用的是iam创建的用户账号,已经赋予了modelarts_agency委托。在创建notebook,勾选ssh远程开发时候,报错如下: 您的权限不足。用户策略无权限访问接口. User: iam::1610480fd13047bf862c15f19c7e0347:user:user5 is not authorized to perform: kps:SSHKeyPair:list on resource: kps:cn-east-4:1610480fd13047bf862c15f19c7e0347:SSHKeyPair:* because no identity-based policy allows the kps:SSHKeyPair:list action. 请问如何解决,谢谢!
-
ssh登陆后就显示connection refused,能Ping通且虚拟机可移动设备连接好的
-
ubuntu18.04配置好以后登录出现connection refused,但是相互之间能PING通,且虚拟机可移动设备也是连接上的使用了其他同学能登录的板子试过了也不行,试过了好多方法也无法解决,求求帮忙
-
希望能提供 RemoteSSH/SFTP 扩展, 或在资源管理器直接集成。便利运维,增加 鸿蒙PC 使用场景
-
在设置SSH服务时,生成SSH密钥(公钥和私钥)是一个常见的任务。这些密钥用于安全地进行身份验证,无需输入密码。以下是如何生成SSH密钥的步骤: 1. 生成SSH密钥对 首先,您需要在客户端机器上生成一个SSH密钥对。使用ssh-keygen命令来生成密钥对。 ssh-keygen -t rsa -b 4096 -C "your_email@example.com" 1 -t rsa:指定密钥类型为RSA。 -b 4096:指定密钥长度为4096位。 -C “your_email@example.com”:添加注释(通常是您的电子邮件地址),这有助于识别密钥。 执行上述命令后,系统会提示您输入文件名以保存密钥(默认情况下保存在~/.ssh/id_rsa中),以及是否设置密码短语。设置密码短语可以增加额外的安全层,但也可以留空以便免密码连接。 2. 查看生成的密钥文件 生成密钥对后,您的SSH目录(通常是~/.ssh)中将包含以下两个文件: id_rsa:私钥文件。 id_rsa.pub:公钥文件。 3. 将公钥复制到远程服务器 要使用SSH密钥登录到远程服务器,需要将生成的公钥添加到远程服务器上的~/.ssh/authorized_keys文件中。可以使用ssh-copy-id命令来完成此操作: ssh-copy-id user@remote_host 1 user:远程服务器上的用户名。 remote_host:远程服务器的IP地址或域名。 此命令会提示您输入远程服务器用户的密码,并将公钥自动复制到远程服务器的~/.ssh/authorized_keys文件中。 4. 手动复制公钥 (可选) 如果无法使用ssh-copy-id,也可以手动复制公钥。首先查看公钥内容: cat ~/.ssh/id_rsa.pub 1 然后,将输出的内容复制并粘贴到远程服务器上的~/.ssh/authorized_keys文件中。确保文件权限正确: 在远程服务器上执行 mkdir -p ~/.ssh chmod 700 ~/.ssh echo "your_public_key" >> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys 1 2 3 4 5. 测试SSH连接 完成上述步骤后,您应该能够使用SSH密钥进行无密码登录: ssh user@remote_host 1 如果一切正常,您将直接登录到远程服务器,而不需要输入密码。 6. 配置SSH客户端(可选) 为了更方便地管理多个SSH连接,可以在本地机器的~/.ssh/config文件中配置SSH客户端: Host remote_host_alias HostName remote_host User user IdentityFile ~/.ssh/id_rsa 1 2 3 4 这样,您可以通过别名进行连接: ssh remote_host_alias 1 通过以上步骤,您可以生成SSH密钥并配置SSH服务,以便实现更加安全和便捷的无密码登录。 ———————————————— 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 原文链接:https://blog.csdn.net/qq_43420088/article/details/139775270
-
问题现象:从运维容器登录节点时登录报错 ssh: connnect to host xxx port 22: Connection timed out但是ping 内大网ip可以ping通问题分析:1.是否可以ping通:从运维容器ping内大网ip, 可以ping通2.curl 22,12017端口是否可以通:curl 100.79.89.245:12017 不通 curl 100.79.89.245:22 不通3.登录实例节点节点是否可以有对应端口的监听:lsof -i:22 ,lsof -i:12017 有监听4.查看节点防火墙状态:service iptables status ;systemctl status firewalld; 如果打开则关闭防火墙: systemctl stop firewalld.service; systemctl disable firewalld.service service iptables stop5.登录运维容器所在的节点查看网络情况 kubectl get pod --all-namespaces -owide 登录10.17.13.41,1017.13.45两个节点执行:ssh -v 100.79.89.245 -p 22 ,可见网络不通EICommon-region-master01/02/03节点可以联通结论:三层网络,部分网络防火墙没有放通,需要网络将其他node节点的ip段也加入到配置中规避措施:需要网络将其他node节点的ip段也加入到防火墙配置中,具体操作联系网络的oncall
-
【操作步骤&问题现象】1、配置SSH接口信息失败。【截图信息】【日志信息】(可选,上传日志内容或者附件)
-
使用securecrt 登陆 ECS Ubuntu20.0 提示:Key exchange failed. No compatible key exchange method. The server supports these methods: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256 这个问题的原因是,Ubuntu20.0 默认升级了SSH的鉴权算法,而老版本的securecrt不支持了。查了网上的资料:两个解决办法,1,升级securecrt到最新版本2.修改/etc/ssh/sshd_config文件添加KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1然后重启ssh守护进程sudo /etc/init.d/ssh restart再尝试远程,就可以了。
-
1.检查系统是否存在密钥:运行 Git Bash, 在弹出的终端中输入下面提示的代码/.ssh如果提示:No such file or directory 说明你是第一次使用git需要生成密钥。如果不是第一次使用您可以选择使用已有密钥或者重新生成密钥方式。2.备份并生成密钥:备份密钥(可选):mkdir key_backupcp id_rsa* key_backuprm id_rsa*生成新密钥:ssh-keygen -t rsa -C "您的email"在回车中会提示你输入一个密码,这个密码会在你提交项目时使用,如果为空的话提交项目时则不用输入,建议采用不输入密码方式。密钥生成后您可以在你本机系统盘下,您的用户文件夹里发现一个.ssh文件,其中的id_rsa.pub文件里储存的即为刚刚生成的ssh公钥。
-
【功能模块】【操作步骤&问题现象】1、防火墙已关闭2、端口已开启3,香港云ping内地也ping不通,ping谷歌可以ping通【截图信息】【日志信息】(可选,上传日志内容或者附件)
-
NSO使用指南制作NED包 $ ncs-make-package --netconf-ned ./acme-router-yang-files acme --no-netsim 注:./acme-router-yang-files就是yang目录,可以起其他的名字,acme是制作后的ned包的路径,可以起其他名字, --no-netsim是不要生成netsim(模拟器),一定要加上,否则可能会有编译问题 $ cd acme/src; makeMake后只要NED编译成功即可。参考实例:cs/****su root上传zip文件:cd /home/guest/nso-run/packages ftp 10.136.*.*biget *.zipunzip -d TO2_yang yang.zip //TO2_yang是解压的文件夹名称 yang.zip是需要解压的文件名 使用rm -rf *删除*文件夹 开始进行编译yang文件source /home/guest/nso-5.5_new/ncsrcncs-make-package --netconf-ned ./TO2_yang/ TO2_yangsrc --no-netsim --no-fail-on-warnings cd TO2_yangsrc/srcmake cleanmake安装NED包 $ ncs-setup --ned-package ./acme --dest ./ncs-project 注:./ncs-project是ncs安装运行的路径,可以是其他名字登入NSO $ cd ./ncs-project $ ncs// $ ncs_cli -u admin登录进来默认是juniper风格的命令行(即模型驱动cli),可以使用命令switch cli切换为思科风格root@cs-virtual-machine:/home/guest/nso-run/packages/ncs-project# ps -aef //查看当前进程中已存在需要kill的root@cs-virtual-machine:/home/guest/nso-run/packages/ncs-project# kill -9 22660 //kill掉对应的进程号root@cs-virtual-machine:/home/guest/nso-run/packages/ncs-project# ncsroot@cs-virtual-machine:/home/guest/nso-run/packages/ncs-project# ncs_cli -u admin admin connected from 10.136.*.* using ssh on cs-virtual-machineadmin@ncs> switch cli添加设备:admin@ncs# configEntering configuration mode terminal创建用户组:admin@ncs(config)# dePossible completions: devices - The managed devices and device communication settings --- - deactivate - Deactivate a statement describe - Display transparent command informationadmin@ncs(config)# devices authgroups groupPossible completions: The name of the authgroup defaultadmin@ncs(config)# devices authgroups group TO2_M14admin@ncs(config-group-TO2_M14)# default-map remote-name cxm123admin@ncs(config-group-TO2_M14)# default-map remote-password ****admin@ncs(config-group-TO2_M14)# devices deviceUncommitted changes found, commit them? [yes/no/CANCEL] yCommit complete.admin@ncs# configEntering configuration mode terminaladmin@ncs(config)#admin@ncs# configEntering configuration mode terminaladmin@ncs(config)# devices authgroups group TO2_M14admin@ncs(config-group-TO2_M14)# default-map remote-name cxm123admin@ncs(config-group-TO2_M14)# default-map remote-password ****admin@ncs(config-group-TO2_M14)# default-mapPossible completions: action-name - The action to call when a notification is received. callback-node - Invoke a standalone action to retrieve login credentials for managed devices on the 'callback-node' instance. public-key - Use public-key authentication remote-name - Specify device user name remote-password - Specify the remote password remote-secondary-password - Second password for configuration same-pass - Use the local NCS password as the remote password same-secondary-password - Use the local NCS password as the remote secondary password same-user - Use the local NCS user name as the remote user name <cr> -admin@ncs(config-group-TO2_M14)# default-map remote-name cxm123admin@ncs(config-group-TO2_M14)# dePossible completions: default-map - Remote authentication parameters for users not in umap --- - describe - Display transparent command informationadmin@ncs(config-group-TO2_M14)#Possible completions: default-map - Remote authentication parameters for users not in umap umap - Map NCS users to remote authentication parameters --- - commit - Commit current set of changes describe - Display transparent command information exit - Exit from current mode help - Provide help information no - Negate a command or set its defaults pwd - Display current mode path rload - Load configuration from an ASCII file or from terminal, relative to current location top - Exit to top level and optionally run commandadmin@ncs(config-group-TO2_M14)# default-map remote-password ***admin@ncs# devicesPossible completions: check-sync - Check if the NCS config is in sync with the device check-yang-modules - Check if NCS and the devices have compatible YANG modules clear-trace - Clear all trace files commit-queue - List of queued and completed commits connect - Set up sessions to all unlocked devices device - The list of managed devices device-group - Groups of devices disconnect - Close all sessions to all devices fetch-ssh-host-keys - Retrieve SSH host keys from all devices migrate - Migrate the matching devices to a new NED type partial-sync-from - Synchronize parts of the devices' configuration by pulling from the network. profiles - Device profile parameters session-pool - List of pooled NED sessions sync-from - Synchronize the config by pulling from the devices sync-to - Synchronize the config by pushing to the devices创建设备并配置admin@ncs(config)# devices devicePossible completions: A string uniquely identifying the managed device rangeadmin@ncs(config)# devices device M14admin@ncs(config-device-M14)# addPossible completions: add-capability - This action adds a capability to the list of capabilities. address - IP address or host name for the management interfaceadmin@ncs(config-device-M14)# address 125.2.*.*admin@ncs(config-device-M14)# pPossible completions: ping - ICMP ping the device port - Port for the management interface --- - pwd - Display current mode pathadmin@ncs(config-device-M14)# port 830admin@ncs(config-device-M14)# authgroup TO2_M14admin@ncs(config-device-M14)# device-type netconf ned-idPossible completions: lsa-netconf netconf snmpadmin@ncs(config-device-M14)# device-type netconf ned-id netconfPossible completions: <cr>admin@ncs(config-device-M14)# device-type netconf ned-id netconfadmin@ncs(config-device-M14)# trace rawadmin@ncs(config-device-M14)# state admin-state unlockedadmin@ncs(config-device-M14)# ex //随后记得一定要commit配置admin@ncs(config)# devices device M14 ssh fetch-host-keysresult failedinfo Failed to connect to device M14: connection refused//此处由于设备上并未配置对应的信息所致。 在设备上添加配置: aaa local-user <user-name> password irreversible-cipher <irreversible-cipher-password > local-user <user-name> user-group manage-ug local-user <user-name> service-type ssh配置SSH用户的认证方式 ssh user <user-name> authentication-type password配置SSH用户的服务方式为snetconf ssh user <user-name> service-type snetconf生成建立NETCONF连接的知名端口830。 netconf protocol inbound ssh port 830使能SSH服务器端的SNETCONF服务 snetconf server enable此外,需要配置ssh key交换的算法,如下: ssh server hmac sha2_256_96 sha2_256 sha1_96 ssh server key-exchange dh_group_exchange_sha256 dh_group_exchange_sha1 ecdh_sha2_nistp256 ecdh_sha2_nistp384 ecdh_sha2_nistp521 sm2_kep e.g.aaalocal-user cxm123 password irreversible-cipher ***local-user cxm123 user-group manage-uglocal-user cxm123 service-type sshssh user cxm123 authentication-type passwordssh user cxm123 service-type snetconf#netconfprotocol inbound ssh port 830snetconf server enablessh server hmac sha2_256_96 sha2_256 sha1_96ssh server key-exchange dh_group_exchange_sha256 dh_group_exchange_sha1 ecdh_sha2_nistp256 ecdh_sha2_nistp384 ecdh_sha2_nistp521 sm2_kep// NSO:连接设备:获取ssh key:admin@ncs(config)# devices device M14 ssh fetch-host-keysresult updated-uncommittedfingerprint { algorithm ssh-rsa value 89:ea:f4:1a:43:9d:d2:04}fingerprint { algorithm ssh-dss value 69:29:04:b8:98:5c:89}admin@ncs(config)# devices device M14 ssh fetch-host-keysresult unchangedfingerprint { algorithm ssh-rsa value 89:ea:f4:1a:43:9d:d2:04}fingerprint { algorithm ssh-dssvalue 69:29:04:b8:98:5c:89:68}连接设备:admin@ncs(config)# devices device M14 connectresult falseinfo Resource device M14 doesn't existadmin@ncs(config)# commitCommit complete.admin@ncs(config)# show full-configuration devices device M14devices device M14 address 125.2.*.* port 830 ssh host-key ssh-dss key-data "AAAAB3NzaC1kc3MAAAEBAN7eulyCRNy45paRfO/rwLPm+2C+i5420+TrnNbrf9IQIZrA9BrU\ne/HqzUNdOa+o+stqeBkwXuFH5CiRLmBFKzfKF9YRwu5MRrS8dyZUwmhWqZ7PpdgANnsxqQUi\n8TlJb0GC2/2qtZlzmrAhhYVqiB+RlzaLktv2hJ0cdGuifhL5iijkttBYfWVZeadQVBPpHvyW\nHD95IJYlz6jX1Gn6NaOeN7YUBH1TXc1jrzBYs6JbeccUtjJrfbYGfr8VPMGnILDhp+OcE/6z\nuibmsFLcW//ufFxSFI/mwkBzj7uPBdQWsrXdcuNim7WSRL+fopxPzU6g7lAfxmldA9aNUZMk\n5JMAAAAVAMbEhOHwB2uK/K0wK5i1CjpUKr67AAABADrBF0bulZy9MPZpxX4pC8R8tbv9lq6S\nFXopxyNy/ooC6+07dr6BC0IhrY0y93I/g1n0a2b/eAXMP4bV1lvUJL1wZ37/Gs+bPM4CzUBG\nVg2kIDYgXG76sUhm5qEGDfYli+4xz+dLbFm0b+Wan75k+YLsNqZp/1l/t5pW4y7BWgZZPRfE\nByn1h8d0lZAXYrCAcCRWSy7nnG4dhnk1SHbMZiodPeHRLHnhAsCxDlycRCizrrkyeCbUzeUY\nmpPqUx4P+CGZ7zXfA4l2RThDT/OZJPBb8XrIjjQJkbXqCmKpFe5j9mDAkjYMXS15avIw23Rh\n98Fbbbplye+rJH2xPUlC4v8AAAEAS/sGCOLVRW0LINB3PQADEwqDJ6haA79SnqSrWT0Rkx1Y\nsh9F+hziFgmtJlSkoHVxn5pYGFUDVMDXDpef/ykGEYSkJ/xSextbzql/RawrTSWib4XVQkLH\n8QeDsCOBrP4O243loxmVZUUMsOuGWkXTroqknCRxl5Jkdg14bd8RGW2drIpOEBJ1A/FdoGO9\nxmKHembaC+ndPN45ByOFDLUxoUUh6cEkjRQLegmfkqy9WDba3b4AUb+Q8TJiX0ke685tQyU+\nDm3 ==" ! ssh host-key ssh-rsa key-data "AAAAB3NzaC1yc2EAAAADAQABAAABgQCleGJkBqBemHtkX4/DJfeq5e6jkQikkSBzlplZ0WfR\noPb2yf4vkl5kVbU9HmNKd8AhHU+gqIMIxqmiSVh42U4GmtkZjrfBPveCG9aFMkio9m2L+/Wf\nlQepROjhA3QZWY5tTRVpFppGqNUmhCy+S1gNQ369o6Tifb80tge+cBGtvbtUZKZyG6ypL57o\nHH2Ibt+OHfQ7MTwwf7MFl3nAXk00ul5a2+cN1vaVno38uc9DYX4DJiFULiRi4DFch7s7bxum\nZo/KfT/zOjIOCKNN5gzC6OFj3I95/4asqC0gYo3dh6sVi65CnZQsJBjHcNQnziQSiF4hVR7g\nDy9+GwADZk8nhh70Rn9IsQ3jHMEsdMdlORyv7t1kifSU5Ga70vpkGf0fAufL6fdX8QOgq8IA\nHRlNI/303+WJUHMeGDEb2wa2jVCLvT3khY8=" ! authgroup TO2_M14 device-type netconf ned-id netconf trace raw state admin-state unlocked!admin@ncs(config)# devices device M14 connectresult trueinfo (admin) Connected to M14 - 125.2.*.*:830admin@ncs(config)# comm% No modifications to commit.admin@ncs(config)# devices devicePossible completions: A string uniquely identifying the managed device M14 rangeadmin@ncs(config)# devices device M14Possible completions: add-capability - This action adds a capability to the list of capabilities. address - IP address or host name for the management interface apply-template - Take a named template and copy it here authgroup - Authentication credentials for the device capability - A list of capabilities supported by the device check-sync - Check if the NCS config is in sync with the device check-yang-modules - Check if NCS and the device have compatible YANG modules commit-queue - Control settings for the commit queue compare-config - Compare the actual device config with the NCS copy connect - Connect to the device connect-retries - Retry connect on transient errors connect-timeout - Timeout in seconds for new connections copy-capabilities - Note: this action overwrites existing list of capabilities. delete-config - Delete the config in NCS without deleting it on the device description - Free form textual description device-profile - device-type - Management protocol for the device disconnect - Close all sessions to the device find-capabilities - This action overwrites existing list of capabilities. instantiate-from-other-device - Instantiate the config for the device from existing device live-status-protocol - Additional protocols for the live-tree (read-only) load-native-config - Load configuration data in native format local-user - The local user is used when setting up a device connection for call home connections. location - Physical location of devices in the group lsa - Control settings that apply to the communication between this node and the LSA node the setting applies to. migrate - Migrate the device to a new NED type ned-keep-alive - Controls NED keep alive settings ned-settings - Control which device capabilities NCS uses netconf-notifications - NETCONF notifications from the device no-lsa - Do not handle any of the LSA nodes as such. no-overwrite - Control settings for no-overwrite sync check no-wait-for-lock - The action can't be performed while the device is being committed to (or waiting in the commit queue). out-of-sync-commit-behaviour - Specifies the behaviour of a commit operation involving a device that is out of sync with NCS. ping - ICMP ping the device port - Port for the management interface read-timeout - Timeout in seconds used when reading data scp-from - Secure copy file to the device scp-to - Secure copy file to the device session-limits - Parameters for limiting concurrent access to the device. session-pool - Control how sessions to related devices can be pooled. snmp-notification-address - Notification address if different from device address source - How the device was added to NCS ssh - SSH connection configuration ssh-keep-alive - Controls SSH keep alive settings state - Show states for the device sync-from - Synchronize the config by pulling from the device sync-to - Synchronize the config by pushing to the device trace - Trace the southbound communication to devices trace-output - Trace data output mode. use-lsa - Handle the LSA nodes as such. wait-for-lock - The action can't be performed while the device is being committed to (or waiting in the commit queue). write-timeout - Timeout in seconds used when writing data <cr> 同步数据: 从设备同步数据Sync-from admin@ncs(config)# devices device M14 sync-fromresult true把数据同步到设备sync-toadmin@ncs(config)# devices device M14 sync-toresult trueadmin@ncs(config)# 附编译报错常见问题:fail-on-warnings报错解决办法:$ ncs-make-package --netconf-ned ./acme-router-yang-files acme --no-netsim -- no-fail-on-warnings 注:./acme-router-yang-files就是yang目录,可以起其他的名字,acme是制作后的ned包的路径,可以起其他名字, --no-netsim是不要生成netsim(模拟器),一定要加上,否则可能会有编译问题 附件:http://3ms.huawei.com/hi/group/2984357/wiki_6442900.htmlhttp://3ms.huawei.com/hi/group/2984357/wiki_5143095.htmlhttp://3ms.huawei.com/hi/group/3474357/thread_7555819.html?mapId=9329583
-
这里介绍在Windows环境中使用PuTTY SSH远程登录云上Notebook实例的操作步骤。前提条件创建一个Notebook实例,并开启远程SSH开发,配置远程访问IP白名单。该实例状态必须处于“运行中”,具体参见创建Notebook实例章节。在Notebook实例详情页面获取开发环境访问地址(例如:dev-modelarts-cnnorth4.huaweicloud.com)和端口号。图1 Notebook实例详情页面准备好密钥对文件。密钥对在用户第一次创建时,自动下载,之后使用相同的密钥时不会再有下载界面(用户一定要保存好),或者每次都使用新的密钥对。Step1 安装SSH工具下载并安装SSH远程连接工具,以PuTTY为例,下载链接。Step2 使用puttygen将密钥对.pem文件转成.ppk文件下载puttygen,并双击运行puttygen。单击“Load”,上传.pem密钥(即在创建Notebook实例时创建并保存的密钥对文件)。单击“Save private key”,保存生成的.ppk文件。.ppk文件的名字可以自定义,例如key.ppk。图2 将密钥对.pem文件转成.ppk文件Step3 使用SSH工具连接云上Notebook实例运行PuTTY。单击“Session”,填写以下参数。Host Name (or IP address):云上开发环境Notebook实例的访问地址,即在Notebook实例详情页获取的地址。例如:dev-modelarts-cnnorth4.huaweicloud.com。Port:云上Notebook实例的端口,即在Notebook实例详情页获取的端口号。例如:32701。Connection Type:选择 SSH。Saved Sessions:任务名称,在下一次使用PuTTY时就可以单击保存的任务名称,即可打开远程连接。图3 设置Session选择“Window > Translation”,在“Remote character set:”中选择“UTF-8”。图4 设置字符格式选择“Connection > Data”, 在“Auto-login username” 中填写用户名“ma-user”。图5 填写用户名选择“Connection > SSH > Auth”, 单击“Browse”,选择“.ppk文件”(由Step2密钥对.pem文件生成)。单击“Open”。如果首次登录,PuTTY会显示安全警告对话框,询问是否接受服务器的安全证书。单击“Accept”将证书保存到本地注册表中。图6 询问是否接受服务器的安全证书成功连接到云上Notebook实例。图7 连接到云上Notebook实例
-
我们安装完系统以后为了服务器的安全建议修改ssh登录端口,下面是针对新老版本系统修改方法,需要的朋友可以参考下一般情况下打开ssh配置文件sudo vim /etc/ssh/sshd_config找到如下一行:Port 22将后面的22修改为想要设置的端口号然后重启ssh服务sudo service ssh restart如果远程登陆ssh的时候提示:no route to host,应该是防火墙没做好对应端口的配置,设置下防火墙就ok了。没有安装openssh-server的可以参考下面的步骤注意:如果是远程修改端口,为了防止修改端口后远程无法连接SSH,我们可以让SSH同时工作在22和新设定的端口下,等测试能连接到新端口后再将22端口注释掉。首先安装openssh-server$ sudo apt-get install openssh-server$sudo vim /etc/ssh/sshd_config把 #Port 22前面的#去掉,并在下一行添加 你想要使用的端口 例如:Port 222$ sudo vim /etc/ssh/ssh_config把 #Port 22前面的#去掉,并在下一行添加 你想要使用的端口 例如:Port 222修改保存后 重启服务$ /etc/init.d/ssh restart或者$ service ssh restart在防火墙开启相应端口,进行测试 (注意 现在ssh同时工作在22和你设定的端口下,测试完毕后你可以将Port 22注释掉)Ubuntu 16.04修改ssh端口修改/etc/ssh/sshd_config$sudo vim /etc/ssh/sshd_config在Port 22下添加你的端口Port 22Port YOUR_PORT修改/etc/ssh/ssh_config,在Host *下添加你的端口Host *Port 22Port 你的端口# ForwardAgent no...重启sshservice ssh restart再ssh连接新的端口,成功连接后再修改上面的配置把22端口注释掉再在本机~/.ssh/下新建一个config文件,文件内容为:Host YOUR_HOSTUser YOUR_USER_NAMEPort YOUR_NEW_PORT这样下次连接就只需要ssh YOUR_HOST就ok了。修改ssh默认端口后git的一些远程操作会失败,解决办法也是修改config文件:Host github.comHostName github.comPort 22Host bitbucket.orgHostName bitbucket.orgPort 22还有另一种比较快捷的方法:1、设置端口sed -i "s/Port .*/Port 你的端口/g" /etc/ssh/sshd_config2、重启sshservice ssh restart再ssh连接新的端口即可。注意:新端口应该添加了允许访问的列表里,免得将自己锁在了服务器外面!!!参考这里,在 Linux 命令行输入的指令为:firewall-cmd --zone=public --add-port=你的端口/tcp --permanent查看Auth.log,检查SSH是否被扫查看用密码登陆成功的IP地址及次数grep "Accepted password for root" /var/log/auth.log | awk '{print $11}' | sort | uniq -c | sort -nr | more查看用密码登陆失败的IP地址及次数grep "Failed password for root" /var/log/auth.log | awk '{print $11}' | sort | uniq -c | sort -nr | more到此这篇关于ubuntu修改ssh远程连接端口号的方法的文章就介绍到这了转载自https://www.jb51.net/os/Ubuntu/792355.html
-
【功能模块】高斯客户端【操作步骤&问题现象】1、在centos8.2的操作系统环境下,安装了高斯的客户端,当source 配置文件前,sftp和ssh是可以使用的,source配置文件后sftp和ssh不能使用报错:ssh symbol lookup error: /lib64/libk5crypto.so.3: undefined symbol: EVP_KDF_ctrl, version OPENSSL_1_1_1bConnection closed;请问这个问题是高斯客户端中krb5与操作系统的中冲突吗?有没有解决办法。
推荐直播
-
HDC深度解读系列 - Serverless与MCP融合创新,构建AI应用全新智能中枢2025/08/20 周三 16:30-18:00
张昆鹏 HCDG北京核心组代表
HDC2025期间,华为云展示了Serverless与MCP融合创新的解决方案,本期访谈直播,由华为云开发者专家(HCDE)兼华为云开发者社区组织HCDG北京核心组代表张鹏先生主持,华为云PaaS服务产品部 Serverless总监Ewen为大家深度解读华为云Serverless与MCP如何融合构建AI应用全新智能中枢
回顾中 -
关于RISC-V生态发展的思考2025/09/02 周二 17:00-18:00
中国科学院计算技术研究所副所长包云岗教授
中科院包云岗老师将在本次直播中,探讨处理器生态的关键要素及其联系,分享过去几年推动RISC-V生态建设实践过程中的经验与教训。
回顾中 -
一键搞定华为云万级资源,3步轻松管理企业成本2025/09/09 周二 15:00-16:00
阿言 华为云交易产品经理
本直播重点介绍如何一键续费万级资源,3步轻松管理成本,帮助提升日常管理效率!
回顾中
热门标签