zoukankan      html  css  js  c++  java
  • 使用ubuntu的一些操作笔记20191203

    前言

    环境: virtualbox + Ubuntu 16.04

    情况:

    • 可以进入虚拟机中Ubuntu系统的桌面,但是外部可以访问到 ssh,输入正确的用户名和密码无法登录
    • 无法正常启动 Apache

    最后解决方法是 增加一个新用户并分配为sudoers,然后外部可以通过ssh 方式可以登录进服务器中


    Apache 无法启动的修复笔记

    apachectl configtest
    

    输出:

    AH00526: Syntax error on line 109 of /etc/apache2/apache2.conf:
    Error:	Apache has not been designed to serve pages while
    	running as root.  There are known race conditions that
    	will allow any local user to read any file on the system.
    	If you still desire to serve pages as root then
    	add -DBIG_SECURITY_HOLE to the CFLAGS env variable
    	and then rebuild the server.
    	It is strongly suggested that you instead modify the User
    	directive in your httpd.conf file to list a non-root
    	user.
    
    Action 'configtest' failed.
    The Apache error log may have more information.
    

    /etc/apache2/apache2.conf 109行左右是

    # These need to be set in /etc/apache2/envvars
    User ${APACHE_RUN_USER}
    Group ${APACHE_RUN_GROUP}
    

    apache的环境变量文件/etc/apache2/envvars

    修改里面的用户名为稍后需要新增的新用户名www-data2

    # /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
    #export APACHE_RUN_USER=www-data
    #export APACHE_RUN_GROUP=www-data
    export APACHE_RUN_USER=www-data2
    export APACHE_RUN_GROUP=www-data
    

    然后新增用户:

    # add a user name is www-data2
    sudo useradd www-data2
    # set www-data2 user nologin
    sudo usermod -s /sbin/nologin www-data2
    # set www-data2 user to www-data usergroup
    sudo usermod -a -G www-data
    #set www-data2 user home directory is /var/www
    sudo usermod -d /var/www www-data2
    

    新增完用户之后,然后重启 apache sudo service apache2 restart


    apt install 过程中输出

    WARN: /etc is world writable!
    WARN: /etc is group writable!
    WARN: /etc/default/ufw is world writable!
    WARN: /etc/default/ufw is group writable!
    WARN: /etc/default is world writable!
    WARN: /etc/default is group writable!
    WARN: /lib/ufw/ufw-init is world writable!
    WARN: /lib/ufw/ufw-init is group writable!
    WARN: /lib/ufw is world writable!
    WARN: /lib/ufw is group writable!
    WARN: /lib is world writable!
    WARN: /lib is group writable!
    

    重新给上面提示的文件夹恢复文件夹权限

    sudo chmod 755 /etc/ufw
    sudo chmod 644 /etc/ufw/* -R
    sudo chmod 755 /lib/ufw
    sudo chmod 644 /lib/ufw/* -R
    

    References

  • 相关阅读:
    iOS总结_UI层自我复习总结
    runtime梳理。
    页面传值。顺传,逆传。
    用1 + 2 = 3诠释面向对象思想
    循环逻辑。让我逻辑滞空的小题目
    const,static,extern 简介
    swift webView的高度自适应内容
    Swift之UITabBarController 导航控制器颜色的改变
    swift 启动图片的设置
    swift 中使用OC第三方库(以AFNetworking为例)
  • 原文地址:https://www.cnblogs.com/fsong/p/12036906.html
Copyright © 2011-2022 走看看