LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-02-2019, 01:01 PM   #46
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,359
Blog Entries: 3

Rep: Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767

If you do not have a key file which ssh-copy-id's -i points to then you'll get the "No such file ... look at the -f option" error.

The -i used with ssh-copy-id has to match the -f from ssh-keygen as used when creating the key pair

Code:
ssh-keygen -t ed25519 -f /path/box-a-key-ed25519 -C 'from desktop'
ssh-copy-id -i /path/box-a-key-ed25519 to box_A_@192.168.0.xxx
 
1 members found this post helpful.
Old 02-02-2019, 01:41 PM   #47
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
You don't need to use the ssh-copy-id program if your physically at the server.

Code:
cat id_rsa.pub >> ~/.ssh/authorized_keys
Replace the name of the public key filename if different.

ssh-copy-id program basically logs into the server and then appends the public key to authorized_keys file. The cat command does the same thing but you do not need ssh.
 
1 members found this post helpful.
Old 02-02-2019, 02:51 PM   #48
however
Member
 
Registered: Jan 2019
Distribution: slackware current
Posts: 523

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
You don't need to use the ssh-copy-id program if your physically at the server.

Code:
cat id_rsa.pub >> ~/.ssh/authorized_keys
Replace the name of the public key filename if different.

ssh-copy-id program basically logs into the server and then appends the public key to authorized_keys file. The cat command does the same thing but you do not need ssh.
grrr... i had thought of this (i saw that the "id_rsa.pub" file only contained the encryption code) and then between jobs and tasks i totally forgot.

I guess you never stop learning from mistakes.

Thank you.

p.s.: i think i will test the ssh connection between box A and B tomorrow and let you know
 
Old 02-02-2019, 03:20 PM   #49
however
Member
 
Registered: Jan 2019
Distribution: slackware current
Posts: 523

Original Poster
Rep: Reputation: Disabled
Just a quick THANK YOU note, on the config file trick!
it works great now, after the correction and i can ssh box C directly by using just the host name (much easier/simpler that having to type the IP every time).
Question: can i have a config file that looks like this?
Code:
Host box_c
        HostName box_C_IP_address
        User darkstar
        IdentitiesOnly yes
        IdentityFile ~/.ssh/id_rsa 
        AddKeysToAgent ask

Host box_A
        HostName box_A_public_IP_address
        User darkstar
        IdentitiesOnly yes
        IdentityFile ~/.ssh/id_rsa 
        AddKeysToAgent ask
box A, would be on a different network

Last edited by however; 02-02-2019 at 03:22 PM.
 
Old 02-02-2019, 03:33 PM   #50
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
Yes, make sure you specify the correct private key for each host if different.
Don't forget to forward the port on your work router to you work computer ip address. You have never posted your work network hardware or maybe you have an IT employee that can do it for you.

If you don't have a static work ip address you can sign up for a free dynamic dns service that will provide a url that always resolves to your ip address.

Last edited by michaelk; 02-02-2019 at 03:36 PM.
 
1 members found this post helpful.
Old 02-03-2019, 03:57 PM   #51
however
Member
 
Registered: Jan 2019
Distribution: slackware current
Posts: 523

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
make sure you specify the correct private key for each host if different.
done
Quote:
Don't forget to forward the port on your work router to you work computer ip address.
done
Quote:
You have never posted your work network hardware or maybe you have an IT employee that can do it for you.
Network hardware? not sure what i should post: card type? name? (no IT employee) - It just an old desktop running slackware 14.1 (so old that it doesnt have a network card; I use a wireless USB)
Quote:
If you don't have a static work ip address you can sign up for a free dynamic dns service that will provide a url that always resolves to your IP address.
is this safe? would it not be safer to ask for a static IP address to my ISP?

I will check connection tomorrow.
 
Old 02-03-2019, 05:09 PM   #52
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
As far as I know it isn't less safe. There will still be people scanning IP addresses including yours looking for vulnerabilities and ssh servers trying to break in using common usernames and passwords which is why disabling password authentication is important.
 
2 members found this post helpful.
Old 02-04-2019, 08:33 AM   #53
however
Member
 
Registered: Jan 2019
Distribution: slackware current
Posts: 523

Original Poster
Rep: Reputation: Disabled
trying to connect from work, box A, i get:
Code:
bash-4.2$ ssh home_desktop 
/home/user/.ssh/config: line 6: Bad configuration option: addkeystoagent
/home/user/.ssh/config: terminating, 1 bad configuration options
bash-4.2$
my confirg file on box A is
Code:
Host home_desktop
        HostName box_B_public_IP
        User box_B_user			
        IdentitiesOnly yes
        IdentityFile /home/darkstar/.ssh/id_rsa
        AddKeysToAgent ask
suggestions?
 
Old 02-04-2019, 08:40 AM   #54
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
It depends on the ssh version running on the computer. Just remove the option for now.

Last edited by michaelk; 02-04-2019 at 08:43 AM.
 
Old 02-06-2019, 04:38 AM   #55
however
Member
 
Registered: Jan 2019
Distribution: slackware current
Posts: 523

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
It depends on the ssh version running on the computer. Just remove the option for now.
Code:
bash-4.2$ ssh -V
OpenSSH_6.3p1, OpenSSL 1.0.1e 11 Feb 2013
(option removed)

I've had internet issues at work (ISP problems) and now i am back testing the ssh connection between box A and B (on two different networks).

when I ssh home_desktop, i get this msg:
Code:
bash-4.2$ ssh home_desktop
Permission denied (publickey,keyboard-interactive).
I have commented out "# PasswordAuthentication" for testing ssh on localhost and it gets connected OK. However, if i uncomment "PasswordAuthentication" it gives me the same error msg when i try to connect to localhost
Code:
bash-4.2$ ssh localhost
Permission denied (publickey,keyboard-interactive).
What else am i missing?
 
Old 02-06-2019, 04:48 AM   #56
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
Check permissions of keys. Use -v option with ssh commands to help debug.

Did you change anything?
 
Old 02-06-2019, 05:27 AM   #57
however
Member
 
Registered: Jan 2019
Distribution: slackware current
Posts: 523

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
Check permissions of keys. Use -v option with ssh commands to help debug.

Did you change anything?
after creating the config file on ~/.ssh , I removed "AddKeysToAgent ask"

then i made sure to forward port 22 on localhost, on section 'gaming&applicaitons' of my modem (confirmed with https://www.yougetsignal.com/tools/open-ports/)

p.s.: permission for keys is set to darkstar users

Last edited by however; 02-06-2019 at 05:31 AM.
 
Old 02-06-2019, 05:28 AM   #58
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,359
Blog Entries: 3

Rep: Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767Reputation: 3767
What about the file name for the key?
 
Old 02-06-2019, 05:32 AM   #59
however
Member
 
Registered: Jan 2019
Distribution: slackware current
Posts: 523

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Turbocapitalist View Post
What about the file name for the key?
/.ssh/id_rsa and id_rsa.pub

beside any issues with the keys, should i not be able to connect to localhost though?

Code:
bash-4.2$ ssh -v localhost
OpenSSH_6.3, OpenSSL 1.0.1e 11 Feb 2013
debug1: Reading configuration data /home/darkstar/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/darkstar/.ssh/id_rsa type 1
debug1: identity file /home/darkstar/.ssh/id_rsa-cert type -1
debug1: identity file /home/darkstar/.ssh/id_dsa type -1
debug1: identity file /home/darkstar/.ssh/id_dsa-cert type -1
debug1: identity file /home/darkstar/.ssh/id_ecdsa type -1
debug1: identity file /home/darkstar/.ssh/id_ecdsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.3
debug1: match: OpenSSH_6.3 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 8b:ae:92:a9:ec:8e:d9:ce:4d:20:e0:cf:6f:b6:78:f7
debug1: Host 'localhost' is known and matches the ECDSA host key.
debug1: Found key in /home/darkstar/.ssh/known_hosts:3
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/darkstar/.ssh/id_rsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /home/darkstar/.ssh/id_dsa
debug1: Trying private key: /home/darkstar/.ssh/id_ecdsa
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: No more authentication methods to try.
Permission denied (publickey,keyboard-interactive).
bash-4.2$

Last edited by however; 02-06-2019 at 05:38 AM.
 
Old 02-06-2019, 05:40 AM   #60
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
Does your home desktop have an authorized_keys file?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
3 Ubuntu boxes with Samba - One finds all XP shares - Two UltraSparc64 boxes do not mwx Linux - Server 1 01-28-2009 06:03 AM
connecting two slackware linux boxes with an ethernet cable riodeuno Linux - Networking 3 12-17-2008 11:56 PM
connecting two linux boxes together jeffbk Linux - Networking 2 05-08-2007 12:12 PM
Connecting two linux boxes via cross cable ElPuello Linux - Networking 4 11-10-2004 10:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration