Ash*_*aam 0 file-permissions laravel artisan
我是Laravel的新手,我发现这个框架非常棒.
工匠也很棒,但使用它有一点问题.
假设我用这样的Artisan创建了一个新的Controller
php artisan make:controller Test
Run Code Online (Sandbox Code Playgroud)
app/Http/Controllers中将有一个名为Test的新文件,该文件的权限为root:root
当我想用我的编辑器通过ftp编辑这个文件时我不能,因为我没有以root用户身份登录.
有没有办法告诉Artisan创建具有www-data组的文件(例如,不执行chown命令)?
由于您具有root shell访问权限,因此以下命令将使用www-data用户执行另一个命令 -
sudo -u www-data php artisan make:controller Test
Run Code Online (Sandbox Code Playgroud)
替换www-data为您的Web服务器运行的用户名,或者您登录FTP服务的用户名.
执行此操作时,控制器将归www-data您所有,这就是您想要的.
注意:不要永远从互联网上运行的命令复制粘贴没有确切知道他们在做什么,尤其是在一个root shell.在这种情况下,-u参数告知sudo以特定用户而不是用户身份执行命令root.从联机帮助页:
-u user, --user=user
Run the command as a user other than the default target user (usually root ). The user may be
either a user name or a numeric user ID (UID) prefixed with the ‘#’ character (e.g. #0 for UID
0). When running commands as a UID, many shells require that the ‘#’ be escaped with a backslash
(‘\’). Some security policies may restrict UIDs to those listed in the password database. The
sudoers policy allows UIDs that are not in the password database as long as the targetpw option
is not set. Other security policies may not support this.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2299 次 |
| 最近记录: |