Accessing a virtual linux machine using another linux virtual machine [closed] - linux

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 need to test and practice ssh(secure shell deamon) in linux,to do that I have configured a centOS 7.0 virtual machine and a ubuntu 12.10 virtual machine in VMware 12.0 workstation.(My host machine is running windows 8)
I powered up both virtual machines and try to connect ubuntu machine from centos machine using ssh root#IPaddress .but I continue to get the error
ssh: connect to host 92.222.136.30 port 22: Connection refused
I don't know it is possible to ssh connect in that manner.But I don't no any other way to test and practice this stuff.What is the wrong I have done here?or is there any easy method to do this?

what is the network configuration.
I would suggest using Bridge adapters on both machines.
If you are trying for a static IP on both then I would suggest try the following configuration
VM-1: two NIC cards. NIC-1 on NAT and NIC-2 on bridge (static IP)
VM-2: two NIC cards. NIC-1 on NAT and NIC-2 on bridge (static IP)
I would also suggest trying to allow port 22 on firewalld or Iptables or you can completely disable firewalls by using the following commands since you are testing
systemctl stop firewalld
systemctl disable firewalld
also check if the port 22 is open, check with
netstat -tulnp | grep -i 22
and see I presume you are running centos as a server [infrastructure server/ or a full installation]. If on minimal install of centos you would have to install the openssh server using yum -y install openssh-server
I hope this helps, Thanks

telnet IPaddress 22 ( check if ssh port is open )
check your ssh port using command netstat -plantu
turn off the firewall or flush IP tables
use command ssh root#IPaddress -p 22 (if you use custom port then change value 22 to your port number)

Related

SSH set non default port [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 am trying to change default port of SSH from 22 to 2292, Host: RHEL 7.1
I have tried:
1)vi /etc/ssh/sshd_config
#Port 22
Port 2292
2)reboot
Error
ssh -p 2292 root#lrmi079.pll.domin.com
ssh: connect to host lrmi079.pll.domin.com port 2292: No route to host
but ping to the host works
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
Please help
It's possible that this new port 2292 is not open on your RHEL 7.1 host and the inbuilt firewall (also known as iptables) is declining the connectivity.
Check the current firewall rules:
$ sudo iptables -L
To open up a new port - port 2292 - in your case:
$ sudo firewall-cmd --zone=public --add-port=2292/tcp --permanent
$ sudo firewall-cmd --reload
Check the updated rules:
$ firewall-cmd --list-all
Let me know if it worked.

How to check if a web server is installed in a Linux machine? [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 8 years ago.
Improve this question
Good morning folks,
Basic question :-)
How to check if a web server is installed in a Linux machine?
I dont know if any web server installed or not. If installed I would like to use it to build a web
service.
If a web Server installed, how to check where it is installed, path , properties etc..
Thank you for your time!
If there's a webserver active it's easy enough to tell, but if the webserver is installed, but not active, it's more difficult, since there are probably a dozen different webservers that might be installed (but haven't been started). You can tell if there's a web server active on the default port for http (80) with:
$ telnet hostname 80
Where hostname is the hostname or IP address of the machine of interest. If you have shell access to the machine of interest, then you can just use localhost, for example, if there is a webserver active, you will see something like:
$ telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
If you type something like:
GET /foo
You will get an error message that may tell you something about what webserver is installed. For example:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /status was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Ubuntu) Server at 127.0.1.1 Port 80</address>
</body></html>
Connection closed by foreign host.
This would tell you that Apache version 2.2.22 is installed and running on the machine that you're running the shell on.
If there is no webserver active, on the other hand, you will see something like:
$ telnet localhost 80
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
In this case, things get rather more distribution-specific (what you find and where is dependent on the Linux distribution installed). You can try to see if there's a webserver installed, but not active, by checking for common service names or installed files and directories. You could try:
$ service apache2 status
or
$ service httpd status
And you might get:
Apache2 is NOT running.
This at least tells you that Apache is installed, but not running, whereas:
apache2: unrecognized service
... would tell you that Apache is not installed. There could, however, be another webserver installed.
You might also check to see if there's a /var/www/ directory, or another directory where webservers commonly store files by default, e.g.:
$ ls /var/www
Unfortunately, it's hard to give a good answer without knowing what distribution (e.g. Debian, Ubuntu, RedHat, CentOS, Fedora, ...) is installed on the machine of interest.
Take Apache HTTP Server as example, there is a directive call ServerSignature
Check with HTTP Response header
There may be something like
Server: Apache/2.2.17 (Win32) PHP/5.2.17
Of course the server can turn this feature off
You may try firefox addons "Web Developer" to get those HTTP headers
The best way to check the operating system is to find the server host, getting the user account and do a login :-)
For your second question, please login it and search for appropriated tutorial of that OS

ssh: Could not resolve hostname [hostname]: nodename nor servname provided, or not known [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 2 years ago.
Improve this question
I am trying to set up a VPN with a Raspberry Pi, and the first step is gaining the ability to ssh into the device from outside my local network. For whatever reason, this is proving to be impossible and I haven't the slightest clue why. When I try to ssh into my server with user#hostname, I get the error:
ssh: Could not resolve hostname [hostname]: nodename nor servname provided, or not known
However, I can log into the server with,
ssh user#[local IP]
The server is a Raspberry Pi Model B running the latest distribution of Raspbian and the machine I am trying to connect to it with is a Macbook Pro running Mavericks. ssh was enabled on the Raspberry Pi when I set up Raspbian.
I have perused Stack Overflow for hours trying to see if anyone else had this problem and I have not found anything. Every ssh tutorial I find says that I should just be able to set it up on the remote machine and log in from anywhere using a hostname, and I have never had success with that.
If you're on Mac, restarting the DNS responder fixed the issue for me.
sudo killall -HUP mDNSResponder
I had the same issue connecting to a remote machine. but I managed to login as below:
ssh -p 22 myName#hostname
or:
ssh -l myName -p 22 hostname
Recently I came across the same issue. I was able to ssh to my pi on my network, but not from outside my home network.
I had already:
installed and tested ssh on my home network.
Set a static IP for my pi.
Set up a Dynamic DNS service and installed the software on my pi.
I referenced these instructions for setting up the static ip, and there are many more instructional resources out there.
Also, I set up port forward on my router for hosting a web site and I had even port forward port 22 to my pi's static IP for ssh, but I left the field blank where you specify the application you are performing the port forwarding for on the router. Anyway, I added 'ssh' into this field and, VOILA! A working ssh connection from anywhere to my pi.
I'll write out my router's port forwarding settings.
(ApplicationTextField)_ssh (external port)_22 (Internal Port)_22 (Protocal)_Both (To IP Address)_192.168.1.### (Enabled)_checkBox
Port forwarding settings can be different for different routers though, so look up directions for your router.
Now, when I am outside of my home network I connect to my pi by typing:
ssh pi#[hostname]
Then I am able to input my password and connect.
In my case I was trying ssh like this
ssh pedro#192.168.2.179:22
when the correct format is:
ssh pedro#192.168.2.179 -p 22
If you need access to your VPN from anywhere in the world you need to register a domain name and have it point to the public ip address of your VPN/network gateway. You could also use a Dynamic DNS service to connect a hostname to your public ip.
If you only need to ssh from your Mac to your Raspberry inside your local network, do this: On your Mac, edit /etc/hosts. Assuming the Raspberry has hostname "berry" and ip "172.16.0.100", add one line:
# ip hostname
172.16.0.100 berry
Now: ssh user#berry should work.
I had the same issue, which I was able to resolve by adding a .local to the host name, ala ssh user#hostname.local
For me, the problem was a typo on my ~/.ssh/config file. I had:
Host host1:
HostName 10.10.1.1
User jlyonsmith
The problem was the : after the host1 - it should not be there. ssh gives no warnings for typos in the ~/.ssh/config file. When it can't find host1 it looks for the machine locally, can't find it and prints the cryptic error message.
I had the same problem: The address shown in Preferences -> Sharing -> Remote Login didn't work and I got a '... nodename nor servname provided, or not known'. However, when I manually edited the settings (in Preferences -> Sharing -> Remote Login -> edit) and enabled "Use dynamic global hostname", it suddenly worked.
If your command is:
$ ssh -p 1122 path/to/pemfile user#[hostip/hostname]
You will also face the same error
ssh: Could not resolve hostname [hostname]: nodename nor servname provided, or not known
when you miss the option -i /path/to/pemfile of ssh
So Command should be:
$ ssh -p 1122 -i path/to/pemfile user#[hostip/hostname]
I needed to connect to remote Amazon server
ssh -i ~/.ssh/test.pem -fN -L 5555:localhost:5678 ubuntu#hostname.com
I was getting the following error.
ssh: Could not resolve hostname <hostname.com>: nodename nor servname provided, or not known
Solution For Mac OSX
Pinging the host resolved the issue. I am using Mac OSX Seirra.
ping hostname.com
Now problem resolved. Able to connect to the server.
Note: I tried this solution also. But it didn't work out. Then ping resolved the issue.
It seems that some apps won't read symlinked /etc/hosts (on macOS at least), you need to hardlink it.
ln /path/to/hosts_file /etc/hosts
This was happening to me when trying to access Github. The problem is that I was in the habit of doing:
git remote add <xyz> ssh:\\git#github.com......
But, if you are having this error from the question, removing ssh:\\ may resolve the issue. It solved it for me!
Note that you will have to do a git remote remove <xyz> and re-add the remote url without ssh:\\.
I have the exact same configuration. This answer pertains specifically to connecting to a raspberry pi from inside the local network (not outside). I have A raspberry pi ssh server, and a macbook pro, both connected to a a router. On a test router, my mac connects perfectly when I use ssh danran#mypiserver, however, when I use ssh danran#mypiserver on my main router, i get the error
ssh: Could not resolve hostname [hostname]: nodename nor servname
provided, or not known
Just as you have gotten. It seems, the solution for me at least, was to add a .local extension to the hostname when connecting from my mac via ssh.
So, to solve this, i used the command ssh danran#mypiserver.local (remember to replace the "danran" with your username and the "mypiserver" with your hostname) instead of using ssh danran#mypiserver.
To anyone reading this, try adding a .local as the suffix to your hostname you are trying to connect to. That should solve the issue on a local network.
Try this, considering your allowed ports. Store your .pem file in your Documents folder for instance.
To gain access to it now all you have to do is cd [directory], which moves you to the directory of the allotted file. You can first type ls, to list the directory contents you are currently in:
ls
cd /Documents
chmod 400 mycertificate.pem
ssh -i "mycertificate.pem" ec2-user#ec2-1-2-3-4.us-compass-0.compute.amazonaws.com -p 80
I got this error by using a .yml inventory file in ansible that was not properly formatted. For multiple hosts in a group, each hostname needs to end in a hard colon ":". Otherwise ansible runs the host names together and produces this ssh error.
I had the same problem after testing Visual Studio Code with remote-ssh plugin. During the setup of the remote host the software did ask me where to store the config-file. I thought a good place is the '.ssh-folder' (Linux-system) as it was a ssh-remote configuration.
It turned out to be a bad idea. The next day, after a new start of the computer I couldn't logon via ssh on the remote server. The error message was 'Could not resolve hostname:....... Name or service not known'.
What happen was that the uninstall from VSC did not delete this config-file and of course it was than disturbing the usual process. An 'rm' later the problem was solved (I did delete this config-file).

Yum install through other server [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 10 years ago.
Improve this question
I have two servers (CentOS 6.2) on the same network. One of them (server1) has access to internet and the other one (server2) doesn't.
I need to configure my servers so that server2 could install packages!
Please help !
You could configure NAT on the server with internet access.
Or you can setup a squid proxy on your internet capable server.
This basically means giving internet access to the machine that doesn't have it now.
On the machine with internet access:
yum install squid
Now edit /etc/squid/squid.conf.
add a line like this:
acl internal_server src XXX.XXX.XXX.XXX/32
where XXX.XXX.XXX.XXX is inside server ip
next add:
http_access allow internal_server
and finally restart the squid server:
/etc/init.d/squid restart
Now, on the internal server:
edit /etc/yum.conf and add:
proxy=http://YYY.YYY.YYY.YYY:3128
Thats it!
Try to configure NAT on your server connected to the internet. Make that server default gateway to one that hasn't got an internet.

restart plesks (v 10.3.1) iptables rules from console [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'm using Plesk 10.3.1.
I have some settings made in the Plesk Firewall Tool:
The Plesk Panel (port 8443) is only accessable from defined IPs.
SSH is open for all (not for root and on an ohter port)
Now, when I have an IP which is not allow for plesk panel I cant login.
So I connect to SSH and want add my current IP to the iptables rules, how to do that
or where is the needed file?
how can I edit (where is the file?) and restart the current iptables rules generated with the plesk firewall script/tool in the console?
plesk 10.3 dont use /etc/sysconfig/iptables file, this is empty or only has standard config ...
best,
From what little I know, Plesk stores the firewall configuration in /sbin/iptables for Ubuntu.
I followed this Firewall logging tutorial which explains how to add a new iptables set of rules.
I'm wary to give you specific advice as you can knacker yourself very quickly with iptables.
However running $ /sbin/iptables --line-numbers -nL is a good place to start which will show you the existing iptables rules that you have.

Resources