Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I logged onto my server from a remote computer via SSH using its hostname server.domain.com. The Samba server's IP is 192.168.5.33.

I then used the ssh command to connect with the local FTP server (192.168.5.37): ssh 192.168.5.37. Got asked if I want to proceed as the fingerprint was not in the list of known hosts. Confirmed, and it got permanently added to the list of known hosts.

Whenever I connect to server.domain.com now, I end up on 192.168.5.37 instead of 192.168.5.33. If I use ssh 192.168.5.33, I end up in a main directory containing the files initiatorname.iscsi iscsid.conf nodes instead of what I expected in the root directory.

How do I get back to the root where I will find folders like /var/logs?

share|improve this question
add comment

1 Answer 1

When you connect via ssh you enter the remote machine in the home directory of the user you are using to connect /home/username (or /root if you are connecting as root, but this is not permited by default on ubuntu for security reasons).

If your ssh server.domain.com command sends you to the ftp server instead of the 192.168.5.33 machine, you have a routing problem or a DNS problem.

Your router (or firewall, not sure how is your configuration) can be redirecting port 22 to ftp server or you DNS resolver (local /etc/hosts file or DNS server or Samba server if you are using it to resolve hostnames) is pointing to your ftp server IP for host server.domain.com.

Look at the output of nslookup server.domain.com on your machine to verify if this is a DNS related problem.

Obs: not sure if you need that, but to go to the / directory (where you find /var/log) you need to issue cd / command. SSH connections will never leave you there by default.


edit after comment

Ye, from nslookup output, it is your name resolution (done on server 192.168.5.33) that is sending you to the wrong server.

Look at your /etc/hosts files in both servers and correct if wrong:

On 192.168.5.33, you should have the line

192.168.5.33 server.domain.com server

and on the ftp server, you should have:

192.168.5.37 ftpservername.domain.com ftpservername

Check the names of the servers with hostname on each and correct with hostname correctname and edit the config file with nano /etc/hostname.

Not sure how is DNS resolved on your network but if you are using bind, you will need to correct its zones config files too.

share|improve this answer
    
Hi, thanks for your reply! Your hint with the cd / command helped me a lot. –  manu Feb 9 '13 at 13:50
    
I just tried nslookup, and the result is: Server: 192.168.5.33 Address: 192.168.5.33#53 ` ` Name: server.domain.com Address: 192.168.5.37 What does it tell me? I still end up on 192.168.5.37 everytime I connect to server.domain.com. And from the nslookup output it seems to be meant like this, doesn't it? –  manu Feb 9 '13 at 13:51
    
yes, it is meant like this by a wrong dns resolution. I edited the answer. –  laurent Feb 9 '13 at 14:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.