免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4949 | 回复: 8
打印 上一主题 下一主题

(原创)SUSE LINUX下自动开启FTP服务的脚本 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-12-16 15:51 |只看该作者 |倒序浏览
本帖最后由 chinaboywg 于 2011-03-24 16:10 编辑
  1. #!/bin/bash
  2. #by chinaboyxiaobao


  3. #####edit_config
  4. function vsftpd_conifg()
  5. {
  6. sed 's/\#write_enable=YES/write_enable=YES/g' /etc/vsftpd.conf >/etc/vsftpd.conf.tmp
  7.       mv /etc/vsftpd.conf.tmp /etc/vsftpd.conf

  8.       sed 's/\#local_enable=YES/local_enable=YES/g' /etc/vsftpd.conf >/etc/vsftpd.conf.tmp
  9.       mv /etc/vsftpd.conf.tmp /etc/vsftpd.conf

  10.       sed 's/\#ascii_upload_enable=YES/ascii_upload_enable=YES/g' /etc/vsftpd.conf >/etc/vsftpd.conf.tmp
  11.       mv /etc/vsftpd.conf.tmp /etc/vsftpd.conf

  12.       sed 's/#ascii_download_enable=YES/ascii_download_enable=YES/g' /etc/vsftpd.conf >/etc/vsftpd.conf.tmp
  13.       mv /etc/vsftpd.conf.tmp /etc/vsftpd.conf
  14.       
  15.       cat /etc/vsftpd.conf | sed 's/listen=YES/\#listen=YES/g' > /etc/vsftpd.conf.tmp      
  16.       mv /etc/vsftpd.conf.tmp /etc/vsftpd.conf
  17. }


  18. ### allow root login
  19. function allow_root()
  20. {
  21. sed 's/root/\#root/g' /etc/ftpusers >/etc/ftpusers.tmp
  22.       mv /etc/ftpusers.tmp /etc/ftpusers
  23. }

  24. ###chkconfig vsftpd on
  25. function vsftpd_on()
  26. {
  27. cat /etc/xinetd.d/vsftpd |grep disable | sed 's/yes/no/g' /etc/xinetd.d/vsftpd   >/etc/xinetd.d/vsftpd.tmp      
  28. mv /etc/xinetd.d/vsftpd.tmp  /etc/xinetd.d/vsftpd
  29. }


  30. function pure_ftpd_off()
  31. {
  32. cat /etc/xinetd.d/vsftpd |grep disable | sed 's/no/yes/g' /etc/xinetd.d/pure-ftpd  >/etc/xinetd.d/pure-ftpd.tmp      
  33. mv /etc/xinetd.d/pure-ftpd.tmp  /etc/xinetd.d/pure-ftpd
  34. }


  35. ###restart xinetd
  36. function restart_serv()
  37. {
  38. rcxinetd restart >/dev/null 2>&1
  39.       if [ $? = 0 ]
  40.          then
  41.          echo "SUSE Linux Enterprise Server $i open ftp service successful!"
  42.          else
  43.          echo "SUSE Linux Enterprise Server $i open ftp service failed!"
  44.       fi
  45. }



  46. vsftpd_conifg
  47. allow_root
  48. vsftpd_on
  49. pure_ftpd_off
  50. restart_serv
复制代码

论坛徽章:
0
2 [报告]
发表于 2010-12-16 15:53 |只看该作者
好,支持

论坛徽章:
0
3 [报告]
发表于 2010-12-16 16:21 |只看该作者
收藏下……

论坛徽章:
20
CU大牛徽章
日期:2013-04-17 11:48:26羊年新春福章
日期:2015-03-10 22:39:202015年中国系统架构师大会
日期:2015-06-29 16:11:282015亚冠之平阳省
日期:2015-07-31 09:19:042015七夕节徽章
日期:2015-08-21 11:06:17IT运维版块每日发帖之星
日期:2015-09-30 06:20:002015亚冠之柏太阳神
日期:2015-10-19 20:29:5915-16赛季CBA联赛之天津
日期:2016-11-29 14:03:4315-16赛季CBA联赛之北控
日期:2016-12-24 20:51:492015年辞旧岁徽章
日期:2015-03-03 16:54:15双鱼座
日期:2015-01-12 20:58:532014年中国系统架构师大会
日期:2014-10-14 15:59:00
4 [报告]
发表于 2011-01-07 09:50 |只看该作者
支持

论坛徽章:
0
5 [报告]
发表于 2011-03-16 17:21 |只看该作者
本帖最后由 chinaboywg 于 2011-03-24 16:12 编辑

本脚本仅支持xinetd 下的vsftp方式启动

论坛徽章:
0
6 [报告]
发表于 2011-03-16 18:04 |只看该作者
回复 1#



正在学SUSE,有时间交流下

论坛徽章:
0
7 [报告]
发表于 2011-03-16 18:50 |只看该作者
回复 6# wtuter


    什么是SUSE.......

论坛徽章:
0
8 [报告]
发表于 2011-03-16 18:58 |只看该作者
回复 7# nokia4321


    openSUSE

论坛徽章:
0
9 [报告]
发表于 2011-03-16 19:02 |只看该作者
tks!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP