2016-11-18 102 views
0

我正在尝试关注this文档,并在我的EC2实例上安装docker机器。然而,curl命令:AWS EC2权限被拒绝/ usr/local/bin cURL

curl -L https://github.com/docker/machine/releases/download/v0.8.2/docker-machine-`uname -s`-`uname -m` >/usr/local/bin/docker-machine 

与错误退出:

-bash: /usr/local/bin/docker-machine: Permission denied

我想蜷缩成主目录,希望它会改变该目录的权限,然后将其复制到目标,但它没有奏效。

我该如何绕过这个?显然,ec2用户缺少某些目录的root权限。

+0

假设你真的想可能会覆盖任何现有的'在/ usr /本地

[ec2-user ~]$ sudo -v [ec2-user ~]$ 

试试这个/ bin/docker-machine',你可以在命令前添加'sudo'(假设你有'sudo'权限)。 – eddiem

+0

由于这是EC2实例,我只有ec2用户访问权限。也就是说,我不知道如何在这种情况下成为sudo。 – MadPhysicist

+0

你有没有试过http://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html? – eddiem

回答

1

-v When given the -v (validate) option, sudo will update the user's cached credentials, authenticating the user's password if necessary. For the sudoers plugin, this extends the sudo timeout for another 5 minutes (or whatever the timeout is set to by the security policy) but does not run a command. Not all security policies support cached credentials.

ec2-user默认为sudoers列表。如果你想保存的文件对所有可执行

sudo bash -c "curl -L https://github.com/docker/machine/releases/download/v0.8.2/docker-machine-`uname -s`-`uname -m` >/usr/local/bin/docker-machine" 

sudo chmod a+x /usr/local/bin/docker-machine 
+0

你给的作品的命令。但是,无论是因为我在那里复制的上一个目录的现有权限还是因为此命令的结果,'/ usr/local/bin/docker-machine'上的权限都是'-rw -r - r-因此,当我运行'docker-machine version'时,我仍然得到'-bash:/ usr/local/bin/docker-machine:Permission denied'有没有办法使用'sudo bash -c'来更改权限? – MadPhysicist

+1

@MadPhysicist查看我的更新 – helloV

+0

Thanks @helloV!看起来我是在'sudo -v'之后。非常感激! – MadPhysicist