Created
December 10, 2020 13:40
-
-
Save mattiasb/61a99373ae5b41c978ee6a432a541a7d to your computer and use it in GitHub Desktop.
Vagrantfile: Theoretical change to shell provisioner to allow changing guest ssh port
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config.vm.define "git.local" do |server| | |
server.vm.hostname = "git.local" | |
server.ssh.port = 2222 | |
# The ssh_port field doesn't exist in Vagrant, but would make it possible to | |
# change guest ssh port during provisioning. | |
server.vm.provision "shell", ssh_port: 22, inline: <<-SHELL | |
set -ex | |
sed -i -Ee 's/^[[:blank:]]*#[[:blank:]]*Port[[:blank:]]+22$/Port 2222/' \ | |
/etc/ssh/sshd_config | |
systemctl restart sshd.service | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment