我试图在AWS-EC2实例上与Capistrano部署一个Rails应用程序,在另一个用户的家中使用默认用户(Ubuntu),但它给了我一个“Permission Denied”错误。这是我的代码:部署Rails应用程序在AWS EC2与Capistrano
server "9.9.9.9", :web, :app, :db, primary: true
set :application, "some_app"
set :user, "ubuntu"
set :keep_releases, 3
set :location, "9.9.9.9"
ssh_options[:keys] = ["~/Keys/serverkey.pem"]
ssh_options[:forward_agent] = true
default_run_options[:pty] = true
set :use_sudo, false
task :hello do
run "echo 'Hello World' > /home/other_user/i_was_here.txt"
end
这是输出:
$ cap hello
* 2013-03-22 14:11:29 executing `hello'
* executing "echo 'Hello World' > /home/other_user/i_was_here.txt"
servers: ["9.9.9.9"]
[9.9.9.9] executing command
** [out :: 9.9.9.9] sh: cannot create /home/other_user/i_was_here.txt: Permission denied
command finished in 798ms
failed: "sh -c 'echo '\\''Hello World'\\'' > /home/other_user/i_was_here.txt'" on 9.9.9.9
出了什么问题?其目的是部署一个Rails应用程序对于其他用户,让我有些疑惑:
- 有没有上的AWS-EC2实例直接与其他用户部署Rails应用程序的方法吗?
- 如果#1的答案是“否”,那么为其他用户使用默认用户Ubuntu部署Rails应用的正确方法是什么? (当其他用户尝试访问应用程序时将来未遇到权限问题)
在服务器中,由于我们希望为每个用户获取存储空间和带宽,所以我们在服务器上管理了许多用户这样,直到今天,我们开始与卡皮斯特拉诺哈哈。
在此先感谢。