Ask questionsCallhome Failed to set hostkey 'genkey'
In contrast to ssh-keygen (the tool available on Unix-like platforms), which generates separate files for the public key and the private key, keytool stores both keys as a single entry in a file called a keystore. By running keytool multiple times, you can add multiple public-private key entries to the same keystore. Ssh-keygen is a tool for creating new authentication key pairs for SSH. Such key pairs are used for automating logins, single sign-on, and for authenticating hosts. SSH Keys and Public Key Authentication The SSH protocol uses public key cryptography for authenticating hosts and users.
Start the ssh-agent in the background. $ eval '$(ssh-agent -s)' Agent pid 59566; If you're using macOS Sierra 10.12.2 or later, you will need to modify your /.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain. First, check to see if your /.ssh/config file exists in the default location. $ open /.ssh/config The file /Users/you/.ssh. $ ssh-keygen -lf ided25519.pub 256 SHA256:PO2bk6B. It is unlikely that the recommend ED25519 SSH key is only 256 bits long. Linux ubuntu key ssh-keys openssh. The SSH Daemon enables the Add Host Targets Wizard to establish SSH connectivity between the OMS host and the host on which you want to install a Management Agent. Using this connectivity, the wizard transfers the Management Agent software binaries to the destination host over SSH protocol, installs the Management Agent, and configures it.
I try to test a callhome procedure but met a ssh problem.version:sysrepo 1.4.58netopeer2 1.1.27libssh 0.9.2 (from /usr/local/include/libssh/libssh.h
)In fact,I really think the merge_hostkey.sh should be executed during installation because I can saw the running data of ietf-keystore after installation. But I can not find the genkey file in my system by find / -name genkey*
.So I generated the key pair by myself,use the ssh-keygen command:ssh-keygen -t rsa -b 2048 -N ‘’ -C “cpesn” -f genkey -q
The key pair was copied into /etc/ssh
.After this,I modifed the ssh_callhome.xml, pasted the private key and public key into hostkey_config.xml,some of the details are as follows:ssh_callhome.xml
hostkey_config.xml
Re-run sysrepo-plugind and netopeer2-server, it went to callhome procedure but Failed to set hostkey,the output as follows:
I'm confused about the error path /tmp/***,why is not /root/.ssh or /etc/ssh or /usr/local/etc/keystored/keys/?Which one should be the correct one?Is my step wrong?Any help would be appreciated!
CESNET/netopeer2Mendel Development Tool (MDT) is a command-line tool that lets you communicate with a device runningMendel Linux.
The mdt
commandfacilitates a variety of device actions such as opening a shell, installing Debian packages, pushingand pulling files, and more.
Install MDT
The server-side component that runs on your board is included with the Mendel system image.So you only need to install the mdt
client on your host computer (Linux, macOS, or Windows 10).
You can install MDT on your host computer follows:
You might see a warning that mdt
was installed somewhere that's not in your PATH
environment variable. If so, be sure you add the given location to your PATH
, as appropriate foryour operating system. If you're on Linux, you can add it like this:
Connect to a board's shell
MDT can access the shell on any Mendel device that's visible on your network (as long as the devicealready has your OpenSSH key installed), or MDT can connect over USB when you connect your computerto the device, using the board's USB OTG port.
If you have just one device, run this command:
When you want to exit the shell, type exit
.
When you connect to a board with mdt shell
, it uses OpenSSH with key-based authentication(PEM-formatted and passwordless). The public key is saved on the board in/home/mendel/.ssh/authorized_keys
and the private key is saved on your host computer in~/.config/mdt/keys/mdt.key
(this key is used only when connecting with mdt shell
). If the boarddoesn't have a key yet, mdt shell
creates it and pushes it. For other MDT commands that helpmanage your keys, see all the MDT commands.
Connect to multiple boards
After you've connected to a board with MDT, you can reuse the same mdt.key
file with additionalboards. It's just a matter of pushing this key to the authorized_keys
file on each board:
If your additional board is newly flashed (or just unboxed), run
mdt shell
andit will push your existing MDT key from your computer's~/.config/mdt/keys/mdt.key
file.If your additional board already has an MDT key in it's
authorized_keys
file, follow theinstructions to connect from multiple computers.
Then, you can list all available boards with mdt devices
and connect by specifying the name(or IP address):
Connect to a board from multiple computers
Once you've connected to the board with one computer, you cannot immediately connect from anothercomputer because mdt shell
will not push a new key if the board already has one in theauthorized_keys
file (and if the mdt-keymaster
service is not running).
To connect from additional computers, just copy the mdt.key
file from thefirst computer and save it to ~/.config/mdt/keys/mdt.key
on each computer you want to use.
If you don't have access to the first computer, see how torecover MDT access.
Recover MDT access
If you lose the private key stored at ~/.config/mdt/keys/mdt.key
(such as by switchingcomputers) or you lose the public key on the Coral board, then MDT cannot connect.
To recover access with MDT, follow these steps:
Connect to your board using the serial console (see the instruction for DevBoard or Dev Board Mini).
On the board, delete the contents of the
/home/mendel/.ssh/authorized_keys
file.On the board, restart the
mdt-keymaster
service with this command:On your host computer, delete the
~/.config/mdt/keys/mdt.key
file.Either connect to your computer to the board via USB or ensure both are on the same Wi-Fi network.
Apache jmeter download mac. On your host computer, generate a new key and connect:
Connect using other SSH tools
If you prefer to use other SSH tools, simply generate your own key and then push that oneto the device with mdt pushkey
. For example, run the following on your host computer:
MDT commands
The following table provides a reference of the available commands you can use with mdt
usingthis syntax:
You can also use mdt help
and man mdt
for information about what commands are available in your version of MDT.
Subcommand | Description |
---|---|
devices | Returns a list of device names and IP addresses found on the local networksegment. Also indicates if a given device is marked as your default. Uses the Note: MDT uses a python implementation of mDNS ZeroConf for discovery, soit does not require a running Avahi daemon. |
wait-for-device | Waits for a device to be discovered on the network. |
get variable-name | Returns the value currently set for a given variable name. Some usefulvariables are:
If no variable name is provided, |
set variable-name | Sets the value for a given variable name. See example variables for the correspondingget command above.Note that setting a variable to the empty string does not clear it back tothe default value. Use |
clear variable-name | Clears the value for a given variable name, resetting it back to itsdefault value. |
genkey | Generates an SSH key and saves it to the local machine (at ~/.config/mdt/keys/mdt.key ).If you already have an To rotate your keys, call |
pushkey path-to-ssh-public-key | Copies an SSH public key to the Mendel device's $HOME/.ssh/authorized_keys file. Ifan MDT private key is provided (the mdt.key file), this will push the public half ofthat key to the device's authorized_keys file. If no public key is provided, itattempts to push MDT's previously generated public key from$HOME/.config/mdt/keys/mdt.key .To rotate your keys, call |
setkey path-to-private-key | Copies a PEM-format SSH private key into the Mendel device's MDT keystore for use withauthentication later. |
resetkeys device-or-ip-address | Resets a device to it's pre-MDT state by removing all MDT keys and restartingthe mdt-keymaster on the device so that new keys can be pushed again. To rotate your keys, call |
shell [device-or-ip-address] | Opens an interactive shell to either your preferred device or to the firstdevice found.If device-or-ip-address is specified, shell attempts to connect to thatdevice name or directly to the IP address provided instead. Uses the variables If no SSH key is available on disk (you didn't run |
exec [shell-command..] | Opens a non-interactive shell to either your preferred device or to the firstdevice found, runs a shell command and returns the output and the exit code. If no SSH key is available on disk, it follows the same steps as the |
install deb-package-file | Installs a given Debian package file to the connected device viamdt-install-package . Uses the variables preferred-device ,username , and password (see the get command above).Note: If the package provided has dependencies that are not already installed onthe device, this will require internet connectivity to fetch and install thosedependencies. |
push local-path.. [remote-path] | Pushes (copies) a local file or set of files to the remote device. If you specify a directory forlocal-path, then that directory is added to the remote location and the contents arecopied recursively. local-path may be an absolute path or a relative path.If you omit remote-path, MDT uses Uses the variables |
pull remote-path..local-path | Pulls (copies) a set of files from the remote device to a local path. If you specify a directoryfor remote-path, then that directory is added to the local location and the contents arecopied recursively. remote-path may be an absolute path or a path relative to Uses the variables |
reboot | Reboots a device. |
reboot-bootloader | Reboots a device to the bootloader and starts fastboot mode. After running this,you should see your device listed when you run fastboot devices , making it easy tothen flash the device (see how to flashthe Dev Board or the Dev BoardMini). |
version | Prints which version of MDT this is. |
MDT on macOS
How To Generate Ssh Key
Beginning with macOS Catalina (10.15), you cannot create an MDT (or other SSH) connection over USB.However, you can still use MDT over your local network—you just need to install an OpenSSH keyon your Coral board. Then your Mac can connect to the board over the local network.
So, here's how to create an SSH key and put it on your board using the serial console:
Make sure your board is fully booted up.
Connect a USB cable from your computer to the board's OTG port, and then run the following command in a terminal:
You should see a device like this:
'XXX' will be a number or your board's hostname.
Connect to that device using a serial console program such as
screen
as follows:If the screen terminal is blank, press Enter and then you should see the login prompt.
Log in using the username 'mendel' and password 'mendel'.
In the serial console, create a new file for the public SSH key:
Keep this serial console open while you create the SSH key..
On your Mac, open another terminal and create a PEM-formatted SSH key pair:
When prompted to enter a file name, type 'mendel', and leave the passphrase empty.
This creates a private key called
mendel
and a public key calledmendel.pub
(in the currentdirectory).Set the file permissions and relocate the private key on your Mac as shown here:
Now put the public key on the Coral board:
- In your Mac terminal, view the
mendel.pub
file (typecat mendel.pub
) and copy the file contents. - Go to the serial console and paste the key into the
authorized_keys
file you created above. - Then save and close the
authorized_keys
file (in the VI editor, press ESC, then type:wq
and press Enter.)
- In your Mac terminal, view the
There you go! Now just make sure your Coral board is on the same local network as your Mac (get onthe same Wi-Fi) and you'll be able to use MDT from the Mac:
To connect the board to Wi-Fi, run this command from the serial console:
Then select
Activate a connection
and follow the UI to join the same network as your Mac.Finally, open a new terminal on your Mac and connect to the board:
Ssh-genkey Linux
Is this content helpful?