修改apache的默认用户和组
2015-09-24 11:41
459 查看
修改apache的默认用户和组
##更改前查看apache的用户和组
egrep -i "user|group" httpd.conf |egrep -v "#|^$"
ps -ef |grep httpd
[root@LAMP conf]# egrep -i "user|group" httpd.conf |egrep -v "#|^$"
User daemon
Group daemon
[root@LAMP lib]# ps -ef |grep httpd
root 43329 1 0 11:09 ? 00:00:00 /application/apache/bin/httpd
daemon 43331 43329 0 11:09 ? 00:00:00 /application/apache/bin/httpd
daemon 43332 43329 0 11:09 ? 00:00:00 /application/apache/bin/httpd
daemon 43333 43329 0 11:09 ? 00:00:00 /application/apache/bin/httpd
daemon 43334 43329 0 11:09 ? 00:00:00 /application/apache/bin/httpd
root 43455 3916 0 11:28 pts/1 00:00:00 grep httpd
[root@LAMP lib]#
#######################
创建用户和组
useradd -s /sbin/nologin -M apache
tail -1 /etc/passwd
###
[root@LAMP ~]# useradd -s /sbin/nologin -M apache
[root@LAMP ~]# tail -1 /etc/passwd
apache:x:502:502::/home/apache:/sbin/nologin
######更改apache的用户和组
egrep -i "user|group" httpd.conf |egrep -v "#|^$"
sed -i 's/User daemon/User apache/g' httpd.conf
sed -i 's/Group daemon/Group apache/g' httpd.conf
egrep -i "user|group" httpd.conf |egrep -v "#|^$"
###
[root@LAMP conf]# egrep -i "user|group" httpd.conf |egrep -v "#|^$"
User daemon
Group daemon
[root@LAMP conf]#
[root@LAMP conf]# sed -i 's/User daemon/User apache/g' httpd.conf
[root@LAMP conf]# sed -i 's/Group daemon/Group apache/g' httpd.conf
[root@LAMP conf]# egrep -i "user|group" httpd.conf |egrep -v "#|^$"
User apache
Group apache
#######重启apache测试是否更改成功
/application/apache/bin/apachectl graceful
ps -ef|grep http
###
[root@LAMP conf]# /application/apache/bin/apachectl graceful
[root@LAMP conf]# ps -ef|grep http
root 43329 1 0 11:09 ? 00:00:00 /application/apache/bin/httpd
apache 43480 43329 0 11:36 ? 00:00:00 /application/apache/bin/httpd
apache 43481 43329 0 11:36 ? 00:00:00 /application/apache/bin/httpd
apache 43482 43329 0 11:36 ? 00:00:00 /application/apache/bin/httpd
apache 43483 43329 0 11:36 ? 00:00:00 /application/apache/bin/httpd
root 43566 3916 0 11:36 pts/1 00:00:00 grep http
[root@LAMP conf]#
全部命令
###查看是否存在apache用户,没就创建apache用户和组
cat /etc/passwd
useradd -s /sbin/nologin -M apache
tail -1 /etc/passwd
##查看现在的apache的用户和组是什么
ps -ef |grep httpd
cd /application/apache/conf/
egrep -i "user|group" httpd.conf |egrep -v "#|^$"
##更改apache的用户和组
sed -i 's/User daemon/User apache/g' httpd.conf
sed -i 's/Group daemon/Group apache/g' httpd.conf
egrep -i "user|group" httpd.conf |egrep -v "#|^$"
##重启看是否更改成功
/application/apache/bin/apachectl graceful
ps -ef|grep http
本文出自 “奋斗吧” 博客,请务必保留此出处http://lvnian.blog.51cto.com/7155281/1697764
##更改前查看apache的用户和组
egrep -i "user|group" httpd.conf |egrep -v "#|^$"
ps -ef |grep httpd
[root@LAMP conf]# egrep -i "user|group" httpd.conf |egrep -v "#|^$"
User daemon
Group daemon
[root@LAMP lib]# ps -ef |grep httpd
root 43329 1 0 11:09 ? 00:00:00 /application/apache/bin/httpd
daemon 43331 43329 0 11:09 ? 00:00:00 /application/apache/bin/httpd
daemon 43332 43329 0 11:09 ? 00:00:00 /application/apache/bin/httpd
daemon 43333 43329 0 11:09 ? 00:00:00 /application/apache/bin/httpd
daemon 43334 43329 0 11:09 ? 00:00:00 /application/apache/bin/httpd
root 43455 3916 0 11:28 pts/1 00:00:00 grep httpd
[root@LAMP lib]#
#######################
创建用户和组
useradd -s /sbin/nologin -M apache
tail -1 /etc/passwd
###
[root@LAMP ~]# useradd -s /sbin/nologin -M apache
[root@LAMP ~]# tail -1 /etc/passwd
apache:x:502:502::/home/apache:/sbin/nologin
######更改apache的用户和组
egrep -i "user|group" httpd.conf |egrep -v "#|^$"
sed -i 's/User daemon/User apache/g' httpd.conf
sed -i 's/Group daemon/Group apache/g' httpd.conf
egrep -i "user|group" httpd.conf |egrep -v "#|^$"
###
[root@LAMP conf]# egrep -i "user|group" httpd.conf |egrep -v "#|^$"
User daemon
Group daemon
[root@LAMP conf]#
[root@LAMP conf]# sed -i 's/User daemon/User apache/g' httpd.conf
[root@LAMP conf]# sed -i 's/Group daemon/Group apache/g' httpd.conf
[root@LAMP conf]# egrep -i "user|group" httpd.conf |egrep -v "#|^$"
User apache
Group apache
#######重启apache测试是否更改成功
/application/apache/bin/apachectl graceful
ps -ef|grep http
###
[root@LAMP conf]# /application/apache/bin/apachectl graceful
[root@LAMP conf]# ps -ef|grep http
root 43329 1 0 11:09 ? 00:00:00 /application/apache/bin/httpd
apache 43480 43329 0 11:36 ? 00:00:00 /application/apache/bin/httpd
apache 43481 43329 0 11:36 ? 00:00:00 /application/apache/bin/httpd
apache 43482 43329 0 11:36 ? 00:00:00 /application/apache/bin/httpd
apache 43483 43329 0 11:36 ? 00:00:00 /application/apache/bin/httpd
root 43566 3916 0 11:36 pts/1 00:00:00 grep http
[root@LAMP conf]#
全部命令
###查看是否存在apache用户,没就创建apache用户和组
cat /etc/passwd
useradd -s /sbin/nologin -M apache
tail -1 /etc/passwd
##查看现在的apache的用户和组是什么
ps -ef |grep httpd
cd /application/apache/conf/
egrep -i "user|group" httpd.conf |egrep -v "#|^$"
##更改apache的用户和组
sed -i 's/User daemon/User apache/g' httpd.conf
sed -i 's/Group daemon/Group apache/g' httpd.conf
egrep -i "user|group" httpd.conf |egrep -v "#|^$"
##重启看是否更改成功
/application/apache/bin/apachectl graceful
ps -ef|grep http
本文出自 “奋斗吧” 博客,请务必保留此出处http://lvnian.blog.51cto.com/7155281/1697764
相关文章推荐
- apache2 无法重新启动
- 隐藏apache版本信息
- Struts2配置 ClassNotFoundException: rg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilt
- 解决Apache/PHP无法启动的问题
- Attempting to start Apache service...but apache doesn't work
- hive 报错 java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
- Simple User Access to Apache HBase
- Apache+PHP+Mysql 配置
- org.apache.poi.ss.usermodel 类操作excel数据遗漏
- org.apache.poi.ss.usermodel 类操作excel数据遗漏
- org.apache.poi.ss.usermodel 类操作excel数据遗漏
- Struts2漏洞频出 祸根是Apache底层代码不严谨
- Apache Log4j使用详细介绍
- CentOS 6.6下的J2EE环境搭建(三)之Apache安装
- ubuntu apache2 wsgi 部署django
- LAMP编译介绍二、 php以fpm的方式结合apache工作
- LAMP编译介绍一、 php以模块化的方式结合apache工作
- Apache Shiro权限框架在SpringMVC+Hibernate中的应用
- hadoop hdfs 读写错误解决:java.io.IOException: Filesystem closed org.apache.hadoop.hdfs.DFSClient.checkOpe
- org.apache.jasper.JasperException: /WEB-INF/jsp/add.jsp(40,24) quote symbol expected