Topics

Issues updating the host files

Abbot Carder
 

I am having issues updating my host files for DExtra.txt file. 


Here is what I did:


pi@compass:~ $ cd /usr/share/opendv ; ls -l *.txt

-rw-r--r-- 1 root root   450 May 24  2016 CCS_Hosts.txt

-rw-r--r-- 1 root root  1203 May 24  2016 DCS_Hosts.txt

-rw-r--r-- 1 root root 28493 May 24  2016 DExtra_Hosts.txt

-rw-r--r-- 1 root root 32412 May 24  2016 DPlus_Hosts.txt

pi@compass:/usr/share/opendv $ cd /usr/share/opendv

pi@compass:/usr/share/opendv $ sudo cp DPlus_Hosts.txt DPlus_Hosts.txt.old

pi@compass:/usr/share/opendv $ sudo curl http://ar-dns.net/dplus-gw > DPlus_Hosts.txt 

bash: DPlus_Hosts.txt: Permission denied


I keep getting Permission denied. I am not sure what I am doing wrong. 
Thanks for any help. 
Abbot 

 

That should work (this is basic Linux CLI stuff).

Try instead

cd /usr/share/opendv
# You may have to first remove your current .old, but then


On Tue, Feb 21, 2017 at 10:33 AM, Abbot Carder <ke8bts@...> wrote:

I am having issues updating my host files for DExtra.txt file. 


Here is what I did:


pi@compass:~ $ cd /usr/share/opendv ; ls -l *.txt

-rw-r--r-- 1 root root   450 May 24  2016 CCS_Hosts.txt

-rw-r--r-- 1 root root  1203 May 24  2016 DCS_Hosts.txt

-rw-r--r-- 1 root root 28493 May 24  2016 DExtra_Hosts.txt

-rw-r--r-- 1 root root 32412 May 24  2016 DPlus_Hosts.txt

pi@compass:/usr/share/opendv $ cd /usr/share/opendv

pi@compass:/usr/share/opendv $ sudo cp DPlus_Hosts.txt DPlus_Hosts.txt.old

pi@compass:/usr/share/opendv $ sudo curl http://ar-dns.net/dplus-gw > DPlus_Hosts.txt 

bash: DPlus_Hosts.txt: Permission denied


I keep getting Permission denied. I am not sure what I am doing wrong. 
Thanks for any help. 
Abbot 




--


John D. Hays
K7VE

PO Box 1223, Edmonds, WA 98020-1223
   

Ian
 

Abbot,

I got round the problem by doing ( see below ). It's a temp solution. Using [ sudo curl http://ar-dns.net/dplus-gw ] printed the file to the screen.

Regards,
Ian..

On 21-02-2017 18:33, Abbot Carder wrote:
I am having issues updating my host files for DExtra.txt file.
Here is what I did:
pi@compass:~ $ cd /usr/share/opendv ; ls -l *.txt
-rw-r--r-- 1 root root 450 May 24 2016 CCS_Hosts.txt
-rw-r--r-- 1 root root 1203 May 24 2016 DCS_Hosts.txt
-rw-r--r-- 1 root root 28493 May 24 2016 DExtra_Hosts.txt
-rw-r--r-- 1 root root 32412 May 24 2016 DPlus_Hosts.txt
pi@compass:/usr/share/opendv $ cd /usr/share/opendv
pi@compass:/usr/share/opendv $ sudo cp DPlus_Hosts.txt
DPlus_Hosts.txt.old ( then ) <----------------- rm DPlus_Hosts.txt
pi@compass:/usr/share/opendv $ sudo curl http://ar-dns.net/dplus-gw >
DPlus_Hosts.txt <------------------ sudo wget http://ar-dns.net/dplus-gw
<----------------- sudo mv dplus-gw DPlus_Hosts.txt
bash: DPlus_Hosts.txt: Permission denied
I keep getting Permission denied. I am not sure what I am doing wrong.
Thanks for any help.
Abbot
Links:
------
[1] https://nw-digital-radio.groups.io/g/udrc/message/1325
[2] https://groups.io/mt/4408298?uid=162806
[3] https://nw-digital-radio.groups.io/g/udrc/post
[4] https://nw-digital-radio.groups.io/g/udrc/editsub?uid=162806
[5] https://nw-digital-radio.groups.io/g/udrc
[6] https://groups.io/static/tos
[7] https://nw-digital-radio.groups.io/g/udrc/leave/defanged

Ian
 

This works:-

root@compassmega:/usr/share/opendv# wget http://ar-dns.net/dplus-gw && cp dplus-gw test.txt
--2017-02-21 21:46:16-- http://ar-dns.net/dplus-gw
Resolving ar-dns.net (ar-dns.net)... 192.231.186.2, 2001:470:b:40f::2
Connecting to ar-dns.net (ar-dns.net)|192.231.186.2|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: ‘dplus-gw’

dplus-gw [ <=> ] 72.31K 121KB/s in 0.6s

2017-02-21 21:46:17 (121 KB/s) - ‘dplus-gw’ saved [74043]

root@compassmega:/usr/share/opendv# ls -l dplus-gw
-rw-r--r-- 1 root root 74043 Feb 21 21:46 dplus-gw
root@compassmega:/usr/share/opendv# ls -l test.txt
-rw-r--r-- 1 root root 74043 Feb 21 21:46 test.txt


Regards,

Ian..

 

I think the problem is that while sudo curl is running privileged once the redirect ">" is encountered it is no longer privileged.  In this case wget is probably better.

sudo wget -O DPlus_Hosts.txt http://ar-dns.net/dplus-gw

Since wget is opening the file, it is running under the 'sudo' privileges.  

On Tue, Feb 21, 2017 at 1:47 PM, Ian <gm4upx@...> wrote:
This works:-

root@compassmega:/usr/share/opendv# wget http://ar-dns.net/dplus-gw && cp dplus-gw test.txt
--2017-02-21 21:46:16--  http://ar-dns.net/dplus-gw
Resolving ar-dns.net (ar-dns.net)... 192.231.186.2, 2001:470:b:40f::2
Connecting to ar-dns.net (ar-dns.net)|192.231.186.2|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: ‘dplus-gw’

dplus-gw                          [   <=>                                           ]  72.31K   121KB/s   in 0.6s

2017-02-21 21:46:17 (121 KB/s) - ‘dplus-gw’ saved [74043]

root@compassmega:/usr/share/opendv# ls -l dplus-gw
-rw-r--r-- 1 root root 74043 Feb 21 21:46 dplus-gw
root@compassmega:/usr/share/opendv# ls -l test.txt
-rw-r--r-- 1 root root 74043 Feb 21 21:46 test.txt


Regards,

Ian..






--


John D. Hays
K7VE

PO Box 1223, Edmonds, WA 98020-1223
   

Richard - VE7CVS
 

sudo curl -o DPlus_Hosts.txt http://ar-dns.net/dplus-gw

should also work. John is correct, the redirect is not part of the privileged command. Another workaround is:

sudo bash -s "curl http://ar-dns.net/dplus-gw > DPlus_Hosts.txt"

which puts the entire command into a subshell, including the redirect. Be careful with the form though, as quoting can be tricky for some commands.

- Richard, VE7CVS

I think the problem is that while sudo curl is running privileged once the redirect ">" is encountered it is no longer privileged.  In this case wget is probably better.

sudo wget -O DPlus_Hosts.txt http://ar-dns.net/dplus-gw

Since wget is opening the file, it is running under the 'sudo' privileges.  

W7FAQ
 

You can solve this by using the output option with curl. Example:
sudo curl http://ar-dns.net/dplus-gw -o /usr/share/opendv/DPlus_Hosts.txt


On Feb 21, 2017 1:53 PM, "John D Hays - K7VE" <john@...> wrote:
I think the problem is that while sudo curl is running privileged once the redirect ">" is encountered it is no longer privileged.  In this case wget is probably better.

sudo wget -O DPlus_Hosts.txt http://ar-dns.net/dplus-gw

Since wget is opening the file, it is running under the 'sudo' privileges.  

On Tue, Feb 21, 2017 at 1:47 PM, Ian <gm4upx@...> wrote:
This works:-

root@compassmega:/usr/share/opendv# wget http://ar-dns.net/dplus-gw && cp dplus-gw test.txt
--2017-02-21 21:46:16--  http://ar-dns.net/dplus-gw
Resolving ar-dns.net (ar-dns.net)... 192.231.186.2, 2001:470:b:40f::2
Connecting to ar-dns.net (ar-dns.net)|192.231.186.2|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: ‘dplus-gw’

dplus-gw                          [   <=>                                           ]  72.31K   121KB/s   in 0.6s

2017-02-21 21:46:17 (121 KB/s) - ‘dplus-gw’ saved [74043]

root@compassmega:/usr/share/opendv# ls -l dplus-gw
-rw-r--r-- 1 root root 74043 Feb 21 21:46 dplus-gw
root@compassmega:/usr/share/opendv# ls -l test.txt
-rw-r--r-- 1 root root 74043 Feb 21 21:46 test.txt


Regards,

Ian..






--


John D. Hays
K7VE

PO Box 1223, Edmonds, WA 98020-1223
   

Abbot Carder
 

Thanks to you all! John's first fix worked great. But appreciate all the input.

Abbot

On Tue, Feb 21, 2017 at 19:36 W7FAQ <hamw7faq@...> wrote:
You can solve this by using the output option with curl. Example:
sudo curl http://ar-dns.net/dplus-gw -o /usr/share/opendv/DPlus_Hosts.txt


On Feb 21, 2017 1:53 PM, "John D Hays - K7VE" <john@...> wrote:
I think the problem is that while sudo curl is running privileged once the redirect ">" is encountered it is no longer privileged.  In this case wget is probably better.

sudo wget -O DPlus_Hosts.txt http://ar-dns.net/dplus-gw

Since wget is opening the file, it is running under the 'sudo' privileges.  

On Tue, Feb 21, 2017 at 1:47 PM, Ian <gm4upx@...> wrote:
This works:-

root@compassmega:/usr/share/opendv# wget http://ar-dns.net/dplus-gw && cp dplus-gw test.txt
--2017-02-21 21:46:16--  http://ar-dns.net/dplus-gw
Resolving ar-dns.net (ar-dns.net)... 192.231.186.2, 2001:470:b:40f::2
Connecting to ar-dns.net (ar-dns.net)|192.231.186.2|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: ‘dplus-gw’

dplus-gw                          [   <=>                                           ]  72.31K   121KB/s   in 0.6s

2017-02-21 21:46:17 (121 KB/s) - ‘dplus-gw’ saved [74043]

root@compassmega:/usr/share/opendv# ls -l dplus-gw
-rw-r--r-- 1 root root 74043 Feb 21 21:46 dplus-gw
root@compassmega:/usr/share/opendv# ls -l test.txt
-rw-r--r-- 1 root root 74043 Feb 21 21:46 test.txt


Regards,

Ian..






--


John D. Hays
K7VE

PO Box 1223, Edmonds, WA 98020-1223
   

--
73 de KE8BTS Abbot Carder