我試圖在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應用的正確方法是什麼? (當其他用戶嘗試訪問應用程序時將來未遇到權限問題)
在服務器中,由於我們希望爲每個用戶獲取存儲空間和帶寬,所以我們在服務器上管理了許多用戶這樣,直到今天,我們開始與卡皮斯特拉諾哈哈。
在此先感謝。