I have created two CentOS 7 virtual machines and am trying to remote log in to another CentOS VM using ssh.
After using command, i am asked to give password for logging in to another machine. So far it is Ok. But after connection, i am
not getting shell prompt of another machine and i get prompt of my current session. but when I type "exit" i get message as
"connection to remote machine is closed." This means I have established a connection. Then why i am not able to log on to another machine?
What steps i need to take to debug this problem?
using ssh on CentOS7 for logging on remote machine
-
- Posts: 19
- Joined: 2020/04/29 04:07:16
Re: using ssh on CentOS7 for logging on remote machine
How can you tell that?nitinkumar wrote: ↑2020/05/09 06:30:53not getting shell prompt of another machine and i get prompt of my current session.
Do "ip ro" in that prompt, exit, and "ip ro" again. Do you get exactly same output?
-
- Posts: 19
- Joined: 2020/04/29 04:07:16
Re: using ssh on CentOS7 for logging on remote machine
I can say i am not getting connected because i find myself in the same machine from where i give ssh command.
"ip ro" command give exactly same output before and after exit.
One more thing, i get connected to the other machine when I give ssh < Ip address of the other machine> but not when I give FQDN . I have given
name and IP address in /etc/hosts and name in /etc/hostname files. I think I am missing some very simple thing.
"ip ro" command give exactly same output before and after exit.
One more thing, i get connected to the other machine when I give ssh < Ip address of the other machine> but not when I give FQDN . I have given
name and IP address in /etc/hosts and name in /etc/hostname files. I think I am missing some very simple thing.
Re: using ssh on CentOS7 for logging on remote machine
This is important. Problem is not in ssh. Problem is in name resolution.nitinkumar wrote: ↑2020/05/10 06:18:59i get connected to the other machine when I give ssh < Ip address of the other machine> but not when I give FQDN.
Note:nitinkumar wrote: ↑2020/05/10 06:18:59I have given name and IP address in /etc/hosts and name in /etc/hostname files.
My CentOS 7 system does not have file /etc/hostname at all. Package 'systemd' formally provides it, but file is not there.
When I say "ssh bar", the system looks for a "bar" first from /etc/hosts and then with servers listed in /etc/resolv.confman 5 hostname wrote: You may use hostnamectl(1) to change the value of this file during runtime from the command line.
Use systemd-firstboot(1) to initialize it on mounted (but not booted) system images.
Code: Select all
# grep ^hosts /etc/nsswitch.conf
hosts: files dns
Does the /etc/hosts in the machine that you try to connect from have line:
Code: Select all
<Ip address of the other machine> FQDN
Code: Select all
ping -c 1 name
-
- Posts: 19
- Joined: 2020/04/29 04:07:16
Re: using ssh on CentOS7 for logging on remote machine
Thanks for your help. I could resolve the issue.