LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 07-25-2017, 02:19 PM   #1
janvitro
LQ Newbie
 
Registered: Jul 2017
Posts: 4

Rep: Reputation: Disabled
Question 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.
 
Old 07-25-2017, 02:52 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138
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?
 
Old 07-25-2017, 03:06 PM   #3
Waris
Member
 
Registered: May 2017
Distribution: Centos 6,7 and Windows
Posts: 40

Rep: Reputation: Disabled
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?
 
Old 07-25-2017, 03:20 PM   #4
dejank
Member
 
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229

Rep: Reputation: Disabled
Where are you logging from with ssh? From your host where that vm is installed? From LAN? From outside?
 
Old 07-25-2017, 08:07 PM   #5
TheEzekielProject
Member
 
Registered: Dec 2016
Distribution: arch
Posts: 664

Rep: Reputation: 190Reputation: 190
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 08:08 PM.
 
Old 07-25-2017, 08:20 PM   #6
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009
You have to use bridged networking in the VM.
 
Old 07-26-2017, 07:14 AM   #7
janvitro
LQ Newbie
 
Registered: Jul 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
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
 
Old 07-26-2017, 12:08 PM   #8
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.8.2003
Posts: 5,437

Rep: Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068
Quote:
Originally Posted by janvitro View Post
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.
 
Old 07-27-2017, 02:46 AM   #9
janvitro
LQ Newbie
 
Registered: Jul 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu 12.4 LTS ssh access kohshan99 Linux - Newbie 8 09-19-2016 01:14 AM
Help with Ubuntu server remote ssh and local network ssh issues using putty. scottpops Linux - Server 8 05-17-2012 05:07 PM
Firestarter kills OUTGOING SSH Ubuntu 10.04- rejects SYN/ACK from SSH server edsmithers Linux - Networking 3 09-29-2010 02:53 PM
Using DSL and ssh / ssh-server to access the Windoze desktop GUI On2ndThought Linux - Server 4 11-16-2008 02:17 PM
Unable to access my ssh server and ftp server from the Internet, but smtp works foxone Linux - Networking 1 05-28-2004 05:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration