cpanel关闭mysql strict mode的方法介绍
首先用putty连接linux终端
vi /etc/my.cnf
在最后一行看到:
sql-mode= NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
保存后service mysqld restart
仿牌空间,美国仿牌空间,荷兰抗投诉空间,仿牌,抗投诉,虚拟主机,空间,VPS,服务器
首先用putty连接linux终端
vi /etc/my.cnf
在最后一行看到:
sql-mode= NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
保存后service mysqld restart
Linux挂载ftp服务器,需要用到一个名为fuse-curlftpfs的包。正常情况下无法通过yum的方式获取此包,因此需要先安装DAG repository
Centos5 64位 wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el5.rf.x86_64.rpm
Centos5 32位 wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el5.rf.i386.rpm
Centos6 64位 wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
Centos6 32位 wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
然后是安装下载的rpm包
rpm -ivh rpmforge-release-0.5.3-1.el5.rf.x86_64.rpm
然后就可以通过yum的方式安装fuse-curlftpfs了
yum install fuse-curlftpfs -y
在Centos6上执行此命令,可能会遇到 Requires: libcurl.so.3 的错误,解决方法:编辑 /etc/yum.repos.d/rpmforge.repo 文件,把 [rpmforge-extras] 项打开,再执行 yum clean all 即可。
接下来就可以挂载ftp了
写法1:curlftpfs ftp://用户名:密码@ftp地址 挂载点 -o codepage=utf8
写法2:curlftpfs ftp://ftp地址 挂载点 -o user=”用户名:密码”
注意:如果提示“fuse: failed to open /dev/fuse: Operation not permitted”,说明你是在使用OpenVZ技术的Linux VPS的,因为OpenVZ技术的缺陷性(所有小鸡共用母鸡的内核)导致无法使用curlftpfs命令,请在Xen或者vmware技术中使用。
开机自动挂载
echo “curlftpfs#用户名:密码@ftp地址 挂载点 fuse rw,allow_other,uid=0,gid=0 0 0” >> /etc/fstab
一、最简单的方法: wget
下面的命令用来下载ftp服务器上指定目录的所有文件
[html] view plain copy print?
wget ftp://IP:PORT/* –ftp-user=xxx –ftp-password=xxx -r
-r 参数表示递归下载;
可以使用–directory-prefix=/mypath/ 指定下载后存储路径;-nH选项可以不在本地创建服务器上的目录结构
另一个令人迷惑的选项是–delete-after,它并不是用来删除服务器上的已下载文件,而是用来删除本机的;
wget之所以是wget而不是wput,它只能进行下载操作,不支持对ftp服务器上的任何写操作,比如删除。
二、可以删除文件的方法:lftp
项目需求是下载ftp服务器上的指定文件夹取内的所有文件,并于下载后删除,wget不能满足要求,于是改写出下面的脚本。
mget命令可以下载多个文件,-E参数表示下载后删除服务器上的文件。
[python] view plain copy print?
#!/bin/bash
#指定ftp服务器的ip
serverip=1.2.3.4
#指定ftp服务器的ftp用户
serveruser=root
#指定ftp服务器的ftp用户密码
serverpass=123456
#指定client主机本地下载文件存放的目录
localdir=./data
logfile=../log/ftp_download.log
#指定server主机的ftp目录
remotedir=./
#指定server主机的主机名
host=test_host
#切换到本地下载文件存放的目录
cd $localdir
#输入开始备份的信息
echo “Starting FTP Download on ” $host
#连接ftp服务器
/usr/bin/lftp << EOF
open $serverip
user $serveruser $serverpass
#切换到server主机的ftp目录
echo "cd " $remotedir
cd $remotedir
#列出ftp服务器ftp目录中文件列表并存放到client中的$localdir中
ls . >> $logfile
#下载ftp服务器ftp目录中的所有文件
mget -E *.txt
#退出ftp服务器
bye
三、其他方法
系统中的ftp命令,和强大的curl。
curl支持FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET 和TFTP,方便在自己的程序中调用。同时支持cookie、代理、密码和证书验证。非常强大。
On this post we are going to show how to quickly patch a common PCI Vulnerability Alert that says something like this:
“The remote service appears to encrypt traffic using SSL protocol version 2?.
In Apache common ports 80 and 443, you need to modify the SSLCipherSuite directive in the httpd.conf or ssl.conf file.
An example would be editing the following lines to something like:
在whm路径
WHM > Apache Configuration > Global Configuration area
1.
SSLProtocol -ALL +SSLv3 +TLSv1
2.
SSLCipherSuite ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:-LOW:-SSLv2:-EXP
After you have done this, if you see you are still getting PCI Compliance vulnerability emails regarding to this issue its probably that cPanel is still allowing SSLv2 on their ports.
To quickly disable SSL version 2 on cPanel ports: 2082, 2083, 2086, 2087, 2095, 2096. You will need to do the following:
edit /var/cpanel/cpanel.config and change nativessl=1 to nativessl=0
This will make cPanel to use sTunnel.
edit /usr/local/cpanel/etc/stunnel/default/stunnel.conf
and add:
1.
options = NO_SSLv2
just below the “Authentication stuff” tab.
After you have done all this you will need to restart cPanel:
1.
/etc/init.d/cpanel restart
Done!
How to quickly check this?
SSH to your server and type the following commands
1.
root@cPanel [~]# openssl s_client -ssl2 -connect localhost:2096
2.
root@cPanel [~]# openssl s_client -ssl2 -connect localhost:2083
3.
root@cPanel [~]# openssl s_client -ssl2 -connect localhost:2087
4.
root@cPanel [~]# openssl s_client -ssl2 -connect localhost:2086
If everything is fine you should receive something like this,
1.
root@cPanel [~]# openssl s_client -ssl2 -connect localhost:2096
2.
CONNECTED(00000003)
3.
write:errno=104
If you see such an error message after logging into cPanel, it says something is broken with the cPanel system. First step you should do is to take a look into the cPanel error log. An eaiest way to do this is, run the following command in command line and reload the WHM/cPanel inteface; that will show you the latest errors while loading the panel.
tail -f /usr/local/cpanel/logs/error_log
Once the error is identified, you may take corrective actions and fix errors. Many errors can be fixed by running a cPanel update, but sometime it needs additional troubleshooting steps.
For example, a sample error we were facing with one of the servers is following.
/usr/local/cpanel/whostmgr/bin/whostmgr: error while loading shared libraries: /usr/local/cpanel/3rdparty/perl/514/lib64/perl5/cpanel_lib/x86_64-linux-64int/auto/Cpanel/Optimizer/Optimizer.so: cannot open shared object file: No such file or directory
Duplicate logaccess: at /usr/local/cpanel/Cpanel/Server.pm line 421.
Cpanel::Server::logaccess(Cpanel::Server=HASH(0x380aed0)) called at /usr/local/cpanel/Cpanel/Server.pm line 365
Cpanel::Server::body_internal_error(Cpanel::Server=HASH(0x380aed0), 500, “No response from subprocess (whostmgr (whostmgr)): The subpro”…) called at /usr/local/cpanel/Cpanel/Server.pm line 313
The error states, there is a missing library for whostmgr binary. We fixed the above error by running the following commands
/scripts/autorepair fix_duplicate_cpanel_rpms
/usr/local/cpanel/scripts/check_cpanel_rpms –fix
vi /etc/sysconfig/iptables
在防火墙加入规则以下
硬盘是比较容易坏掉的设备,使用一段时间后可能会出现坏道等物理故障。当硬盘出现坏道后,若不及时更换或者进行技术上的处理,磁盘的坏道就会越来越多,并会造成频繁死机和数据丢失。最好的处理方法是更换新的磁盘。在临时的情况下,我们应及时屏蔽坏道部分的扇区,不要触动它们。
badblocks是一个检查磁盘是否有坏道的工具,可以以读的方式检查,也可以以写的方式检查。
这里,我使用
badblocks -v /dev/sda
检查是否有坏道,检查结果未出错
badblocks的参数选项
-b blocksize
指定磁盘的区块大小,单位为字节,默认值为“block 4K ”(4K/block)
-c blocksize
每个区块检查的次数,默认是16次
-f
强制在一个已经挂载的设备上执行读写或非破坏性的写测试操作
(我们建议先umount设备,然后再进行坏道检测。仅当/etc/mtab出现误报设备挂载错误的时候可以使用该选项)
-i file
跳过已经显示在file文件中的坏道,而不进行检测(可以避免重复检测)
-o file
把检测结果输出到file文件
-p number
重复搜寻设备,直到在指定通过次数内都没有找到新的坏块位置,默认次数为0
-s
在检查时显示进度
-t pattern
通过按指定的模式读写来检测区块。你可以指定一个0到ULONG_MAX-1的十进制正值,或使用random(随机)。
如果你指定多个模式,badblocks将使用第一个模式检测所有的区块,然后再使用下一个模式检测所有的区块。
Read-only方式仅接受一个模式,它不能接受random模式的。
-v
执行时显示详细的信息
-w
对每个区块都先写入,然后再从它读取信息
[device]
指定要检查的磁盘装置。
[last-block]
指定磁盘装置的区块总数。
[start-block]
指定要从哪个区块开始检查
在内网,从一台服务器传mysql的源码安装包到另外一台服务器时,发生如下的错误:
1. Disable Firewalld Service.
[root@rhel-centos7-tejas-barot-linux ~]# systemctl mask firewalld
2. Stop Firewalld Service.
[root@rhel-centos7-tejas-barot-linux ~]# systemctl stop firewalld
3. Install iptables service related packages.
[root@rhel-centos7-tejas-barot-linux ~]# yum -y install iptables-services
4. Make sure service starts at boot:
[root@rhel-centos7-tejas-barot-linux ~]# systemctl enable iptables
# If you do not want ip6tables, You can skip following command.
[root@rhel-centos7-tejas-barot-linux ~]# systemctl enable ip6tables
5. Now, Finally Let’s start the iptables services.
[root@rhel-centos7-tejas-barot-linux ~]# systemctl start iptables
# If you do not want ip6tables, You can skip following command.
[root@rhel-centos7-tejas-barot-linux ~]# systemctl start ip6tables
Firewalld Service is now disabled and stop, You can use iptables.
关闭 selinux
vi/etc/selinux/config #SELINUX=enforcing SELINUX=disabled
iftop可以用来监控网卡的实时流量(可以指定网段)、反向解析IP、显示端口信息等,详细的将会在后面的使用参数中说明。
如果采用编译安装可以到iftop官网下载最新的源码包。
安装前需要已经安装好基本的编译所需的环境,比如make、gcc、autoconf等。安装iftop还需要安装libpcap和libcurses。
CentOS上安装所需依赖包:
yum install flex byacc libpcap ncurses ncurses-devel libpcap-devel
Debian上安装所需依赖包:
apt-get install flex byacc libpcap0.8 libncurses5
下载iftop
wget http://www.ex-parrot.com/pdw/iftop/download/iftop-0.17.tar.gz
tar zxvf iftop-0.17.tar.gz
cd iftop-0.17
./configure
make && make install
Well to fix this issue just run following command to install Crypt::PasswdMD5
# /usr/local/cpanel/bin/cpanm -n Digest::SHA1 Crypt::PasswdMD5
Once you have run the above code in SSH try Easy Apache again.
install Digest::SHA1 Crypt::PasswdMD5
cpan> install Bundle::CPAN
cpan> reload cpan
cpan> install DateTimecpan> install DBI cpan> install DBD::mysql cpan> install Class::Autouse cpan> install Digest::MD5 cpan> install Digest::SHA1 cpan> install HTML::Template cpan> install Image::Size cpan> install MIME::Lite cpan> install MIME::Wordscpan> install Compress::Zlib cpan> install Net::DNS cpan> install URI::URL cpan> install HTML::Tagset cpan> install HTML::Parser cpan> install LWP::Simple cpan> install LWP::UserAgentcpan> install GD cpan> install Mail::Address cpan> install Unicode::MapUTF8 cpan> install XML::Simple cpan> install IO::WrapTie cpan> install Unicode::CheckUTF8 cpan> install Captcha::reCAPTCHA cpan> install Digest::HMAC_SHA1
文件储存在硬盘上,硬盘的最小存储单位叫做”扇区”(Sector)。每个扇区储存512字节(相当于0.5KB)。
操作系统读取硬盘的时候,不会一个个扇区地读取,这样效率太低,而是一次性连续读取多个扇区,即一次性读取一个”块”(block)。这种由多个扇区组成的”块”,是文件存取的最小单位。”块”的大小,最常见的是4KB,即连续八个 sector组成一个 block。
文件数据都储存在”块”中,那么很显然,我们还必须找到一个地方储存文件的元信息,比如文件的创建者、文件的创建日期、文件的大小等等。这种储存文件元信息的区域就叫做inode,中文译名为”索引节点”。
每一个文件都有对应的inode,里面包含了与该文件有关的一些信息。
df -ih
首先切到根目录 /
cd /
然后执行
for i in /*; do echo $i; find $i | wc -l; done
或者
for i in `ls -1A | grep -v "\.\./" | grep -v "\./"`; do echo "`find $i | sort -u | wc -l` $i"; done | sort -rn | head -10
这样会依次返回/
目录下文件最多的目录,进入这个目录,再执行上述命令,就这样层层深入最终确定是那个目录文件最多
一般情况下,如果这个目录下应该会有数以百万的文件,如果你直接用 rm -rf 目录名
的话效率会很低,可以用下面方法
find 目录 -type f -name '*' -print0 | xargs -0 rm
时间可能会比较久,所以你最好开一个 screen 来处理
/var/spool/postfix/maildrop 下面有很多文件
为了避免,可以执行 crontab -e
在最开头添加 MAILTO='"'
保存,然后 server crond restart
重启 crond
« 上一页 — « Previous entries « 上一页 · 下一页 » Next entries » — 下一页 »