# Mender-cli cp 405 Not Allowed

**URL:** https://hub.mender.io/t/mender-cli-cp-405-not-allowed/5661
**Category:** General Discussions
**Created:** [March 8, 2023, 5:09pm UTC](https://hub.mender.io/t/mender-cli-cp-405-not-allowed/5661 "2023-03-08T17:09:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dunning.simon](https://avatars.discourse-cdn.com/v4/letter/d/57b2e6/32.png) [@dunning.simon](https://hub.mender.io/u/dunning.simon)
#### Post date: [March 8, 2023, 5:09pm UTC](https://hub.mender.io/t/mender-cli-cp-405-not-allowed/5661/1 "2023-03-08T17:09:29Z")

</div>

Hi There,

I’m trying to use `mender-cli` to copy a file from my local workstation to a Mender device.

The device is connected. I am able to connect to the terminal and port forward using `mender-cli` but the `cp` command gives me the error below.

```bash
mender-cli cp --server $MENDER_SERVER --token-value $MENDER_PAT upsize.sh <DEVICE_ID>:/home/test/
Configuration file not found. Continuing.
Error: Received unexpected response code: 405
FAILURE: Error: <html>
<head><title>405 Not Allowed</title></head>
<body>
<center><h1>405 Not Allowed</h1></center>
<hr><center>nginx</center>
</body>
</html>

```

I was thinking it could be due to permissions so i configured /etc/mender/mender-connect.conf to use root user but still i get the 405 error.

mender-client is version 3.5.0  
We are using self hosted mender version 3.4.0

---

<div class="post-metadata">

### Author: ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://hub.mender.io/u/peter)
#### Post date: [March 10, 2023, 8:59am UTC](https://hub.mender.io/t/mender-cli-cp-405-not-allowed/5661/2 "2023-03-10T08:59:57Z")

</div>

Hello @dunning.simon

thank you for using Mender. it is nice to meet you.  
could you please do four things for me:

- restart mender-connect on a device
- share the mender-connect config file with me
- do the same command but trying the terminal:

```auto
mender-cli terminal --server "$MENDER_SERVER" --token-value "$MENDER_PAT" <DEVICE_ID>

```

- give me the output of `ps axuw | grep mender` from the device

best regards,  
peter

---

<div class="post-metadata">

### Author: ![atartanianMO](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@atartanianMO](https://hub.mender.io/u/atartanianMO)
#### Post date: [May 31, 2024, 7:07pm UTC](https://hub.mender.io/t/mender-cli-cp-405-not-allowed/5661/3 "2024-05-31T19:07:10Z")

</div>

hi @peter , I’m also seeing this same issue with mender-cli using the cp command. I’m able to connect via the terminal command, port-forward etc, but cp throws a 405 and the request doesn’t seem to be hitting the machine’s client at all.

```auto
> mender-cli cp ./scripts/test/moadmin-start.original 2d204bca-518c-4a74-9ce0-b5e602890de0:/home/moadmin/testing_file -v

results in

Using configuration file: /Users/atartanian/Development/moutfitters/mo_local_kiosk/.mender-clirc
VERBOSE verbose output is ON
VERBOSE sending request: 
GET /api/management/v1/deviceconnect/devices/2d204bca-518c-4a74-9ce0-b5e602890de0 HTTP/1.1
Host: hosted.mender.io
Authorization: Bearer <redacted>

VERBOSE Uploading the file to /home/moadmin/testing_file
VERBOSE sending request: 
PUT //api/management/v1/deviceconnect/devices/2d204bca-518c-4a74-9ce0-b5e602890de0/upload HTTP/1.1
Host: hosted.mender.io
Authorization: Bearer <redacted>
Content-Type: multipart/form-data; boundary=d2a00a6d8fe7ea03f73d3a0cb3e5e1e3fe716b58bb7f50e8f594cd2f0ae5

Error: Received unexpected response code: 405
FAILURE: Error: <html>
<head><title>405 Not Allowed</title></head>
<body>
<center><h1>405 Not Allowed</h1></center>
<hr><center>nginx</center>
</body>
</html>

```

mender-connect config looks like this:

```auto
{
    "ShellCommand": "/bin/sh",
    "User": "root"
}

```

and here’s the process showing that mender-connect is running (our devices are running a minimal version of ps so I can’t use the axuw options):

```auto
root@raspberrypi4-64:/etc/mender# ps | grep mender
  632 root 1652m S /usr/bin/mender --no-syslog daemon
  633 root 1565m S /usr/bin/mender-connect daemon
62469 root 2960 S grep mender

```

any help would be much appreciated!

EDIT: I’ve also found that downloading files doesn’t work either, but throws a 404 File Not Found on Device

```auto
> mender-cli cp 2d204bca-518c-4a74-9ce0-b5e602890de0:/home/moadmin/moadmin-start ./isItWorking -v

Using configuration file: /Users/atartanian/Development/moutfitters/mo_local_kiosk/.mender-clirc
VERBOSE verbose output is ON
VERBOSE sending request: 
GET /api/management/v1/deviceconnect/devices/2d204bca-518c-4a74-9ce0-b5e602890de0 HTTP/1.1
Host: hosted.mender.io
Authorization: Bearer <redacted>

VERBOSE sending request: 
GET //api/management/v1/deviceconnect/devices/2d204bca-518c-4a74-9ce0-b5e602890de0/download?path=%2Fhome%2Fmoadmin%2Fmoadmin-start HTTP/1.1
Host: hosted.mender.io
Authorization: Bearer <redacted>

VERBOSE Response: 
HTTP/1.1 404 Not Found
Content-Length: 54
Connection: keep-alive
Content-Type: application/json
Date: Fri, 31 May 2024 19:20:45 GMT
Referrer-Policy: no-referrer
Server: nginx
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block

{"error": {"status_code": 404,"message": "Not Found"}}
File not found on the device

FAILURE: Error: {"error": {"status_code": 404,"message": "Not Found"}}

```

---

<div class="post-metadata">

### Author: ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://hub.mender.io/u/peter)
#### Post date: [August 16, 2024, 2:13pm UTC](https://hub.mender.io/t/mender-cli-cp-405-not-allowed/5661/4 "2024-08-16T14:13:39Z")

</div>

Hello @atartanianMO ,

thank you for using Mender.  
this seems a bit strange, I need:

1. your exact Mender Client, and Mender Connect versions.
2. logs from mender-connect: journalctl -u mender-connect \> /tmp/mc.log; and the same for mender-client
3. output of `stat /home/moadmin/moadmin-start` on the device.

sorry about lots of requests 🙂

best regards,  
peter
