SecureCRT 连接本地linux虚拟机
通过ssh连接到虚拟机,首先需要在虚拟机中安装openssh-client,如未安装通过命令
[email protected]:~$ sudo apt-get install openssh-server [sudo] password for mhchen: Reading package lists... Done Building dependency tree Reading state information... Done openssh-server is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 323 not upgraded. [email protected]:~$
提示已经安装过openssh-client.
检查sshserver是否启动:
[email protected]:~$ ps -e |grep ssh 2225 ? 00:00:00 ssh-agent 5580 ? 00:00:00 sshd 5651 ? 00:00:00 sshd 5714 ? 00:00:00 sshd 5846 ? 00:00:00 sshd 5887 ? 00:00:00 sshd [email protected]:~$
如果只有ssh-agent说明ssh-server还没启动,需要到/etc/init.d/ssh 执行start,如果看到sshd说明服务已启动。
ssh-server配置文件位于/etc/ssh/sshd_config,在这可定义SSH服务端口,默认22。可定义其他端口如:220,重启服务
[email protected]:~$ sudo /etc/init.d/ssh restart ssh stop/waiting ssh start/running, process 5990 [email protected]:~$
最后确定ssh-server已正常工作。
[email protected]:~$ netstat -tpl (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 mhchen-VirtualBo:domain *:* LISTEN - tcp 0 0 *:ssh *:* LISTEN - tcp 0 0 localhost:ipp *:* LISTEN - tcp6 0 0 [::]:ssh [::]:* LISTEN - tcp6 0 0 ip6-localhost:ipp [::]:* LISTEN - [email protected]:~$
看到ssh的tcp信息就说明ssh-server已经正常运行。
通过secureCRT可远端至服务器了。
检查服务器ip地址。
[email protected]:~$ ifconfig
可以看到eth0的IP地址信息。
时间: 2024-10-26 15:11:58