Author Topic: SSH to your hostname  (Read 1090 times)

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
SSH to your hostname
« on: August 10, 2011, 09:20:09 AM »
After we saw how to change hostnames in PCLinuxOS, Change hostname PCLinuxOS, it might be cool to ssh directly the hostname of the remote machine. To do that, all is needed is add an alias in the /etc/hosts in the machine where you want to start the command.

Here at first floor my machine's name is "herisson". At the ground floor it's "hulotte". I added the ip and hostname of the remote machine in /etc/hosts:
Code: [Select]
192.168.1.8 hulotte
so from "herisson" I can just "ssh melodie@hulotte".

In the paste I also used a script that was allowing connection to my remote machine without providing the password each time, I will try to find it.

melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline AndrzejL

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 12791
  • RLU #490933
    • Wordpress On The Wardrobe...
Re: SSH to your hostname
« Reply #1 on: August 10, 2011, 09:38:48 AM »
Right... I prefer this way. PCC > Network and Internet > Host definitions.




Regards

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: SSH to your hostname
« Reply #2 on: August 10, 2011, 09:40:24 AM »
Hi,
I never know what to do with "yourdomain", could you explain ?

melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline AndrzejL

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 12791
  • RLU #490933
    • Wordpress On The Wardrobe...
Re: SSH to your hostname
« Reply #3 on: August 10, 2011, 09:50:02 AM »
Hi,
I never know what to do with "yourdomain", could you explain ?

It can be anything. Flower / thenudiebar / whatever.

If You use lets say 192.168.0.120 and then thenudiebar instead of yourdomain when You will ping thenudiebar it will ping the IP mentioned above.

I use it as well for blocking certain page...

127.0.0.1 facebook.com
127.0.0.1 myspace.com

If anyone tries to visit those pages he gets error...

Btw - this method of hostnaming the pcs has a major flaw... all the machines have to have static IP in your network...

I use static IP - yes. If You use this method You have static IPs too... but sometimes people connect machines via DHCP - this method will fail then - as machines will have different IP each time.

Andy

Offline melodie

  • Hero Member
  • *****
  • Posts: 5942
  • XMMP=Jabber, free instant messaging protocol !
    • PCLinuxOS Fr
Re: SSH to your hostname
« Reply #4 on: August 10, 2011, 12:40:53 PM »
Very true, I also use fixed ip's on the lan.

So you say "yourdomain" is my "herisson" at first floor, "hulotte" at ground floor, and "localhost" in the other default pclinuxos configurations ?

melodie at swissjabber dot ch - IRC #pclinuxos-fr sur freenode

Offline AndrzejL

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 12791
  • RLU #490933
    • Wordpress On The Wardrobe...
Re: SSH to your hostname
« Reply #5 on: August 10, 2011, 12:55:00 PM »
Very true, I also use fixed ip's on the lan.

So you say "yourdomain" is my "herisson" at first floor, "hulotte" at ground floor, and "localhost" in the other default pclinuxos configurations ?

Yes that's what it is. There is no limit of the entries so you can add multiple hostnames for 1 ip. Just like there are 2 lines for my 127.0.0.1 ip on my screenshot.

Andy
« Last Edit: August 10, 2011, 12:56:54 PM by AndrzejL »