1

I have the following command that correctly creates the /etc/hosts file that I want to build. However, I cannot write it per the 2nd form due to permissions, of course. So I tried variations of the 3rd form, but it still errors on permissions. Can someone give me a suggestion to try?

cat hosts.tmp ; echo -n "myremotehost " ; cat ip.txt

cat hosts.tmp ; echo -n "myremotehost " ; cat ip.txt > /etc/hosts

cat hosts.tmp ; echo -n "myremotehost " ; echo mypassword | sudo -S cat ip.txt > /etc/hosts
EdgeCase
  • 476

1 Answers1

0

This was hard for me to find out! (Relative newbie to Linux.)

In terminal, type sudo -i, then log in with your user password. You will be in the root directory, with God-like powers... :>)

I also found bash filename.sh will start the script. Forgive me, I feel a great sense of accomplishment having written a script (per suggestions in another post) which killed all ads in Youtube!

hg8
  • 13,582
B. Fife
  • 49