Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 3234  / 2 Years ago, mon, february 14, 2022, 3:19:27

I figured out how to change my mac address of my network card:



sudo ip addr                                    # Show details
sudo ifconfig eth0 down # deactivate network card
sudo ifconfig eth0 hw ether DESIRED_MAC_ADDRESS # change mac address
sudo ifconfig eth0 up # activate network card
sudo ip addr # show details again


What would be the best way to make this a script which I could start each time I need this modification? Also where do I have to put this generated script? What is the standard folder for this?



I don't want it to be started every time Ubuntu starts. (But it would be nice to know how this is done, though. Where would be the best place to store it in that case?)



Appreciate any suggestions!


More From » scripts

 Answers
7

Not really sure what you mean by 'the best way'. The regular, easy and practical way would be to copy/paste the commands into a text file named, for example, best_way, save it anywhere you want, for example, the home folder, and, ... believe it or not, that's it.



To run it, cd to the folder with the file, then sudo bash ./best_way.



PS: Since you'll be using sudo to run the script, there is no need to precede each command with sudo.


[#41299] Monday, February 14, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hamostic

Total Points: 403
Total Questions: 142
Total Answers: 112

Location: Iceland
Member since Sat, Sep 17, 2022
2 Years ago
;