Image

Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Permission denied when using curl on secondary drive

+2
−0

I am using Ubuntu 24.04. My problem occurs only on the secondary SDD, not the primary, original one. I would like to download things to it using a script, but every time I try to use curl to download, it gives the error "Permission denied". What I have tried:

  • Running the command as sudo

  • Creating a new mount point for the drive and editing fstab

  • Giving the directory user and group read, write and execute permissions (sudo chmod 777)

But the problem persists.

Edit as per request in comment:

Permissions of the directory where I am trying to dl the files: drwxrwxrwx 4 laur laur

$ namei -l /media/laur/Herz/home/laur/Desktop/ncbi_dl/
f: /media/laur/Herz/home/laur/Desktop/ncbi_dl/
drwxr-xr-x root root /
...

$ mount | grep "nvme0n1p2"
/dev/nvme0n1p2 on /media/laur/Herz type ext4 (rw,relatime)

Complete output of curl command:

$ curl -v -O -C - --retry 5 --retry-delay 10 https://example.com
Warning: No remote file name, uses "curl_response"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Host example.com:443 was resolved.
* IPv6: 2600:1408:ec00:36::1736:7f24, 2600:1406:bc00:53::b81e:94c8, 2600:1408:ec00:36::1736:7f31, 2600:1406:bc00:53::b81e:94ce, 2600:1406:3a00:21::173e:2e66, 2600:1406:3a00:21::173e:2e65
* IPv4: 23.192.228.80, 23.215.0.138, 96.7.128.198, 96.7.128.175, 23.192.228.84, 23.215.0.136
*   Trying [2600:1408:ec00:36::1736:7f24]:443...
* Immediate connect fail for 2600:1408:ec00:36::1736:7f24: Network is unreachable
*   Trying [2600:1406:bc00:53::b81e:94c8]:443...
* Immediate connect fail for 2600:1406:bc00:53::b81e:94c8: Network is unreachable
*   Trying [2600:1408:ec00:36::1736:7f31]:443...
* Immediate connect fail for 2600:1408:ec00:36::1736:7f31: Network is unreachable
*   Trying [2600:1406:bc00:53::b81e:94ce]:443...
* Immediate connect fail for 2600:1406:bc00:53::b81e:94ce: Network is unreachable
*   Trying [2600:1406:3a00:21::173e:2e66]:443...
* Immediate connect fail for 2600:1406:3a00:21::173e:2e66: Network is unreachable
*   Trying [2600:1406:3a00:21::173e:2e65]:443...
* Immediate connect fail for 2600:1406:3a00:21::173e:2e65: Network is unreachable
*   Trying 23.192.228.80:443...
* ALPN: curl offers h2,http/1.1
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [1557 bytes data]
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* TLSv1.3 (IN), TLS change cipher, Change cipher spec (1):
{ [1 bytes data]
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
{ [29 bytes data]
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* TLSv1.3 (IN), TLS handshake, Certificate (11):
{ [2350 bytes data]
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
{ [79 bytes data]
* TLSv1.3 (IN), TLS handshake, Finished (20):
{ [52 bytes data]
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.3 (OUT), TLS handshake, Finished (20):
} [52 bytes data]
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384 / x25519 / id-ecPublicKey
* ALPN: server accepted h2
* Server certificate:
*  subject: C=US; ST=California; L=Los Angeles; O=Internet Corporation for Assigned Names and Numbers; CN=*.example.com
*  start date: Jan 15 00:00:00 2025 GMT
*  expire date: Jan 15 23:59:59 2026 GMT
*  subjectAltName: host "example.com" matched cert's "example.com"
*  issuer: C=US; O=DigiCert Inc; CN=DigiCert Global G3 TLS ECC SHA384 2020 CA1
*  SSL certificate verify ok.
*   Certificate level 0: Public key type EC/prime256v1 (256/128 Bits/secBits), signed using ecdsa-with-SHA384
*   Certificate level 1: Public key type EC/secp384r1 (384/192 Bits/secBits), signed using ecdsa-with-SHA384
*   Certificate level 2: Public key type EC/secp384r1 (384/192 Bits/secBits), signed using ecdsa-with-SHA384
* Connected to example.com (23.192.228.80) port 443
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://example.com/
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: example.com]
* [HTTP/2] [1] [:path: /]
* [HTTP/2] [1] [user-agent: curl/8.15.0]
* [HTTP/2] [1] [accept: */*]
} [5 bytes data]
> GET / HTTP/2
> Host: example.com
> User-Agent: curl/8.15.0
> Accept: */*
> 
* Request completely sent off
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [265 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [265 bytes data]
< HTTP/2 200 
< accept-ranges: bytes
< content-type: text/html
< etag: "84238dfc8092e5d9c0dac8ef93371a07:1736799080.121134"
< last-modified: Mon, 13 Jan 2025 20:11:20 GMT
< content-length: 1256
< cache-control: max-age=2619
< date: Tue, 12 Aug 2025 11:53:58 GMT
< alt-svc: h3=":443"; ma=93600,h3-29=":443"; ma=93600
< 
} [5 bytes data]
Warning: Failed to open the file curl_response: Permission denied
* client returned ERROR on write of 1256 bytes
} [5 bytes data]
  0  1256    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Connection #0 to host example.com left intact
curl: (23) client returned ERROR on write of 1256 bytes
``
History

1 comment thread

Please edit more information into your question (2 comments)

1 answer

+2
−0

I ended up figuring it out for myself just now. It is the fault of the snap version of curl. Simply uninstalling it and installing the proper apt version worked like a charm.

$ sudo snap remove curl
$ sudo apt install curl
History

0 comment threads

Sign up to answer this question »