为什么在 Vagrant 当前用户下安装 rvm 时需要另一个用户?

Why need another user when install rvm under current user on Vagrant?

在 Vagrant 中添加了一个名为 deploy 的用户。然后改成deploy用户:

vagrant@vagrant:~$ su - deploy
deploy@vagrant:~$ 

现在安装 rvm:

deploy@vagrant:~$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
gpg: directory `/home/deploy/.gnupg' created
gpg: new configuration file `/home/deploy/.gnupg/gpg.conf' created
gpg: WARNING: options in `/home/deploy/.gnupg/gpg.conf' are not yet active during this run
gpg: keyring `/home/deploy/.gnupg/secring.gpg' created
gpg: keyring `/home/deploy/.gnupg/pubring.gpg' created
gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net
gpg: /home/deploy/.gnupg/trustdb.gpg: trustdb created
gpg: key D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
deploy@vagrant:~$ curl -sSL https://get.rvm.io | bash -s stable
mktemp: failed to create file via template ‘/home/vagrant/.rvm/rvm-exec-test.XXXXXX’: Permission denied

为什么说这个目录:

/home/vagrant/... : Permission denied

我已阅读安装脚本:

https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer

但不知道为什么。

你仍然 运行 来自 /home/vagrant/ 所以在你

vagrant@vagrant:~$ su - deploy
deploy@vagrant:~$ 

你需要做的

deploy@vagrant:~$ cd

因此它将转到部署用户的主文件夹并安装在那里