In other Linux platforms, I would add my SSH RSA public key to the ~/.ssh/authorized_keys file. But when I go in to the VyOS .ssh/authorized_keys file, it says:
vyos@VYOS# cat .ssh/authorized_keys
# Automatically generated by Vyatta configuration
# Do not edit, all changes will be lost
What is the correct way to add a key in VyOS that will survive a reboot?
vyos@VYOS:~$ sudo loadkeys -h
loadkeys version 1.15.2
Usage: loadkeys [option…] [mapfile…]
Valid options are:
-b --bkeymap output a binary keymap to stdout
-c --clearcompose clear kernel compose table
-C <cons1,cons2,…> --console=<cons1,cons2,…>
the console device(s) to be used
-d --default load “defkeymap.kmap”
-h --help display this help text
-m --mktable output a “defkeymap.c” to stdout
-q --quiet suppress all normal output
-s --clearstrings clear kernel string table
-u --unicode force conversion to Unicode
-v --verbose report the changes
[/code]
Here is my VyOS version:
vyos@VYOS:~$ show version
Version: VyOS 1.1.5
Description: VyOS 1.1.5 (helium)
You will need to upgrade to 1.1.7
be sure that you run command from op mode and not from configuration mode
in configuration mode you will need to prepend run
run loadkey vyos /path/to/id_rsa.pub
I know this is an old question, however, I believe this will really make it simpler for new users:
In my scenario:
pc1 = 192.168.0.3 (linux) username = user1
vyos = 192.168.0.101 (version 1.1.8) username = user1
login to vyos
switch to configuration mode
type the command: loadkey user1 scp://user1@192.168.0.3/home/user1/.ssh/id_rsa.pub
Output below: [edit] user1@vyos1# loadkey user1 scp://user1@192.168.0.3/home/user1/.ssh/id_rsa.pub Enter host password for user ‘user1’: ######################################################################## 100.0% ######################################################################## 100.0% Done [edit]
Now:
user1@pc1:~$ ssh 192.168.0.101
Welcome to VyOS
Linux vyos 3.13.11-1-amd64-vyos #1 SMP Sat Nov 11 12:10:30 CET 2017 x86_64
Welcome to VyOS.
This system is open-source software. The exact distribution terms for
each module comprising the full system are described in the individual
files in /usr/share/doc/*/copyright.
Last login: Sat Aug 11 16:17:21 2018 from 192.168.0.3
No ssh prompt and I can login using my rsa public key. Hope this helps.