Vagrant user doesn't seem to natively have sudo/root permissions

47 views
Skip to first unread message

smeeb bimderbupo

unread,
Dec 21, 2016, 7:53:10 PM12/21/16
to Vagrant
I'm trying to determine if there's a bug in Vagrant or in nginx.

I have the following Vagrantfile:

    Vagrant.configure("2") do |config|
      config.vm.box = "hashicorp/precise32"
      config.vm.network "private_network", ip: "10.0.1.7"
      config.vm.network :forwarded_port, guest: 8080, host: 9005
    end

So I run vagrant up && vagrant ssh and the server provisions and spins up. I want to *manually* install nginx on my new VM, so (per the instructions) for installing nginx on Ubuntu 14.04) I then run:

    sudo apt-get update
    sudo apt-get install nginx

nginx installs. I run mkdir ~/mysite and then I change the /etc/nginx/nginx.conf file to:

    worker_processes  1;

    events {
        worker_connections  1024;
    }

    http {
        include       mime.types;
        default_type  application/octet-stream;

        sendfile        on;

        keepalive_timeout  65;

        server {
            listen       8080;
            server_name  localhost;

            location / {
                root   /home/vagrant/mysite
                index  index.html index.htm;
            }

            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
        }
        include servers/*;
    }

And then I run nginx -s reload. The error I receive is:

    vagrant@precise32:~$ nginx -s reload
    nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
    2016/12/22 00:35:20 [emerg] 1423#0: invalid number of arguments in "root" directive in /etc/nginx/nginx.conf:21

My understanding is that `vagrant` should be a user on the VM with sudo access and root permissions. No? Can anyone reproduce this and figure out why I'm unable to reload nginx with my custom `nginx.conf` file? If it can be determined to *not* be a Vagrant issue I'll happily take it up with the nginx folks or possibly StackOverflow. Thanks!

smeeb bimderbupo

unread,
Dec 21, 2016, 8:23:20 PM12/21/16
to Vagrant
Sorry, had a copy n paste error in my original question. The output from running nginx -s reload is:


vagrant@precise32:~$ nginx -s reload
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2016/12/22 00:36:48 [notice] 1442#0: signal process started
2016/12/22 00:36:48 [alert] 1442#0: kill(890, 1) failed (1: Operation not permitted)

Thoughts?

Alvaro Miranda Aguilera

unread,
Dec 22, 2016, 2:55:52 PM12/22/16
to vagra...@googlegroups.com
sudo nginx -s reload



--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/cc759424-53ef-46a8-861a-e56ad5179e0b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages