Hello,
I'm having difficulty understanding sudo and environmental variables.
I'm currently setting up vagrant on a host so I can play with adding and removing linux VMs and try and learn Linux better. Host is CentOS 7.
When I run
boxes are stored in
Code:
# ll /root/.vagrant.d/boxes
total 0
drwxr-xr-x. 3 root root 37 May 5 13:40 minimal-VAGRANTSLASH-centos7
The problem with this, however, is I only have 25 GB on that partition.
Code:
$ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 25G 11G 14G 45% /
I have set up var to store data
Code:
$df -h /var
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg--1tb--mirror-var--mirror 197G 43G 145G 23% /var
Per this post I found that I can set the environmental variable for vagrant to put the Vagrant boxes somewhere else.
https://stackoverflow.com/questions/...he-home-folder
Code:
export VAGRANT_HOME=/path/to/vagrant
So I did
Code:
# cp -r ./.vagrant.d/ /var
then deleted the box file from
/root/.vagrant.d/boxes
and
Code:
$ export VAGRANT_HOME=/var/.vagrant.d
run
and the box is still saved in
/root/.vagrant.d/boxes
So I'm thinking maybe sudo runs a command as root and not just with root permission? I do the same process over again
Code:
$su -
# vi ~/.bash_profile
add the line
export VAGRANT_HOME=/var/.vagrant.d
# cat ~/.bash_profile | grep VAGRANT
export VAGRANT_HOME=/var/.vagrant.d/
# source ~/.bash_profile
drop back into my user profile
boxes are still being saved to
Code:
$ sudo ls -lah /root/.vagrant.d/boxes
[sudo] password for langenoir:
total 0
drwxr-xr-x. 3 root root 42 May 5 14:07 .
drwxr-xr-x. 7 root root 119 May 5 14:07 ..
drwxr-xr-x. 3 root root 37 May 5 14:07 minimal-VAGRANTSLASH-centos7
I really don't understand what is going on here. I keep reading that sudo elevates user permissions. I thought that means it gives my user root permissions temporarily to run a command. I'm guessing that is wrong.