Comments (16)
@xinglunxu I tried and yes it works.
Cheers
from ole--vagrant-community.
Change Vagrantfile so that the reverse of standard password vagrant
is the new password.
from ole--vagrant-community.
So, you want to insert this inside Vagrantfile?
config.ssh.password = "tnargav"
Not sure if I get your point correctly.
from ole--vagrant-community.
I am on some communities exposing ports to the big internet ;)
@xinglunxu : where exactly in the "Vagrantfile" to I have to put that in ... context is missing ;(
from ole--vagrant-community.
Here is the reference to how to configure the ssh connection from vagrant to the vm
To change the ssh password, we can just put the setting
config.ssh.password = "tnargav"
anywhere under
Vagrant.configure(2) do |config|
from ole--vagrant-community.
@xinglunxu thx
you have the go for it ;)
from ole--vagrant-community.
@dogi So After I inserted this line and tried to reload the machine, an error like this happened.
I still haven't figure out how to solve it.
But before that, may I ask why are we changing the password of the vagrant ssh?
What is the problem we are trying to solve in this issue post?
I looked at the link from #2 (comment)
But I still didn't get the problem.
from ole--vagrant-community.
Yo, I finally found a way to change the password for ssh by script. But I am almost positive that there is a better way to do this.
So previously, I tried to add config.ssh.password = "tnargav"
into Vagranfile to change the ssh password for vagrant. However, all it does is just change the password that Vagrant uses to ssh the vm. The ssh password of user vagrant will still be unchanged in the vm. That is why there is a connection problem in my previous post.
IMHO, the password setting for ssh is included in the "ole/jessie64" box. Since I cannot find a good way to configure it in Vagrantfile, I decided to change the ssh password after the vm is set up and run using a script file.
It looks like this:
#!/bin/bash
VM_ID=`vagrant global-status | grep community | cut -d' ' -f1`
KEYPATH=`vagrant ssh-config ${VM_ID} | grep "IdentityFile" | cut -d' ' -f4`
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ssh -i ${KEYPATH} [email protected] -p 2222 'bash -s' < ${DIR}/command.sh
This script ssh to the vm and run a local script to change the password.
The local script is like this.
#!/bin/bash
echo -e "<currentpassword>\n<newpassword>\n<newpassword>" | passwd vagrant
Since I changed the password after the vm is set tup, this solution will be system dependent.
from ole--vagrant-community.
@xinglunxu awesome :)
will use this script for the ole template creation ... https://atlas.hashicorp.com/ole/boxes/jessie64
so that later we can just use the easy way of changing the password
from ole--vagrant-community.
Ok, I will modify it a little bit more later. Now it assume that the vagrant is using port 2222 for ssh. I should get it from the "vagrant ssh-config" command instead. Also, it is assuming that the name of the vm is "community". I should make it an argument for the script.
from ole--vagrant-community.
As promised, here is the improved version of the script
The comments inside the script already describe the behavior of it in detail
#!/bin/bash
#Run this script with the machine name to which you want to change the password.
#Run it with "community" for development environment and "ole" for production environment
#Example: "sh changepassword.sh community"
#parse the name of the vm machine from command line argument
VM_NAME=$1
VM_ID=`vagrant global-status | grep ${VM_NAME} | cut -d' ' -f1`
KEYPATH=`vagrant ssh-config ${VM_ID} | grep "IdentityFile" | cut -d' ' -f4`
PORT=`vagrant ssh-config ${VM_ID} | grep "Port" | cut -d' ' -f4`
#connect to vm and change password from "vagrant" to "openlearning" replace "openlearning" with your customized password
ssh -i ${KEYPATH} [email protected] -p ${PORT} "echo -e \"vagrant\nopenlearning\nopenlearning\" | passwd vagrant"
I combined the previous two scripts into one. Also the the script now take the name of target vm as command line argument. The port number is also no longer hardcoded. It is parsed from "vagrant ssh-config".
Also, @dogi I remember you mentioned something about the vagrant box template in the hangout today. I couldn't hear you clearly so can you write it down here? Thanks!
BTW, it will be good if @EmilyLarkin or some other mac user friends can test it.
The testing process is as easy as following
- Run your "community" vagrant machine.
- ssh to the "community" machine with the password "vagrant". Make sure it works then exit
the machine. - Run the script like this
sh changepassword.sh community
You can just copy and paste the code above then run it from any directory. - ssh to the "community" machine with the new password "openlearning". See if it works again.
If successfully connect to vm again, then this script works.
To manually ssh to the "community" machine using a password, type the following command
ssh [email protected] -p 2222
then type the current password when prompt.
Please comment here or gitter if something go wrong or if there is any question. Thanks!
from ole--vagrant-community.
Is there a fork or branch of the entire repo? I have a mac and I'd like to give it a shot.
from ole--vagrant-community.
@sente Hi, I haven't make a pull request yet, but I think you can just copy and paste the code into any directory and run it as in the post. It is designed to run in any directory.
from ole--vagrant-community.
I don't currently use vagrant/docker on my mac so I'd be running the whole shebang from start to finish. It's good practice to use forks/branches anyways, in my opinion.
from ole--vagrant-community.
@sente This is my own fork of the ole--vagrant--community
https://github.com/xinglunxu/ole--vagrant-community
And I just pushed the changepassword.sh script to it. It is under the macosx directory.
There is only one branch there.
Is this something you are looking for?
from ole--vagrant-community.
done with update -defdf1d
which updates to version 0.1.4 of ole/jessie64
the change happens in treehouses/template@dd489c3
from ole--vagrant-community.
Related Issues (17)
- add Bios tweaks to README.md HOT 15
- Create redirect at port 80 to the right port and subdirectory HOT 1
- scripts for downloading all the necessary software HOT 20
- Uninstall script to help with testing HOT 16
- research into how do installation process with a one liner HOT 5
- windows: add more software to README.md HOT 5
- test
- Proof of Concept to install and uninstall the required software with Chocolatey HOT 4
- Should we download also Firefox with choco? HOT 3
- windows: improve start vagrant on boot HOT 2
- create a section about network and firewall HOT 22
- macOS vagrant start on boot (suggestion)
- macosx: start vagrant on boot HOT 11
- ubuntu: start vagrant on boot
- shortcut icon on desktop HOT 8
- simple install by single script HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ole--vagrant-community.