0

I use scp to copy files from a remote (Linux) computer to my local machine (Mac OS Mojave). I have "Remote Login" enabled on my Mac. In the "Sharing" section of System Preferences, where I enabled "Remote Login," an address is listed, which, when I'm on UCLA's campus for example, looks like this:

my_name@wifi-xxx-xxx-xx-xxx.host.ucla.edu

This address (numbers x'ed and name removed) allows me to ssh into my Mac from the foreign computer and in particular to use scp to transfer files.

On the foreign machine, I use

scp filename my_name@wifi-xxx-xxx-xx-xxx.host.ucla.edu:~/Downloads

and the file appears in my Mac's Downloads folder.

I would like to automate this process. The remote address seems to change frequently. How do I obtain my computer's address from the command line? Mac OS can clearly generate it, as it lists it in System Preferences.

Thank you!

  • Did you try setting a static IP for your mac for this network? Does it still change your address? – Teshan Shanuka J Sep 20 '19 at 4:19
  • @Teshan how would I set a static IP on a network? – Zach Siegel Sep 20 '19 at 15:43
  • 1
    System Prefs > Network. On Ethernet you can see where it says "Using DHCP", so you change that to DHCP with manual address. On Wifi it's inside the Advanced section, under TCP/IP. Note that fixing the address may lead to conflicts you will be unable to resolve, unless you can persuade the Uni to give you a fixed address from their side. – Tetsujin Sep 21 '19 at 9:12
  • @Tetsujin this answers my question. If you post this as an "answer," I'll accept it! Thank you. – Zach Siegel Dec 10 '19 at 5:28
0

This is more a workaround than a full answer to the question as asked, but after comments…

System Prefs > Network. On Ethernet you can see where it says "Using DHCP", so you change that to DHCP with manual address. On Wifi it's inside the Advanced section, under TCP/IP.

Note that fixing the address may lead to conflicts you will be unable to resolve, unless you can persuade the Uni to give you a fixed address from their side.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.