Scp not working ssh works!

Linux computer OpenSUSE 15.3 is client user mi address 192.168.0.6
Raspberry pi Rasbian is host user pi address 192.168.0.26
Connected via wifi
on linux:
ssh mi@192.168.0.26
it works I get a console on the Rpi computer.
Now I give the command
scp /home/pi/file mi@192.168.0.6:/home/mi
I get
ssh: connect to host 192.168.0.6 port 22: Connection refused
With Yast I inactivated the firewall. That did not work
The external,home etc zone’s all contain the ssh service
Any suggestions? Thanks for your attention

1 Like

Hi,

Can you add the -v flag to scp and see what gives?, e.g.

scp -v /home/pi/file mi@192.168.0.6:/home/mi

1 Like

Start with comparing apples with apples and use the same host address in both commands.

server is on 192.168.0.26 running so:
sshh x@192.168.0.26 is working.

Is on 192.168.0.6 also an ssh Server running???
because:
scp -v /home/pi/file mi@192.168.0.6:/home/mi

OpenSSH_8.4p1 Raspbian-5+deb11u1, OpenSSL 1.1.1n 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 192.168.0.6 [192.168.0.6] port 22.
debug1: connect to address 192.168.0.6 port 22: Connection refused
ssh: connect to host 192.168.0.6 port 22: Connection refused
lost connection

Are you sure sshd is running on 192.168.0.6?

Yes on the linux machine(192.168.0.6 sshd is also running
I have the impression that the scp connection is refused by the linux machine
That is why I inactivated the firewall Did not help

What about:
ssh mi@192.168.0.6

The Rpi is at the moment not connected to Keyboard mouse Screen
I go to the Rpi console via ssh.
In the console I give the command:
middlecope@framboos:~ $ ssh 192.168.0.6
ssh: connect to host 192.168.0.6 port 22: Connection refused

Normally (if you use Port 22)
ssh USER@IP
or
ssh USER@HOSTNAME

Same problem:
ssh -v mi@192.168.0.6
OpenSSH_8.4p1 Raspbian-5+deb11u1, OpenSSL 1.1.1n 15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 192.168.0.6 [192.168.0.6] port 22.
debug1: connect to address 192.168.0.6 port 22: Connection refused

I think I will start all over again
On both computer deleting the .ssh folders and making new keys !
Do you think that is a good idea?

Have you disabled password authentification in sshd.conf?
Have you created User mi on the System?
Have you send the key from the System you want to connect to 192.168.0.6?

I use
ssh-keygen
to generate a key and
ssh-copy-id
to copy it to the Server.

None of these will result in “Connection refused”. “Connection refused” means that either sshd is not active (on default port) or firewall blocks this port on host 192.168.0.6.

When lost starting from scratch is always a good idea. You may want to check:

3400G:~ # systemctl status sshd.service 
● sshd.service - OpenSSH Daemon
     Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; preset: disabled)
     Active: active (running) since Mon 2023-04-10 21:05:42 CEST; 1 day 12h ago
    Process: 957 ExecStartPre=/usr/sbin/sshd-gen-keys-start (code=exited, status=0/SUCCESS)
    Process: 965 ExecStartPre=/usr/sbin/sshd -t $SSHD_OPTS (code=exited, status=0/SUCCESS)
   Main PID: 971 (sshd)
      Tasks: 1
        CPU: 37ms
     CGroup: /system.slice/sshd.service
             └─971 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"

Apr 10 21:05:42 3400G systemd[1]: Starting OpenSSH Daemon...
Apr 10 21:05:42 3400G sshd-gen-keys-start[957]: Checking for missing server keys in /etc/ssh
Apr 10 21:05:42 3400G sshd[971]: Server listening on 0.0.0.0 port 22.
Apr 10 21:05:42 3400G sshd[971]: Server listening on :: port 22.
Apr 10 21:05:42 3400G systemd[1]: Started OpenSSH Daemon.
3400G:~ # 

Check journal for messages:

3400G:~ # journalctl -b -u sshd.service 
Apr 10 21:05:42 3400G systemd[1]: Starting OpenSSH Daemon...
Apr 10 21:05:42 3400G sshd-gen-keys-start[957]: Checking for missing server keys in /etc/ssh
Apr 10 21:05:42 3400G sshd[971]: Server listening on 0.0.0.0 port 22.
Apr 10 21:05:42 3400G sshd[971]: Server listening on :: port 22.
Apr 10 21:05:42 3400G systemd[1]: Started OpenSSH Daemon.
3400G:~ # 

Ok thanks…

I think Middlecope is not setting up an sshd on both systems or disabling the firewall for testing.

@karlmistelberger
Here are the result for the linux computer:
Do you see anything strange?
By the way teunis username thuis name of linux computer

teunis@thuis:~> systemctl status sshd.service
● sshd.service - OpenSSH Daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disa>
Active: active (running) since Wed 2023-04-12 08:16:19 AST; 2h 19min ago
Process: 1578 ExecStartPre=/usr/sbin/sshd-gen-keys-start (code=exited, status=0/SUC>
Process: 1620 ExecStartPre=/usr/sbin/sshd -t $SSHD_OPTS (code=exited, status=0/SUCC>
Main PID: 1640 (sshd)
Tasks: 1
CGroup: /system.slice/sshd.service
└─1640 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups

teunis@thuis:~> sudo journalctl -b -u sshd.service 
[sudo] password for root: 
-- Logs begin at Wed 2023-04-12 04:15:36 AST, end at Wed 2023-04-12 10:38:25 AST. --
Apr 12 08:16:19 thuis systemd[1]: Starting OpenSSH Daemon...
Apr 12 08:16:19 thuis sshd-gen-keys-start[1578]: Checking for missing server keys in /e>
Apr 12 08:16:19 thuis sshd[1640]: Server listening on 0.0.0.0 port 22.
Apr 12 08:16:19 thuis sshd[1640]: Server listening on :: port 22.
Apr 12 08:16:19 thuis systemd[1]: Started OpenSSH Daemon.

Upgraded and rebooted host notebook. Password-less login works from host 3400G as well as scp:

3400G:~ # scp text.txt notebook:/root/
text.txt                                                                                                                                                                                                  100%    0     0.0KB/s   00:00    
3400G:~ # 
3400G:~ # ssh notebook journalctl -b -u sshd.service
Apr 12 16:34:19 notebook systemd[1]: Starting OpenSSH Daemon...
Apr 12 16:34:19 notebook sshd-gen-keys-start[1050]: Checking for missing server keys in /etc/ssh
Apr 12 16:34:19 notebook sshd[1180]: Server listening on 0.0.0.0 port 22.
Apr 12 16:34:19 notebook sshd[1180]: Server listening on :: port 22.
Apr 12 16:34:19 notebook systemd[1]: Started OpenSSH Daemon.
Apr 12 16:59:22 notebook sshd[3735]: Accepted publickey for root from 10.0.0.2 port 49610 ssh2: RSA SHA256:jioLatt1LEaQeir3UJ72Da6qBRTPhpCP8UcfFAjEGVM
Apr 12 17:02:39 notebook sshd[3735]: Received disconnect from 10.0.0.2 port 49610:11: disconnected by user
Apr 12 17:02:39 notebook sshd[3735]: Disconnected from user root 10.0.0.2 port 49610
Apr 12 17:02:54 notebook sshd[3806]: Accepted publickey for root from 10.0.0.2 port 53396 ssh2: RSA SHA256:jioLatt1LEaQeir3UJ72Da6qBRTPhpCP8UcfFAjEGVM
Apr 12 17:02:54 notebook sshd[3806]: Received disconnect from 10.0.0.2 port 53396:11: disconnected by user
Apr 12 17:02:54 notebook sshd[3806]: Disconnected from user root 10.0.0.2 port 53396
Apr 12 17:04:28 notebook sshd[3835]: Accepted publickey for root from 10.0.0.2 port 58670 ssh2: RSA SHA256:jioLatt1LEaQeir3UJ72Da6qBRTPhpCP8UcfFAjEGVM
3400G:~ #