Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
07-25-2017, 03:19 PM
|
#1
|
LQ Newbie
Registered: Jul 2017
Posts: 4
Rep:
|
SSH access to my ubuntu server
Hello all of you out there,
I have installed virtualbox and I am running ubuntu 16.04-2 64 bit as a virtual machine.
I can ping the server with IP address 192.168.124.10
But now I want to log on to the server using SSH.
The openssh-server package is installed but when I try to log on I get the message: ssh: connect to host 192.168.124.10 port 22: Connection refused
My wifi network is configured to use DHCP and my wifi adapter gets an IP address of 192.168.124.x
I tried to set a static IP address but when I configure it that way I don't have access to the internet.
I have googled and configured SSH to use port 2222 but this doesn't help.
I also made a rule for ufw to accept connections on port 22
Anybody any ideas?
Thanks in advance.
|
|
|
07-25-2017, 03:52 PM
|
#2
|
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573
|
How do you have the network adapter configured in virtualbox? Bridged, NAT, etc.
Where do you want to SSH into the VM from? The host, some other machine on your network, or outside your network?
|
|
|
07-25-2017, 04:06 PM
|
#3
|
Member
Registered: May 2017
Distribution: Centos 6,7 and Windows
Posts: 40
Rep:
|
Lets take it from the top.
When you first created the VM, how was it congfigured? Was it NAT, bridged, Host only adapter? Are you able to ping anything from inside the VM? What does the ONBOOT (yes, no) say in /etc/sysconfig/network-scripts/ifcfg-enp0s3 or eth0?
|
|
|
07-25-2017, 04:20 PM
|
#4
|
Member
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229
Rep:
|
Where are you logging from with ssh? From your host where that vm is installed? From LAN? From outside?
|
|
|
07-25-2017, 09:07 PM
|
#5
|
Member
Registered: Dec 2016
Distribution: arch
Posts: 668
Rep:
|
How did you go about configuring ssh exactly? Did you use gui interfaces or the command line? I believe UBuntu 16 is systemd. if so, you can check the server is running via
Code:
systemctl status sshd
you should get something like
Code:
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: disable
Active: active (running) since Sun 2017-07-23 06:51:50 PDT; 2 days ago
Main PID: 871 (sshd)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/ssh.service
└─871 /usr/sbin/sshd -D
lines 1-7/7 (END)
note the bolded text.
Also check your configuration file
Code:
your-favorite-text-editor /etc/ssh/sshd_config
and make sure the "Port" reads 2222, as you said you have set it. Though if you're paranoid enough I'd recommend changing this to something else and not post the port number online, and also make sure your firewall rule allows the same port that you're changing it to. Then reload the service
Code:
systemctl restart sshd
Note that most of these commands require root privileges.
Last edited by TheEzekielProject; 07-25-2017 at 09:08 PM.
|
|
|
07-25-2017, 09:20 PM
|
#6
|
LQ Guru
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
|
You have to use bridged networking in the VM.
|
|
|
07-26-2017, 08:14 AM
|
#7
|
LQ Newbie
Registered: Jul 2017
Posts: 4
Original Poster
Rep:
|
The current situation
Thank you all for your help.
The situation is as follows: I am on a wifi network of 192.168.124.x this is my only network.
I have configured the virtual machine's NIC as a bridged adapter which is attached to wl0
I have checked the Cable connected radio button.
From the virtual machine I can ping the host for example ping 192.168.124.75
From my linux Mint terminal I can ping 192.168.124.10 (this is the ip address I gave ubuntu server)
Promiscuous mode is set to allow all
From giving the command systemctl status sshd I found that the server was listening on port 0.0.0.0 strange enough.
So I edited /etc/ssh/sshd_config
There I set the ip address to 192.168.124.10
Now I can log on using SSH but the connection seems to be somewhat unstable.
Sometimes the link is broken.
But I think this is what I have to be satisfied with.
Again thank you all for your time
|
|
|
07-26-2017, 01:08 PM
|
#8
|
LQ Veteran
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: Rocky 9.4
Posts: 5,813
|
Quote:
Originally Posted by janvitro
From giving the command systemctl status sshd I found that the server was listening on port 0.0.0.0 strange enough.
|
Just FYI - that's not the port, that means the server is listening on all IP addresses. The port follows the colon.
Glad you figured out the problem, tho.
|
|
|
07-27-2017, 03:46 AM
|
#9
|
LQ Newbie
Registered: Jul 2017
Posts: 4
Original Poster
Rep:
|
Trouble in virtualization land
I prefer to use VirtualBox instead of VMware because VirtulBox is open source.
I configured the whole thing and I can log on to my server but much to often I get something like:
cannot connect to port 22 connection refused (I don't know the exact output)
What I did is install VMware player again, on one virtual machine I run pfSense profiding NAT and many other features.
I then assigned an extra IP address to my wifi adapter.
I now have a virtual network isolated from th rest which I can access from my Mint terminal.
VirtualBox can a thing or two from the ease of which everything is installed and it's stabilaty.
But maybe the problem isn't VirtualBox but me . . .
But for now I'm happy with the current configuration despite of the fact that VMware isn't open source.
Thank you all for your time and effort.
Best regards,
Jan
|
|
|
All times are GMT -5. The time now is 06:09 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|