Solaris10 svcadm使用


Solaris10 使用svcadm管理系统服务,使用这个工具,可以enable、disable和维护系统服务。
enable/disable
[straylight] % svcs network/ssh
STATE STIME FMRI
online Sep_24 svc:/network/ssh:default
我们测试通过ssh方式连接straylight,ssh正常运行
[proxima-centauri] % ssh straylight
Password:********
现在disable ssh
[straylight] % svcadm disable network/ssh

[straylight] % svcs network/ssh
STATE STIME FMRI
disabled 0:56:48 svc:/network/ssh:default
The SMF CLI tools are as follows:
    * inetadm - observe and configure services that are controlled by inetd.
    * svcadm - service administration, including enabling, disabling, and restarting services
    * svccfg - manipulate the contents of the repository, usually properties in a service
    * svcprop - observe property values in a read-only manner. outputs are formalized for easy use in shell scripts.
    * svcs - observe the state of all the service instances on the system, and detailed views of their dependencies, processes, etc.
  1. FTP
默认FTP是关闭的,启动命令: 
# svcadm enable /network/ftp  
此时查看FTP服务状态: 
# svcs -l network/ftp  
默认情况下,root用户无法登录,需要修改/etc/ftpd/ftpusers文件,把root那行前面加个#注释掉就可以了。
  1. SSH
默认SSH是开启的。但是root用户无法登录,需要修改/etc/ssh/sshd_config,把里面的 PermitRootLogin改为yes,再重启ssh服务, 
重启命令: 
# svcadm restart network/ssh
  1. 重启网卡
以前修改/etc/hosts文件的IP后都是通过重启机器来使设置生效的,现在也可以通过下面的命令让它生效,无需重启机器。 
# svcadm restart physical  
在solaris 10下默认就是开放ftp和telnet服务的,可以先确认一下
svcs -l server 
svcs -a|grep server 
bash-3.00# svcs|egrep ftp
online 23:26:42 svc:/network/ftp:default
bash-3.00# svcs|egrep telnet
online 23:26:42 svc:/network/telnet:default
如果看到上面信息说明已经开放,如果状态显示为offline,就必须手动开启服务
bash-3.00# svcadm enable ftp
bash-3.00# svcadm enable telnet