Skip to content

Instantly share code, notes, and snippets.

@rudyhuynh
Forked from unfulvio/vagrant_setdate.sh
Created March 27, 2020 05:25
Show Gist options
  • Save rudyhuynh/e2f42129cf22847e2ab13390d98834bb to your computer and use it in GitHub Desktop.
Save rudyhuynh/e2f42129cf22847e2ab13390d98834bb to your computer and use it in GitHub Desktop.
How to change server time on a Vagrant box on Virtualbox
#!/bin/bash
# Log in into the box
vagrant ssh
# VirtualBox syncs host time with guest, so we need to shut off VBox Guest Additions first
sudo service vboxadd-service stop
# Now you can set any date and time
sudo date -s "2020-10-01 10:25:00"
# Want to sync again with host? Restart Guest Additions
# Anyway on the next Vagrant up it will sync again regardless
sudo service vboxadd-service start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment