Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using alias instead of IP in scp

Tags:

shell

unix

I have a desktop in the office that I often need to access from home and use scp to copy files. Currently I am doing it like this

scp [email protected]  ...

I want a mechanism that I dont have to type the IP address each time I want to scp something. I was trying to do it by creating an alias, but it doesn't seem to work. Can I give my desktop machine a name so that instead of typing the ip address I can use the name of the machine instead ?

like image 582
comatose Avatar asked Oct 15 '25 03:10

comatose


1 Answers

One way to deal with this is to create an entry in your ssh configuration. This can be done on a system wide basis or, if you don't have root access on this box, just for your user.

The per user configuration file is ~/.ssh/config and uses the following format

host my_desktop
    hostname 11.22.33.44

This method is also nice because you can specify other options like the user name. To find out more about the options available try man ssh_config.

like image 70
dtyler Avatar answered Oct 17 '25 05:10

dtyler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!