日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > linux >内容正文

linux

修改linux的shell限制,Nginx下解决WebShell访问限制问题

發(fā)布時(shí)間:2025/3/20 linux 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 修改linux的shell限制,Nginx下解决WebShell访问限制问题 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

直入主題公布修改方法

wget http://www.php.net/get/php-5.2.10.tar.gz/from/this/mirror

wget http://php-fpm.org/downloads/php-5.2.10-fpm-0.5.13.diff.gz

tar zxvf php-5.2.10.tar.gz

gzip -cd php-5.2.10-fpm-0.5.13.diff.gz | patch -d php-5.2.10 -p1 //如果你用補(bǔ)丁的話先打補(bǔ)丁再改比較妥當(dāng),我沒(méi)檢查過(guò)補(bǔ)丁有沒(méi)動(dòng)這個(gè)文件

cd php-5.2.10/

./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –with-iconv-dir –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath –enable-discard-path –enable-magic-quotes –enable-safe-mode –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –with-curl –with-curlwrappers –enable-mbregex –enable-fastcgi –enable-fpm –enable-force-cgi-redirect –enable-mbstring –with-mcrypt –enable-ftp –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –without-pear –with-gettext –with-mime-magic –enable-suhosin

vi main/fopen_wrappers.c

找到/* {{{ php_check_open_basedir

*/

PHPAPI int php_check_open_basedir_ex(const char *path, int warn TSRMLS_DC)

{

/* Only check when open_basedir is available */

if (PG(open_basedir) && *PG(open_basedir)) {

char *pathbuf;

char *ptr;

char *end;

// add by anxsoft.com

char *env_doc_root;

if(PG(doc_root)){

env_doc_root = estrdup(PG(doc_root));

}else{

env_doc_root = sapi_getenv("DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT")-1 TSRMLS_CC);

}

if(env_doc_root){

intres_root = php_check_specific_open_basedir(env_doc_root, path TSRMLS_CC);

efree(env_doc_root);

if (res_root == 0) {

return 0;

}

if (res_root == -2) {

errno = EPERM;

return -1;

}

}

// add by anxsoft.com

pathbuf = estrdup(PG(open_basedir));

ptr = pathbuf;

while (ptr && *ptr) {

end = strchr(ptr, DEFAULT_DIR_SEPARATOR);

if (end != NULL) {

*end = '\0';

end++;

}

if (php_check_specific_open_basedir(ptr, path TSRMLS_CC) == 0) {

efree(pathbuf);

return 0;

}

ptr = end;

}

if (warn) {

php_error_docref(NULL TSRMLS_CC, E_WARNING, "open_basedir restriction in effect. File(%s) is not within the allowed path(s): (%s)", path, PG(open_basedir));

}

efree(pathbuf);

errno = EPERM; /* we deny permission to open it */

return -1;

}

/* Nothing to check... */

return 0;

}

/* }}} */

兩個(gè) add by anxsoft.com 中間的是修改加上去的

然后保存,退出。

make ZEND_EXTRA_LIBS=’-liconv’

make install

php.in的open_basedir配置

open_basedir = “/tmp/:/var/tmp/”

總結(jié)

以上是生活随笔為你收集整理的修改linux的shell限制,Nginx下解决WebShell访问限制问题的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。