
The short answer: instead of always typing ssh -p 2222 -i ~/.ssh/key user@203.0.113.10, you can give the server a name in a file and type just ssh my-vps. The same name works for scp, which copies files between your computer and the server.
The config file
|
|
|
|
The ServerAliveInterval 60 sends a signal every minute, so an idle connection is not cut for inactivity. If your connection drops often, see also Keeping a command running after you close SSH.
Copying with scp
| To | Command |
| Send a file to the server | scp site.zip my-vps:/home/username/ |
| Bring a file from the server | scp my-vps:/var/log/app.log . |
| Copy a whole folder | scp -r folder my-vps:/home/username/ |
| Use a different port, without the config | scp -P 2222 file username@203.0.113.10:/path/ |
| The port letter changes: ssh uses a lowercase -p, and scp uses an uppercase -P. It is the most common mistake. With the config file, you need neither. |
| For big copies, which may be interrupted, or to synchronise a folder, rsync resumes where it stopped and sends only what changed: see Copying files to another server with rsync. If you lost access, see I have lost SSH access to my server. |
|
Cannot connect to the server however many shortcuts you make? Open a ticket with the SSH error message. Open a support ticket |
|
SEE ALSO How to create an SSH key and log in to your VPS without a password How to change the SSH port without locking yourself out |
RECOMMENDED PRODUCT VPS server with root access Resources of your own, the OS you choose, reinstall whenever you like. from $8.40/mo (3-year plan, with coupon) See plans |
- 0 Users Found This Useful











