Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Front load the includes
- include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
- load include_vagrantfile if File.exist?(include_vagrantfile)
- Vagrant.configure("2") do |config|
- config.vm.base_mac = "022999D56C03"
- config.ssh.username = "ubuntu"
- config.ssh.password = "fbcd1ed4fe8c83b157dc6e0f"
- config.vm.provider "virtualbox" do |vb|
- vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
- vb.customize [ "modifyvm", :id, "--uartmode1", "file", File.join(Dir.pwd, "ubuntu-xenial-16.04-cloudimg-console.log") ]
- end
- end
- # -*- mode: ruby -*-
- # vi: set ft=ruby :
- # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
- VAGRANTFILE_API_VERSION = "2"
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
- config.vm.box = "v0rtex/xenial64"
- config.vm.network :private_network, ip: "10.10.10.10"
- config.ssh.username = 'vagrant'
- config.ssh.password = 'vagrant'
- config.vm.provider :virtualbox do |vb|
- vb.name = "supercool"
- vb.customize ["modifyvm", :id, "--memory", "768"]
- vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
- end
- end
- # -*- mode: ruby -*-
- # vi: set ft=ruby :
- # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
- VAGRANTFILE_API_VERSION = "2"
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
- config.vm.box = "ubuntu/xenial64"
- config.vm.network :private_network, ip: "10.10.10.10"
- config.ssh.insert_key = true
- config.ssh.forward_agent = true
- config.vm.provider :virtualbox do |vb|
- vb.name = "supercool"
- vb.customize ["modifyvm", :id, "--memory", "768"]
- vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
- end
- end
- Vagrant.configure("2") do |config|
- apt-get install -y expect
- echo '#!/usr/bin/expect
- set timeout 20
- spawn sudo passwd ubuntu
- expect "Enter new UNIX password:" {send "ubuntu\r"}
- expect "Retype new UNIX password:" {send "ubuntu\r"}
- interact' > change_ubuntu_password
- chmod +x change_ubuntu_password
- ./change_ubuntu_password
- end
- ssh -i /vagrant/vm01/.vagrant/..../private_key <your vm ip> <your vm port>
- # create a user for log in
- sudo useradd yourusername
- # specify a password
- sudo passwd yourusername
- # then type your password when prompted
- # add the user to sudo group
- sudo adduser yourusername sudo
- # create a home folder for your user
- sudo mkdir /home/yourusername
- # add a shell command for your user (normally /bin/bash)
- sudo vim /etc/passwd
- # find yourusername line, and add /bin/bash to the end.
- # the end result would look like this:
- yourusername:x:1020:1021::/home/yourusername:/bin/bash
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement