Advertisement
Guest User

Untitled

a guest
Apr 20th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. # Front load the includes
  2. include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
  3. load include_vagrantfile if File.exist?(include_vagrantfile)
  4.  
  5. Vagrant.configure("2") do |config|
  6. config.vm.base_mac = "022999D56C03"
  7. config.ssh.username = "ubuntu"
  8. config.ssh.password = "fbcd1ed4fe8c83b157dc6e0f"
  9.  
  10. config.vm.provider "virtualbox" do |vb|
  11. vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
  12. vb.customize [ "modifyvm", :id, "--uartmode1", "file", File.join(Dir.pwd, "ubuntu-xenial-16.04-cloudimg-console.log") ]
  13. end
  14. end
  15.  
  16. # -*- mode: ruby -*-
  17. # vi: set ft=ruby :
  18.  
  19. # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
  20. VAGRANTFILE_API_VERSION = "2"
  21.  
  22. Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  23.  
  24. config.vm.box = "v0rtex/xenial64"
  25.  
  26. config.vm.network :private_network, ip: "10.10.10.10"
  27.  
  28. config.ssh.username = 'vagrant'
  29. config.ssh.password = 'vagrant'
  30.  
  31. config.vm.provider :virtualbox do |vb|
  32. vb.name = "supercool"
  33. vb.customize ["modifyvm", :id, "--memory", "768"]
  34. vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  35. end
  36.  
  37. end
  38.  
  39. # -*- mode: ruby -*-
  40. # vi: set ft=ruby :
  41.  
  42. # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
  43. VAGRANTFILE_API_VERSION = "2"
  44.  
  45. Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  46.  
  47. config.vm.box = "ubuntu/xenial64"
  48.  
  49. config.vm.network :private_network, ip: "10.10.10.10"
  50.  
  51. config.ssh.insert_key = true
  52. config.ssh.forward_agent = true
  53.  
  54. config.vm.provider :virtualbox do |vb|
  55. vb.name = "supercool"
  56. vb.customize ["modifyvm", :id, "--memory", "768"]
  57. vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  58. end
  59.  
  60. end
  61.  
  62. Vagrant.configure("2") do |config|
  63. apt-get install -y expect
  64. echo '#!/usr/bin/expect
  65. set timeout 20
  66. spawn sudo passwd ubuntu
  67. expect "Enter new UNIX password:" {send "ubuntu\r"}
  68. expect "Retype new UNIX password:" {send "ubuntu\r"}
  69. interact' > change_ubuntu_password
  70. chmod +x change_ubuntu_password
  71. ./change_ubuntu_password
  72. end
  73.  
  74. ssh -i /vagrant/vm01/.vagrant/..../private_key <your vm ip> <your vm port>
  75.  
  76. # create a user for log in
  77. sudo useradd yourusername
  78.  
  79. # specify a password
  80. sudo passwd yourusername
  81. # then type your password when prompted
  82.  
  83. # add the user to sudo group
  84. sudo adduser yourusername sudo
  85.  
  86. # create a home folder for your user
  87. sudo mkdir /home/yourusername
  88.  
  89. # add a shell command for your user (normally /bin/bash)
  90. sudo vim /etc/passwd
  91. # find yourusername line, and add /bin/bash to the end.
  92. # the end result would look like this:
  93. yourusername:x:1020:1021::/home/yourusername:/bin/bash
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement