Linux-设置默认启动的服务
Linux-设置默认启动的服务
以ssh服务为例,效果如下:
login as: rootroot@192.168.128.128's password:Server refused to set all environment variablesLast login: Sun Aug 15 17:41:10 2010启动 sshd: [确定][root@cuimh ~]#
?
开始:
?
1. 以root用户登录,输入命令:
[root@cuimh ~]# ls -a. .dmrc .kde .thumbnails.. .gconf .lesshst .viminfoanaconda-ks.cfg .gconfd .local .vimrc.bash_history .gnome2 .mcop .Xauthority.bash_logout .gnome2_private .mozilla .Xresources.bash_profile .gtkrc-2.0 My Documents .xsession-errors.bashrc .ICEauthority .qt.cshrc install.log .scimDesktop install.log.syslog .tcshrc[root@cuimh ~]#
?
2. 编辑 .bash_profile 文件,结果如下:
?
# .bash_profile# Get the aliases and functionsif [ -f ~/.bashrc ]; then . ~/.bashrcfi# User specific environment and startup programsservice sshd startPATH=$PATH:$HOME/binexport PATHunset USERNAME~~~~~~~".bash_profile" 16L, 212C 10,1 全部
?
?
?
3. 保存退出,reboot重启,OK。
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
?
,我是初学者嘛,只是写这个为了以后方便查找,我记忆力不太好!没注意发到论坛了,晕。
感谢! 7 楼 maincoolbo 2010-08-16 疯了!!!! 最近版主管理 的好不严,,,,
再这么搞,我都不想上这个 论坛了,,, 8 楼 mallon 2010-08-16 装个sysv-rc-conf,就不用手工编辑脚本了 9 楼 silence1214 2010-08-17 这样的帖子都能发出来 10 楼 wuyakenihao 2010-08-17 http://wenwen.soso.com/z/q212936895.htm能帮我解决下这个问题吗?谢谢了。我是初学linux。 11 楼 406656983 2010-08-17 不要误导大家啊。。。开机启动怎么是这样设置呢。。。应该是chkconfig sshd on, 或者设置3和5级别启动chkconfig --level 35 sshd on ,或者在/etc/rc.local里添加service sshd start 12 楼 zlowly 2010-08-17 而且不同发行版的Linux有不同的处理方式,例如archlinux里只要改rc.conf里的daemon行就可以了。
所以标题里不要用Linux字样,用你正在使用的发行版的名称吧。 13 楼 mamacmm 2010-08-17 学习了,不能以偏概全啊!
14 楼 tonyruiyu 2010-08-18 chkconfig sshd on
ok? 15 楼 googya 2010-08-20 别发到论坛上来啊,放到自己的博客里就好了啊 16 楼 loamy 2010-08-23 为什么不用chkconfig sshd off 17 楼 psuqqvfp 2010-08-31 感觉没有必要,直接chconfig sshd on就行了,如果想设置它在第几级启动,可以编写 sshd这个脚本 18 楼 mamacmm 2010-09-01 灰常感谢,已经了解到了chkconfig的便捷之处了!