sshwitch icon indicating copy to clipboard operation
sshwitch copied to clipboard

sshwitch -b <name> backups to wrong location

Open stefanjohncollier opened this issue 4 years ago • 0 comments

Hi there, When I run sshwitch -b I get the following issues:

  • Stores the backup in the .ssh dir not the dir
  • Stores it with the wrong name i.e.

e.g.

$ cd ~/.ssh
$ ls
config id_rsa  id_rsa.pub  known_hosts

$ sshwitch -b foo
Copying current key pair in /Users/stefan/.ssh/ to /Users/stefan/.ssh/foo
cp /Users/stefan/.ssh//id_rsa /Users/stefan/.ssh/fooid_rsa
cp /Users/stefan/.ssh//id_rsa.pub /Users/stefan/.ssh/fooid_rsa.pub

$ ls
config  fooid_rsa  fooid_rsa.pub  id_rsa  id_rsa.pub  known_hosts foo/

$ ls ~/.ssh/foo

Expected behaviour:

$ cd ~/.ssh
$ ls
config id_rsa  id_rsa.pub  known_hosts

$ sshwitch -b foo
Copying current key pair in /Users/stefan/.ssh/ to /Users/stefan/.ssh/foo
cp /Users/stefan/.ssh/id_rsa /Users/stefan/.ssh/foo/id_rsa
cp /Users/stefan/.ssh/id_rsa.pub /Users/stefan/.ssh/foo/id_rsa.pub

$ ls
config  id_rsa  id_rsa.pub  known_hosts foo/

$ ls ~/.ssh/foo
id_rsa  id_rsa.pub

To mitigate this, I've done the backup manually. To get the expected directory structure. And the switch then works!


Relevant Specifications

OSX: 11.1 (20C69)

$ ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18

stefanjohncollier avatar Jan 28 '21 12:01 stefanjohncollier