Author Topic: Bash>ssh> ports>?  (Read 841 times)

Offline pclinmike

  • Hero Member
  • *****
  • Posts: 637
  • I Only 'Clean' Windows !.
Bash>ssh> ports>?
« on: August 09, 2012, 06:21:30 PM »
If I change 'ssh' ports to say 2222 in pcc how do I tell 'Bash' ?, it still wants to use port 22 for ssh !.

eg.

[root@localhost ~]# ssh-copy-id -i .ssh/id_rsa.pub root@192.168.0.155



ssh: connect to host 192.168.0.155 port 22: Connection refused

Now try logging into the machine, with "ssh 'root@192.168.0.155'", and check in:

  .ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

Michael.
From South-Derbyshire, England.U.K.Earth.

I Normally Do A Search Before I Post A New Question !.

Thanks to all who replied to my posts.

Offline muungwana

  • Hero Member
  • *****
  • Posts: 6198
Re: Bash>ssh> ports>?
« Reply #1 on: August 09, 2012, 07:56:52 PM »

try:
ssh-copy-id -i .ssh/id_rsa.pub root@192.168.0.155:2222
.. 3 things are certain in life : death, taxes and software bloat ..
.. tell me something i don't know, something i can use as i struggle to reason with the world around me ..

Offline pclinmike

  • Hero Member
  • *****
  • Posts: 637
  • I Only 'Clean' Windows !.
Re: Bash>ssh> ports>?
« Reply #2 on: August 10, 2012, 05:49:43 AM »

try:
ssh-copy-id -i .ssh/id_rsa.pub root@192.168.0.155:2222

root@localhost ~]# ssh ssh-copy-id -i .ssh/id_rsa.pub root@192.168.0.155:2222
ssh: Could not resolve hostname ssh-copy-id: Name or service not known
Michael.
From South-Derbyshire, England.U.K.Earth.

I Normally Do A Search Before I Post A New Question !.

Thanks to all who replied to my posts.

Offline pags

  • Hero Member
  • *****
  • Posts: 2519
  • Keep it clean.
Re: Bash>ssh> ports>?
« Reply #3 on: August 10, 2012, 09:20:33 AM »
Looks like ssh-copy-id is a script that simplifies copying the keys to a remote authorized_keys file...you could do it manually (it's a one time exercise per client).  Either by ssh'ing into the remote PC and adding the value, or by pulling the file over to your local machine, editing it and putting it back (use scp, for that).

Doesn't look like the script includes any provision to change the default ssh port.

Offline TerryN

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 727
Re: Bash>ssh> ports>?
« Reply #4 on: August 10, 2012, 09:28:34 AM »

try:
ssh-copy-id -i .ssh/id_rsa.pub root@192.168.0.155:2222

root@localhost ~]# ssh ssh-copy-id -i .ssh/id_rsa.pub root@192.168.0.155:2222
ssh: Could not resolve hostname ssh-copy-id: Name or service not known


Err... you seem to have inserted an extra "ssh" in there  ;) :)

The result is that ssh-copy-id becomes a "hostname" argument which, of course, does not exist

The important point is that if you have a service running on a non-standard port you specify it by appending the port to the address or hostname with a ":"  
For example:  192.168.0.155:2222

Terry
« Last Edit: August 10, 2012, 01:03:39 PM by TerryN »
Dell E521 - AMD 64 X2 5000+, 4GB RAM, ATI X1300 graphics
PCLinuxOS 2013 (KDE)
|Twitter|

Offline ghostbunny

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 1173
Re: Bash>ssh> ports>?
« Reply #5 on: August 10, 2012, 03:55:41 PM »
why didn't you use ssh --help ?

you will find the option -p
The full life is a big mess

PS:
I'm German. Sorry because of possible mistakes in my written messages xD