How I should configure permission or another settings

48 views
Skip to first unread message

Edgar Oliveira

unread,
Dec 16, 2015, 6:02:04 PM12/16/15
to Vagrant
Hello,

My experience these is referent used vagrant on the windows 7. And in this system enough install vagrant and virtualbox, setup file Vagrant file with  "config.vm.synced_folder "data", "/var/www"" and let's go! But when I try the same on the Linux (Ubuntu - Linux Mint 17.2) I have many problems. If I put the folder with files php on the folder "data" I don't problems! But when I use CMS WordPress and put the unzip on the folder "data" I can't perform well this files.

In case of the wordpress I can execute the index.php and reach screen config database. But on the next screen, where I config wp-config.php I can't go there. But, if I run chmod -R 777 wordpress/ outside the virtual machine I can arrive this screen (basic I can take a step forward).


This is result referent my folder wordpress on my pc:



And this is a result referent folder wordpress inside the VM:


Thanks

Alvaro Miranda Aguilera

unread,
Dec 16, 2015, 6:28:38 PM12/16/15
to vagra...@googlegroups.com
you need to tell vagrant to set the shared folder with the permissions of the web browser process

what id is that?

ps aux | egrep -i 'nginx|http|apache'

then id <user>

with that i can help you to set that uid/gid

can you share your vagrantfile?

alvaro

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/c73f4f13-d88f-45f0-8e02-f9f3643419a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Edgar Oliveira

unread,
Dec 16, 2015, 6:36:54 PM12/16/15
to Vagrant
Hello,

This is a snapshot referent first command:


And these is my Vagrantfile:


# -*- mode: ruby -*-

# vi: set ft=ruby :


# All Vagrant configuration is done below. The "2" in Vagrant.configure

# configures the configuration version (we support older styles for

# backwards compatibility). Please don't change it unless you know what

# you're doing.

Vagrant.configure(2) do |config|

  # The most common configuration options are documented and commented below.

  # For a complete reference, please see the online documentation at

  # https://docs.vagrantup.com.


  # Every Vagrant development environment requires a box. You can search for

  # boxes at https://atlas.hashicorp.com/search.

  config.vm.box = "02"


  # Disable automatic box update checking. If you disable this, then

  # boxes will only be checked for updates when the user runs

  # `vagrant box outdated`. This is not recommended.

  # config.vm.box_check_update = false


  # Create a forwarded port mapping which allows access to a specific port

  # within the machine from a port on the host machine. In the example below,

  # accessing "localhost:8080" will access port 80 on the guest machine.

   config.vm.network "forwarded_port", guest: 80, host: 8081


  # Create a private network, which allows host-only access to the machine

  # using a specific IP.

   config.vm.network "private_network", ip: "192.168.33.15"


  # Create a public network, which generally matched to bridged network.

  # Bridged networks make the machine appear as another physical device on

  # your network.

  # config.vm.network "public_network"


  # Share an additional folder to the guest VM. The first argument is

  # the path on the host to the actual folder. The second argument is

  # the path on the guest to mount the folder. And the optional third

  # argument is a set of non-required options.

   config.vm.synced_folder "data", "/var/www"


  # Provider-specific configuration so you can fine-tune various

  # backing providers for Vagrant. These expose provider-specific options.

  # Example for VirtualBox:

  #

  # config.vm.provider "virtualbox" do |vb|

  #   # Display the VirtualBox GUI when booting the machine

  #   vb.gui = true

  #

  #   # Customize the amount of memory on the VM:

  #   vb.memory = "1024"

  # end

  #

  # View the documentation for the provider you are using for more

  # information on available options.


  # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies

  # such as FTP and Heroku are also available. See the documentation at

  # https://docs.vagrantup.com/v2/push/atlas.html for more information.

  # config.push.define "atlas" do |push|

  #   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"

  # end


  # Enable provisioning with a shell script. Additional provisioners such as

  # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the

  # documentation for more information about their specific syntax and use.

  # config.vm.provision "shell", inline: <<-SHELL

  #   sudo apt-get update

  #   sudo apt-get install -y apache2

  # SHELL

end


Thanks,

Best Regards


Alvaro Miranda Aguilera

unread,
Dec 16, 2015, 6:41:35 PM12/16/15
to vagra...@googlegroups.com
id www-data will give you uid and gid of that user

then with those numbers create a directory in the host, and set the new shared folder as is said here


is good to have the current one as is, and create a new one

so /vagrant is there for vagrant user


config.vm.synced_folder "foo", "/var/www/foo",
   id: "foo", :mount_options => ["uid=510,gid=510"]



--
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+...@googlegroups.com.

Edgar Oliveira

unread,
Dec 26, 2015, 5:25:33 PM12/26/15
to Vagrant
Hello,

Excuse my delay in responding but I have been away. Ok, I tried your advice:

 config.vm.synced_folder "data", "/var/www/foo",
  id: "foo", :mount_options => ["uid=1001,gid=1001"]

But when I opened my "data" folder on my pc (host) and created a file, for example "calendar.php" the permissions of that file are thus:


I tried use id to the user ede or root, corresponding the users on my pc (host). And now, the uid and gid corresponding the user vagrant, user in my virtual machine:



But, none of them worked.


I don't understand one thing! When I accessed the IP of my guest (virtual machine) I execute the file on this machine how? Which the user accessed them?


NOte: Excuse to my English, but I'm still learning :D   

Thanks


Alvaro Miranda Aguilera

unread,
Dec 27, 2015, 4:44:57 AM12/27/15
to vagra...@googlegroups.com

On Sun, Dec 27, 2015 at 11:25 AM, Edgar Oliveira <edgar.ol...@gmail.com> wrote:
"/var/www/foo",

Hello

What is the output of

ls -al /var/www/foo

And whats the user should be owning all this?

ps aux | egrep -i 'apache|www|web'

Thanks
Alvaro.

Edgar Oliveira

unread,
Dec 27, 2015, 5:50:58 AM12/27/15
to Vagrant
Hello,

The result of all command this is there:

This is my config on the Vagrantfile:


# -*- mode: ruby -*-

# vi: set ft=ruby :


# All Vagrant configuration is done below. The "2" in Vagrant.configure

# configures the configuration version (we support older styles for

# backwards compatibility). Please don't change it unless you know what

# you're doing.

Vagrant.configure(2) do |config|

  # The most common configuration options are documented and commented below.

  # For a complete reference, please see the online documentation at

  # https://docs.vagrantup.com.


  # Every Vagrant development environment requires a box. You can search for

  # boxes at https://atlas.hashicorp.com/search.

  config.vm.box = "02"


  # Disable automatic box update checking. If you disable this, then

  # boxes will only be checked for updates when the user runs

  # `vagrant box outdated`. This is not recommended.

  # config.vm.box_check_update = false


  # Create a forwarded port mapping which allows access to a specific port

  # within the machine from a port on the host machine. In the example below,

  # accessing "localhost:8080" will access port 80 on the guest machine.

   config.vm.network "forwarded_port", guest: 80, host: 8080


  # Create a private network, which allows host-only access to the machine

  # using a specific IP.

  # config.vm.network "private_network", ip: "192.168.33.10"


  # Create a public network, which generally matched to bridged network.

  # Bridged networks make the machine appear as another physical device on

  # your network.

   config.vm.network "public_network", ip: "192.168.1.50"


  # Share an additional folder to the guest VM. The first argument is

  # the path on the host to the actual folder. The second argument is

  # the path on the guest to mount the folder. And the optional third

  # argument is a set of non-required options.

   config.vm.synced_folder "data", "/var/www/foo"


  # Provider-specific configuration so you can fine-tune various

  # backing providers for Vagrant. These expose provider-specific options.

  # Example for VirtualBox:

  #

   config.vm.provider "virtualbox" do |vb|

  #   # Display the VirtualBox GUI when booting the machine

     vb.gui = true

  #

  #   # Customize the amount of memory on the VM:

  #   vb.memory = "1024"

   end

Alvaro Miranda Aguilera

unread,
Dec 27, 2015, 6:01:41 AM12/27/15
to vagra...@googlegroups.com

On Sun, Dec 27, 2015 at 11:50 PM, Edgar Oliveira <edgar.ol...@gmail.com> wrote:

   config.vm.synced_folder "data", "/var/www/foo"


Hello,

You need to replace this:

   config.vm.synced_folder "data", "/var/www/foo"



With

The line you pasted in the previous email.

config.vm.synced_folder "foo", "/var/www/foo",
   id: "foo", :mount_options => ["uid=510,gid=510"]


Run first:
id www-data

and use those numbers for uid (user id) gid (group id)

That will mount the shared folder so the www-data user will be able to read them.

be sure that you need to have the structure that your web server require.

in some cases you want to mount as /var/www and inside that create html


Alvaro.

Edgar Oliveira

unread,
Dec 27, 2015, 6:17:26 AM12/27/15
to Vagrant
It's work!
But I should execute the command "id www-data" inside the VM or on my PC (Host)?
And If I choose the configure (/var/www) I can execute the index.html, relative apache but I can't accessed the folders and files on the folder "data" (on Host) through my browser. Look:


Why?


Edgar Oliveira

unread,
Dec 27, 2015, 6:21:11 AM12/27/15
to Vagrant
Sorry,
I don't refresh my browser, on totality, and can't see all the  result. Ok, but why lost accessed the file index.html? Look:

I can't find file "index.html" inside the VM.


Alvaro Miranda Aguilera

unread,
Dec 27, 2015, 6:12:04 PM12/27/15
to vagra...@googlegroups.com
Hello

The folder is coming from your HOST to the VM

so, you need to configure the webserver to server index.php

you can create an index.html file by hand too

the permission part is done, so now you need to populate the folder as the webserver requires.

Alvaro.


--
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+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages