-1

very time I'm trying to SCP something into my local linux it tells me... several things actually, starting with: Permission denied (publickey). lost connection Progressing forward, in this case its an image I am trying to move, I've tried several variations: scp -i key file_sending folder_recieving ssh key file_sending folder_recieving scp key -i file_sending folder_recieving scp {insert list of possible -i replacements + -i here} file_sending folder_recieving

^ replace all above leading with ssh instead.

I've tried them on both machines as well: Running a wsl on Windows. Also tried through VS - above variations. I should have to change it. The concept, nay the script is self is literally cut in dry. "Computer. Prepare to transfer file. You're gonna need a password first tho so, here have that... and this is gonna be the file, can ya grab that for me? thanks. Need you to put it over there now, brilliant!"

Nothing.

Dude do you know how many websites and Stack Overflow tickets have been opened on this topic as well. 45minutes of typing the same thing over, using two keys that I know are the keys, and two more I had on the machine but I know where not connected to the machine but figured hey, when it Rome?

Bubkiss.

At this point I'm under the impression something is f-ed with the machine SSH process. Side note: OpenSSH-server is no longer download about. Kinda side tracking but sudo apt install OpenSSH-server doesn't work. Says unable to locate package. Meanwhile, sudo systemctl status ssh that returned system has not been booted with systemd as init system (PID 1). Can't operate. Failed to connect to bus: Host is down and sudo ufw allow 22 to set the port just skilled adding existing rule, should have so yay? At least something went right?

The closest I've gotten so far is scp key -i file_sending folder_recieving before it kicked back the key denial with an added: Waring file C:/../config not accessible: No such file or directory. name@host: permision denined It should be noted that at that the config is not the key but the key config file. One of the websites on my search said it'd be possible.

All and all, at this point I'm convinced there isn't a solution because the key itself got screwed. I was planning to scrap the machine box anyways because I need it on a external... that said, anyone have an idea of what might have caused this issue? Or can confirm? If it can be fixed, that'd be awesome - can still work from it before I change over. Thanks in advance.

HiB
  • 1
  • 2
  • well, if I were you then before trying to get scp to work, try getting ssh to work.. also once you get ssh to work.. you might find sftp to be better https://superuser.com/questions/134901/whats-the-difference-between-scp-and-sftp – barlop Jul 01 '22 at 02:13
  • also that error `Permission denied (publickey)` is really misleading, it doesn't just apply to a key issue, it also comes if you get the username wrong. Also, if you do ssh host then it uses the username of the client. so you should do ssh user@host. Also, check that the local id_rsa.pub is within the remote ~/.ssh/authorized_hosts. And check the permissions.. like some should be 600(private keys) some 644(public keys) and the .ssh directory 700 – barlop Jul 01 '22 at 02:15
  • My .ssh directory has nothing in it besides a file named "known_hosts". Tried using the id_rsa.pub at one point, no success. Will definitely check permissions. The keys are located on Windows. In there own .ssh folder. Didn't know that about ```Permission denied (publickey)```, thanks! I'll definitely look into sftp. – HiB Jul 01 '22 at 02:40
  • well, I said " check that the local id_rsa.pub (public key) is within the **remote** `.ssh/authorized_hosts`" also you use the **private** key `ssh -i /abc/def/.ssh/id_rsa` – barlop Jul 01 '22 at 03:59
  • 1
    you contradict yourself. you say "My .ssh directory has nothing in it besides a file named "known_hosts"." AND you say "The keys are located on Windows. In there own .ssh folder. " – barlop Jul 01 '22 at 04:04
  • I assumed you meant the .ssh folder on the Linux box itself. I mentioned it to mentioned it being located on Windows in case that might have been part of the issue. The expectation being that someone would jump on and say, "what, thats wrong!" Not the what I expected, lol, excuse my ignorance. I have two .ssh folders. One on windows, which holds the keys, and one on Linux which holds mentioned file of "know_hosts". I'll be honest, no clue what the file is for. – HiB Jul 01 '22 at 19:50
  • Well, if you have no authorized_keys file on the remote side then you won't be able to log in with any key. Since you lack experience with ssh, take the easier route which creates authorized_keys for you. There is a command called ssh-copy-id and you would typicall set the remote side to allow you in with some password (make it a strong password).. When you can SSH to your machine with a password, then you can ssh-copy-id to it that will SSH for you and it will create authorized_hosts on the remote side and add the public key to it. – barlop Jul 01 '22 at 20:42
  • Thanks. I will do that. Appreciate the advise, I'll close this ticket out. – HiB Jul 02 '22 at 00:43

1 Answers1

0

Did what Barlop suggested inside the comment section above. Found my keys too, they were located in a repository under a different name on my windows. Set them over to the proper folder. Problem has been resolved and I have not had any issues since. Thanks.

HiB
  • 1
  • 2