大文件内容替换命令

如果有一个很大的文件的内容需要替换,比如把db_bianzhi.sql文件中的varchar(510)换成varchar(255),另存为db_new.sql.

可使用如下替换命令:

sed -e “s,varchar(510),varchar(255),” db_bianzhi.sql > db_new.sql

或:

vim -e -c “%s,varchar(510),varchar(255), | wq” db_bianzhi.sql

阅读全文

find ./ ! (-name “.mp3” -o -name “*.avi”) -type f -exec rm -f {} ;

find命令

功能:在目录结构中搜索文件,并执行指定的操作。此命令提供了相当多的查找条件,功能很强大。

语法:find 起始目录 寻找条件操作

说明:find命令从指定的起始目录开始,递归地搜索其各个子目录,查找满足寻找条件的文件并对之采取相关的操作。

阅读全文

proftp–完整配置

shell>tar -zxvf proftpd-1.2.10.tar.gz
shell>./configure –prefix=/usr/local/proftp
shell>make
shell>make install

如果想让系统启动时自动启动proftpd,具体配置如下:

shell>cd proftpd-1.2.10
shell>cp contrib/dist/rpm/proftpd.init.d /etc/rc.d/init.d/proftpd
shell>chkconfig –add proftpd
shell>chmod 755 proftpd
shell>chkconfig –level 3 proftpd on

阅读全文

NFS出错了,Permission denied

今天同事跟我说网站的图片不能显示了,后来检查的时候发现一个NFS的怪异现象。

在mount nfs目录时出现错误:

mount -t nfs 192.168.1.172:/nfs/mp3/mp3files /web/mp3/mp3files
mount: 192.168.1.172:/nfs/mp3/mp3files failed, reason given by server: Permission denied

我原来的/etc/exportfs是这样的:

[root@ha1 nfs]# cat /etc/exports
/nfs/mp3/mp3files 192.168.1.*(rw,async)

一直都用的好好的,其它的机器通过内网IP来mount这台上面的数据。

所以我想应该是我做了什么造成的,因为之前我看到/var/log/messages:

mountd[3082]: Fake hostname rs0.xxxxxxcom for 192.168.1.69 - forward lookup doesn’t exist

阅读全文

用denyhosts来防止ssh攻击

每天服务器都遭受着上千次的SSH失败的尝试:

sshd:
   Authentication Failures:
      root (218.247.185.218): 575 Time(s)
      unknown (218.247.185.218): 224 Time(s)
      unknown (218.247.185.222): 6 Time(s)
      unknown (202.101.72.35): 5 Time(s)
      unknown (202.101.72.36): 5 Time(s)
      unknown (202.101.72.37): 5 Time(s)
      unknown (202.101.72.44): 5 Time(s)
      unknown (202.101.72.32): 4 Time(s)
      unknown (202.101.72.40): 4 Time(s)
      unknown (202.101.72.43): 4 Time(s)
      unknown (202.101.72.45): 4 Time(s)
      unknown (202.101.72.47): 4 Time(s)
      unknown (202.101.72.50): 4 Time(s)
      unknown (202.101.72.53): 4 Time(s)
      unknown (202.101.72.56): 4 Time(s)
      unknown (202.101.72.57): 4 Time(s)
      unknown (202.101.72.60): 4 Time(s)
      unknown (202.101.72.62): 4 Time(s)
      root (218.247.185.222): 3 Time(s)
      unknown (202.101.72.33): 3 Time(s)
      unknown (202.101.72.34): 3 Time(s)
      unknown (202.101.72.38): 3 Time(s)
      unknown (202.101.72.39): 3 Time(s)
      unknown (202.101.72.41): 3 Time(s)
      unknown (202.101.72.48): 3 Time(s)
      unknown (202.101.72.51): 3 Time(s)
      unknown (202.101.72.52): 3 Time(s)
      unknown (202.101.72.54): 3 Time(s)
      unknown (202.101.72.55): 3 Time(s)
      unknown (202.101.72.58): 3 Time(s)
      unknown (202.101.72.61): 3 Time(s)
      unknown (202.101.72.63): 3 Time(s)
      ftp (202.101.72.34): 2 Time(s)
      mail (218.247.185.218): 2 Time(s)
      mysql (218.247.185.218): 2 Time(s)
      news (218.247.185.218): 2 Time(s)
      root (192.168.123.69): 2 Time(s)
      unknown (202.101.72.42): 2 Time(s)
      unknown (202.101.72.46): 2 Time(s)
      unknown (202.101.72.49): 2 Time(s)
      unknown (202.101.72.59): 2 Time(s)
      adm (202.101.72.34): 1 Time(s)
      adm (202.101.72.42): 1 Time(s)
      adm (202.101.72.46): 1 Time(s)
      adm (202.101.72.49): 1 Time(s)
      adm (202.101.72.51): 1 Time(s)
      adm (202.101.72.58): 1 Time(s)
      adm (202.101.72.59): 1 Time(s)
      adm (202.101.72.61): 1 Time(s)
      adm (218.247.185.218): 1 Time(s)
      apache (218.247.185.218): 1 Time(s)
      bin (218.247.185.218): 1 Time(s)
      ftp (202.101.72.33): 1 Time(s)
      ftp (202.101.72.39): 1 Time(s)
      ftp (202.101.72.46): 1 Time(s)
      ftp (202.101.72.58): 1 Time(s)
      ftp (202.101.72.60): 1 Time(s)
      ftp (218.247.185.218): 1 Time(s)
      games (218.247.185.218): 1 Time(s)
      lp (218.247.185.218): 1 Time(s)
      mysql (202.101.72.38): 1 Time(s)
      mysql (202.101.72.39): 1 Time(s)
      mysql (202.101.72.42): 1 Time(s)
      mysql (202.101.72.49): 1 Time(s)
      mysql (202.101.72.51): 1 Time(s)
      mysql (202.101.72.59): 1 Time(s)
      mysql (202.101.72.61): 1 Time(s)
      nobody (218.247.185.218): 1 Time(s)
      operator (218.247.185.218): 1 Time(s)
      postgres (202.101.72.33): 1 Time(s)
      postgres (202.101.72.48): 1 Time(s)
      postgres (202.101.72.49): 1 Time(s)
      postgres (202.101.72.52): 1 Time(s)
      postgres (202.101.72.53): 1 Time(s)
      postgres (202.101.72.54): 1 Time(s)
      rpm (218.247.185.218): 1 Time(s)
      squid (218.247.185.218): 1 Time(s)
      sshd (218.247.185.218): 1 Time(s)
   Invalid Users:
      Unknown Account: 341 Time(s)

阅读全文

作者的图片

阿辉

容器技术及容器集群等分布式系统研究

容器平台负责人

上海