更改目录的权限
find . -type d -exec chmod 755 {} \;
更改文件的权限
find . -type f -exec chmod 644 {} \;
更改php文件的权限
find . -type f -name ‘*.php’ -exec chmod 644 {} \;
定位php.ini
root@server [~]# php -i | grep php.ini
在php.ini中找到
disable_functions =
这一行,在其后面添加需要禁止的危险函数名,以英文逗号分隔。
disable_functions = "apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd, eval, exec, fp, fput, ftp_connect, ftp_exec, ftp_get, ftp_login, ftp_nb_fput, ftp_put, ftp_raw, ftp_rawlist, highlight_file, ini_alter, ini_get_all, ini_restore, inject_code, mysql_pconnect, openlog, passthru, php_uname, phpAds_remoteInfo, phpAds_XmlRpc, phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, posix_setuid, posix_uname, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec, system, xmlrpc_entity_decode"
重启apache服务器
root@server [~]# service restart httpd
查找空目录
find /path -depth -type d -empty
查找空文件
find /path -depth -type f -empty
查找指定文件
find /path -name name_of_file
查找指定类型的文件
find /path -name “*.given_extension”
查找指定权限的txt文件
find /path -name ‘*.txt’ -perm 644
查找指定权限的文件
find /path -perm -permission_bits
查找指定文件名的任意类型文件
find /path -name ‘given_name.*’
查找最近更改的文件
find /path -mtime n
其中n为整数:
0表示最近24小时内
1表示最近48小时内
2表示最近72小时内
查找最近访问的文件
find /path -atime n
其中n为整数:
0表示最近24小时内
1表示最近48小时内
2表示最近72小时内
根据所有者查找文件
find /path -user root
查找并且删除文件
find /path -name mytestfile | xargs rm
一、PHP
重定向单个网页
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.newdomain.com/page.html");
exit();
?>
重定向多个网页
<?php
if (substr($_SERVER['HTTP_HOST'],0,3) != 'www') {
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.'.$_SERVER['HTTP_HOST']
.$_SERVER['REQUEST_URI']);
}
?>
二、.htaccess文件
重定向单个网页
Redirect 301 /old/oldpage.htm /new/http://www.domain.com/newpage.htm
重定向多个网页
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
三、ASP
重定向单个网页
<% Response.Status="301 Moved Permanently" Response.AddHeader='Location','http://www.newdomain.com/' %>
重定向多个网页
<%
If InStr(Request.ServerVariables("SERVER_NAME"),"www") = 0 Then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location","http://www."
& Request.ServerVariables("HTTP_HOST")
& Request.ServerVariables("SCRIPT_NAME")
End if
%>
一、Linux命令
echo "Subject: test" | /usr/sbin/sendmail -v you@domain.com
二、PHP
<?php
$fd = popen("/usr/sbin/sendmail -t","w") or die("Couldn't Open Sendmail");
fputs($fd, "To: me@mydomain.com \n");
fputs($fd, "From: \"Your Name\" <you@domain.com> \n");
fputs($fd, "Subject: Test message from my web site \n");
fputs($fd, "X-Mailer: PHP3 \n\n");
fputs($fd, "Testing. \n");
pclose($fd);
?>
什么是scp
scp就是secure copy,是用来进行远程文件拷贝的。数据传输使用ssh,并且和ssh使用相同的认证方式,提供相同的安全保证。
scp的用法
从远程复制文件foobar.txt到本地
$ scp username@remotehost.com:foobar.txt /some/local/directory
从本地复制文件foobar.txt到远程
$ scp foobar.txt username@remotehost.com:/some/remote/directory
将本地目录foo复制到远程目录bar
$ scp -r foo username@remotehost.com:/some/remote/directory/bar
在两台远程服务器之间传输文件
$ scp username@rh1.com:/some/remote/directory/foobar.txt \
username@rh2.com:/some/remote/directory/
从本地复制两个文件到远程home目录下
$ scp foo.txt bar.txt username@remotehost.com:~
从本地复制文件foobar.txt到远程(非默认端口)
$ scp -P 1122 foobar.txt username@remotehost.com:/some/remote/directory
从远程复制多个文件到本地
$ scp username@remotehost.com:/some/remote/directory/\{a,b,c\} ./
$ scp username@remotehost.com:~/\{foo.txt,bar.txt\} ./
scp可选参数:
参数 解释
-v 和大多数 linux 命令中的 -v 意思一样,用来显示进度。可以用来查看连接,认证,或是配置错误。
-C 使用压缩选项
-P 选择端口。注意 -p 已经被 rcp 使用。
-4 强行使用 IPV4 地址。
-6 强行使用 IPV6 地址。
Recent Comments