美文网首页
centOS7:创建的新用户如何获得写权限

centOS7:创建的新用户如何获得写权限

作者: developerAbble | 来源:发表于2018-05-06 01:53 被阅读19次

    用composer安装tp5,犯了个低级错误:

    [root@centos7 html]# /usr/local/bin/composer create-project topthink/think tp6
    Do not run Composer as root/super user! See https://getcomposer.org/root for details
    

    于是,赶紧切回普通用户,但是普通用户在html下不能创建文件夹。我们以html2文件夹为例:

    • 查找Abble所在的组
    [Abble@centos7 www]$ groups
    Abble
    [Abble@centos7 www]$ 
    
    • 将文件所属组改变
    drwxr-xr-x 2 root root  4096 5月   6 01:49 html2
    [root@centos7 www]# chown root:Abble html2
    [root@centos7 www]# ll
    
    • 改变组权限,给予写权限
    drwxr-xr-x 2 root Abble 4096 5月   6 01:49 html2
    [root@centos7 www]# 
    [root@centos7 www]# 
    [root@centos7 www]# chmod -R 775 html2
    [root@centos7 www]# 
    

    这样,普通用户Abble在组Abble里,便有写权限,可以用composer安装tp5了

    [Abble@centos7 html]$ whereis composer
    composer: /usr/local/bin/composer
    [Abble@centos7 html]$ /usr/local/bin/composer config -g repo.packagist composer https://packagist.phpcomposer.com
    [Abble@centos7 html]$ /usr/local/bin/composer create-project topthink/think tp5
    Installing topthink/think (v5.0.19)
      - Installing topthink/think (v5.0.19): Downloading (100%)         
    Created project in tp5
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    Package operations: 2 installs, 0 updates, 0 removals
      - Installing topthink/think-installer (v1.0.12): Downloading (100%)         
      - Installing topthink/framework (v5.0.19): Downloading (100%)         
    Writing lock file
    Generating autoload files
    [Abble@centos7 html]$ 
    

    相关文章

      网友评论

          本文标题:centOS7:创建的新用户如何获得写权限

          本文链接:https://www.haomeiwen.com/subject/vajyrftx.html