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

2018-05-06  本文已影响19人  developerAbble

用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@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]$ 
上一篇下一篇

猜你喜欢

热点阅读