VM安装了Solaris10,误选了非联网,SSH无法登陆。遍查GOOGLE,现将解决方法记录如下:
第一步:调通与主机的网络
第一步:调通与主机的网络
# ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
--发现目前没有网卡可用
#dladm show-dev
pcn0 ... #找到网卡名
# ifconfig pcn0 blumb --激活网卡
--更改hosts,netmasks, hostname.xx三个文件
#cd /etc
# cat /hosts
::1 localhost loghost guojj
127.0.0.1 localhost loghost
10.1.199.105 outer #添加这一行,10.1.199.105为要设定的IP
#
# cat /etc/netmasks
# cat /hosts
::1 localhost loghost guojj
127.0.0.1 localhost loghost
10.1.199.105 outer #添加这一行,10.1.199.105为要设定的IP
#
# cat /etc/netmasks
....
10.1.199.0 255.255.255.0 #添加这一行,网络地址与子网掩码
#
#touch hostname.pcn0 #如该文件不存在,则新建
#vi hostname.pcn0
--输入outer即可。
10.1.199.0 255.255.255.0 #添加这一行,网络地址与子网掩码
#
#touch hostname.pcn0 #如该文件不存在,则新建
#vi hostname.pcn0
--输入outer即可。
第二步:更改远程登陆限制
Solari10 默认root不能远程登陆。只要把/etc/ssh/sshd_config里的参数
PermitRootLogin yes (默认为no)
重启即可。
PermitRootLogin yes (默认为no)
重启即可。
第三步 启动SSH服务:
重启之后可能发现SSH还是连不上。这可能是因为SSH服务没有启动.
执行下面命令:
重启之后可能发现SSH还是连不上。这可能是因为SSH服务没有启动.
执行下面命令:
#/lib/svc/method/sshd restart
连接就会成功了. 刚开始这一步搞了好久,22端口就是不通,对Solaris很不熟。
在GOOGLE.COM发现一贴,才方然大悟。记录如下:
Solaris 10
First you can check service ssh with command
bash> svcs | grep ssh
online Jan_21 svc:/network/ssh:default
If status ssh offline, you can make online with command:
bash> svcadm enable -t network/ssh:default
bash> /lib/svc/method/sshd start
Disable service ssh:
bash> svcadm disable -t network/ssh:default
Restart service ssh:
bash> svcadm restart network/ssh:default
bash> /lib/svc/method/sshd restart
Refresh service ssh:
bash> svcadm refresh network/ssh:default
For a root enable connect to host via ssh service
bash> vi /etc/ssh/sshd_config
# Valid options are yes, without-password, no.
PermitRootLogin no
Replace no with yes, after that save the edited configuration.
Don’t forget for the restart service ssh, after edit configuration
bash> svcs | grep ssh
online Jan_21 svc:/network/ssh:default
If status ssh offline, you can make online with command:
bash> svcadm enable -t network/ssh:default
bash> /lib/svc/method/sshd start
Disable service ssh:
bash> svcadm disable -t network/ssh:default
Restart service ssh:
bash> svcadm restart network/ssh:default
bash> /lib/svc/method/sshd restart
Refresh service ssh:
bash> svcadm refresh network/ssh:default
For a root enable connect to host via ssh service
bash> vi /etc/ssh/sshd_config
# Valid options are yes, without-password, no.
PermitRootLogin no
Replace no with yes, after that save the edited configuration.
Don’t forget for the restart service ssh, after edit configuration
本文转自 anranran 51CTO博客,原文链接:
http://blog.51cto.com/guojuanjun/320980