How to set vagrants host SSH port [closed] - ssh

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I have multiple VMs managed by vagrant in a production environment. I like to set their SSH host ports manually while I have to open every single port in iptables. Vagrant manages these port forwarding manually by default which forces me to open a range of ports which I doesn't want to.
I already tried a port forwarding but it ends up with two ports forwarded to the guest.
config.vm.network "forwarded_port", id: "a-named-ssh-forwarding", host: 54321, guest: 22
The problem is I cannot see any option in the vagrant SSH config section. Obviously I could set the guests SSH port only.
Vagrant SSH settings
Is it even possible to set the forwarded host SSH port and if yes how?

The solution is too simple.
Overriding the Default Forwarded SSH Port in Vagrant
Just rename the ID of the forwarded port to ssh.
config.vm.network "forwarded_port", id: "ssh", host: 54321, guest: 22
This in fact removes the possibility to identify the ssh forwardings to a specific VM by reading the list. But it's a low price for the enhanced system's security.

Related

ssh to a bridged VM Guest on LAN [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
i have a machine with ubuntu 16.04 x64 & virtualbox 5.0 installed as VM Host. then create a VM Guest (debian 8 x86) and set to bridged adapter.
the VM Host can ssh the VM guest by ip. but the others on Lan can not:
ssh: connect to host 192.168.0.106 port 22: Connection refused
ping VM guest is ok on both VM host and the others.
if setting to NAT adapter and port forward ssh is also fine
where would the problem be?
edit>
to make it clear:
there's 2 real machines in Lan(192.168.0.x) : 101 & 130.
a VM is created on 130 with bridged adapter, and the ip is 106.
130 can ssh 106, but 101 can not
both 130 and 101 can ping 106
if change VM to NAT adapter, and forward port 22 to 130:2222, 101 can ssh to the VM through 130:2222, seems that ssh works fine on VM
question is how to ssh a bridged VM on Lan?
it turned out to be a dhcp router issue.
the router donot specified the gate way ip caused this problem

XAMPP 5.5.28 doesn't work on OS X 10.11 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
My iMac' OS was upgraded last night, to OS X El Capitan(version 10.11).
I use XAMPP 5.5.28. MySQL and ProFTPD are working, but the Apache Web Server doesn't work after the upgrade.
Even though the application log says..
Starting Apache Web Server...
/Applications/XAMPP/xamppfiles/apache2/scripts/ctl.sh : httpd started
Then tried to start it on Terminal
$ sudo /Applications/XAMPP/xamppfiles/bin/httpd
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
I checked whether any other app uses the same port by
$ netstat -anp tcp | grep :80
And nothing uses it.
Anyway, to avoid the error, I changed the port 80 to 8888 by
$ vi /Applications/XAMPP/etc/httpd.conf
Then tried to start the web server on Terminal again, and it worked.
Now wondering
Which process uses port 80?
How can I start the web server via Application Manager of XAMPP?
Any help is appreciated.
I had the same problem
And I thought this is a dead end for El Capitan
BUT i got it working now:
The problem was apache was already running, no idea how.
So just go to terminal and type (Login as root user)
sudo su -
cd /etc/apache2/
apachectl stop
exit
Then go to XAMPP and try to start apache from there.
If this doesn't work, restart your system, then go to terminal:
sudo su -
cd /etc/apache2/
apachectl start
apachectl stop
exit
Then go to XAMPP and try to start apache from there.

Apache Cannot bind to port 80 [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 months ago.
Improve this question
I'm trying to use Bitnami MAPP Stack 5.5.30-0
(For Apache Web Server, PostgreSQL)
When I try to configure the Apache Web Server I get this error: "Cannot bind to port 80. It is probably taken by another application or you don't have enough privileges.
I don't want to change and use another port. I really want to use the port 80.
I don't know what app is using the port 80.
I am running MAC OS X Yosemite
I tried this command:
sudo lsof -i ':80'
But nothing is running on this port.
I opened the httpd.conf and I tried to change the listen port to 80. But still not working.
Can someone help me?
Thank you
Maybe you already have Apache or Nginx running but you need to stop both of them before starting Apache with XAMPP. You can do this with:
To stop Apache: sudo /etc/init.d/apache2 stop
To stop Nginx: sudo nginx -s stop
This means that you either have another process that is already using port 80 or you don't have enough privileges. The following unix command might shed some light. You can run it in terminal:
sudo lsof -i ':80'
Check out this link as well.
If it turns out that you don't have enough privileges, try to configure / run apache using sudo. (sudo stands for superuser do). Note: this maybe a quick fix to get you going on your local machine, but it is not recommended on a production machine.

SSH through multiple hosts to execute another ssh session [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I spent to much time trying to do something which in plain words looks simple
I am at home, without firewall and all open ports. I need to ssh to the router at work where I have access to ssh port 22. My personal machine is on that subnet having internal ip address. So, what I need to do is to ssh from one machine to the second and from the second to the third. On the third I need to execute another ssh which tunnels some ports to my home machine. All that in bash script from my home. I have tried many solutions on the internet but nothing works.
The whole ideal is to get to my PC at work and run ssh tunnel for port 22 which will allow me to sshfs my work PC.
I could do it manually, by sshing to the router, that form the router to the work pc and then execute the ssh tunnel. I need a one-click solution.
Thanks in advance!
Have you tried just stacking the ssh commands like ssh -t localhost ssh localhost be sure to add the -t option for each hop except the last one ssh -t localhost ssh -t localhost ssh localhost
Maybe try VNC? With the right setup/port forwarding, you wouldn't have to jump from 1 PC to the next.

How to ssh to a remote server behind multiple firewalls? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
Here is my situation
I could access Server A from my home laptop via ssh.
Server B is only accessible from Server A via ssh.
Server C is only accessible from Server B via ssh.
Is there anyway that I could configure my .ssh/config so that I could ssh to Server C directly from my laptop ? I need this because I need regularly transfer files from Server C back to my laptop. I'm using 'scp' but go through this ssh hierarchy manually is too painful. I'm wondering whether there's a more straight-forward to do this via the magic of ssh.
You want to set up SSH tunnels to to allow SSH like this:
A => B
B => C
Here's an example of how to setup the tunnel to B through A on Linux:
ssh -f myusername#hostA -N -L 4444:hostB:22
Then, you should be able to ssh to port 4444 on hostA, and have that forwarded to port 22 (where SSH commonly runs) on hostB. After running the above command, try this:
ssh -p 4444 hostA
That should connect you to hostB. You may have to change ports for this to work, if port 4444 on hostA is already being used you'll have to pick a different port. Assuming that this works, you can use the same command with different hostnames to set up the tunnel from B => C:
ssh -f myusername#hostA -N -L 4444:hostB:4444
ssh -f myusername#hostB -N -L 4444:hostC:22
This is also useful if you want to set up a SOCKS proxy for web browsing. I do this so that my web traffic looks like it's coming from my university, so that I can use online access to scientific journals.
References:
Tunneling protocol
Breaking firewalls with OpenSSH and Putty
How to create an SSH tunnel using Putty, and then use that tunnel as a Firefox SOCKS proxy