我尝试创build一个符号链接,但我得到的权限被拒绝。 我怎么知道为什么?
ln -nfs /home/deploy/foo/shared/config/nginx.conf /etc/nginx/sites-enabled/foo ln: failed to create symbolic link `/etc/nginx/sites-enabled/foo': Permission denied
这是我visudo文件的内容:
# This file is managed by Chef. # Do NOT modify this file directly. Defaults !lecture,tty_tickets,!fqdn # User privilege specification root ALL=(ALL) ALL deploy ALL=(ALL) ALL # Members of the group 'sysadmin' may gain root privileges %sysadmin ALL=(ALL) ALL # Members of the group 'sysadmins' may gain root privileges %sysadmins ALL=(ALL) ALL
我以一个名为deploy的用户身份login,我在sysadmins组中。
whoami deploy cat /etc/group deploy:x:1000: sysadmin:x:2300:deploy
正如我们在评论中所讨论的
你应该使用sudo运行你的ln命令:
sudo ln -nfs /home/deploy/foo/shared/config/nginx.conf /etc/nginx/sites-enabled/foo
现在,如果由于Capistrano 3(我不知道)而无法实现这个function,那么您必须为您的deploy用户写入文件夹/etc/nginx/sites-enabled权限。
拥有使用sudo的权限不会以root身份自动运行所有命令。 这将直接消除使用root帐户的僵尸工具的所有安全优势。
您需要通过sudo运行命令,或更改权限,以便您的常规用户帐户可以在那里写入。