使用 sudo 以另一个用户身份安装 grails
Install grails as another user with sudo
我想在我的 vagrant provision bootstrap bash 文件中安装 grails(以 root 身份执行)。我尝试更改安装,如 grails manual:
所示
curl -s get.gvmtool.net | sudo -u vagrant -H bash
sudo -u vagrant -H bash "$HOME/.gvm/bin/gvm-init.sh"
sudo -u vagrant -H bash gvm install grails
但这会产生错误:
bash: /root/.gvm/bin/gvm-init.sh: Permission denied
bash: gvm: No such file or directory
我做错了什么?
这可行:
curl -s get.sdkman.io | sudo -u vagrant -H bash -i
sudo -u vagrant -H bash -i 'source "$HOME/.sdkman/bin/sdkman-init.sh"; sdk install grails'
The -i (simulate initial login) option
... This means that login-specific resource files such as .profile or .login will be read by the shell. If a command is specified, it is passed to the shell for
execution.
我想在我的 vagrant provision bootstrap bash 文件中安装 grails(以 root 身份执行)。我尝试更改安装,如 grails manual:
所示curl -s get.gvmtool.net | sudo -u vagrant -H bash
sudo -u vagrant -H bash "$HOME/.gvm/bin/gvm-init.sh"
sudo -u vagrant -H bash gvm install grails
但这会产生错误:
bash: /root/.gvm/bin/gvm-init.sh: Permission denied
bash: gvm: No such file or directory
我做错了什么?
这可行:
curl -s get.sdkman.io | sudo -u vagrant -H bash -i
sudo -u vagrant -H bash -i 'source "$HOME/.sdkman/bin/sdkman-init.sh"; sdk install grails'
The -i (simulate initial login) option
... This means that login-specific resource files such as .profile or .login will be read by the shell. If a command is specified, it is passed to the shell for execution.