Jump to content
Sign in to follow this  

uploading pub/pri keys with ssh remote port change

Recommended Posts

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.


 " scp .ssh/is_rsa.pub -p xxxx [email protected]:.ssh/authorized_keys2 "
" scp -p xxxx .ssh/id_rsa.pub [email protected]:.ssh/authorized_keys2 "[/code]

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


Share this post

Link to post
Share on other sites

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 [email protected]


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.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...