Jump to content


- - - - -

uploading pub/pri keys with ssh remote port change

ssh key upload w/ port change rsnapshot

  • You cannot reply to this topic
4 replies to this topic

#1 mudmanc4

    TMN Seasoned Veteran

  • Moderators
  • 9,040 posts
  • Location: In The Plex

Posted 16 October 2011 - 07:04 PM

I always change the ssh port on remote machines for obvious reasons, however it's causing an simple issue I hope someone can help with.

Setting up a local server with rsnapshot using a cron and ssh keys, I need to change the command for ssh port remote access to upload the key. I just need the proper placement.

I'm used to using -p to gain access , but not used it to upload a key until now.

Tried
 " scp .ssh/is_rsa.pub -p xxxx root@server.com:.ssh/authorized_keys2 "
" scp -p xxxx .ssh/id_rsa.pub root@server.com:.ssh/authorized_keys2 "

I'll keep looking and post back when I get it is no one comes forward

thanks
Vote 2012 !
Posted Image Posted Image

So how's everybody doing in that little head of yours ? ™

#2 EBrown

    Don't hate the combover.

  • Sophist Member
  • PipPipPipPipPipPip
  • 842 posts
  • Location: Armpit of America

Posted 17 October 2011 - 03:15 AM

Try '-pXXXX' instead of a space between them.

Thanks,
EBrown
92% of the teenage population has switched to rap. If you are in the 8% who ROCKS, copy & paste this in your signature!
Posted ImagePosted Image
Posted Image

#3 mudmanc4

    TMN Seasoned Veteran

  • Moderators
  • 9,040 posts
  • Location: In The Plex

Posted 17 October 2011 - 10:18 AM

Thanks , been there done that, I get " scp: illegal option -- 0 "  , which can mean any number from a plethora of other issues.

I'm certain there is a simple solution, Iv'e just got to apply myself mentally a little to this one and have a search.
Vote 2012 !
Posted Image Posted Image

So how's everybody doing in that little head of yours ? ™

#4 sgbotsford

    New Member

  • Members
  • PipPip
  • 10 posts

Posted 22 February 2012 - 02:01 PM

The second form should work.  

Try adding a -v or -vv and see if the diagnostics reveal anything.

The first two thoughts:  You set the new port, but didn't restart the daemon.    Or your fingers lead their own life and xxxx in your command is NOT the new port on your server.

Check using something like nmap or hping to see that ssh is running on the port you want.  If it's not, then scan to see if ssh is running on another port.

A third possibility is that ssh is set up to refuse root access (this is the default.)

Can you login with password?  e.g. ssh -p xxxx yourusername@remotehost.foo.net

***

General note:  Always have two ways to access a remote machine.  Change only one at a time.  Make sure that change survives a reboot.  Now change the other one.

#5 mudmanc4

    TMN Seasoned Veteran

  • Moderators
  • 9,040 posts
  • Location: In The Plex

Posted 22 February 2012 - 08:22 PM

Thanks for your thoughts. I should have marked this solved.

The correct way to do this would be to use capitol " -P  " when specifying a port in this manner.
Vote 2012 !
Posted Image Posted Image

So how's everybody doing in that little head of yours ? ™





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users