I usually connect to remote machines and giving ssh key location, hostname, and username etc.. every time is painful, isn't there a simple way to configure it?
Yes, there is.
1. Create a .ssh directory under home directory if it does not exist.
4. To connect to remote machine.
5. To copy a file from demo server to your machine
Yes, there is.
1. Create a .ssh directory under home directory if it does not exist.
$ mkdir -p ~/.ssh
2. Open a file named config (create it if it does not exist)
$ vi ~/.ssh/config
3. Configure hosts in this file. Copy the following code and replace the values accordingly.
#Demo server configuration
Host demo
HostName 12.14.134.123
User john
IdentityFile ~/.ssh/ssh_key
#Test server configuration
Host test
HostName 12.14.134.124
User john
IdentityFile ~/.ssh/ssh_key
4. To connect to remote machine.
$ ssh demo
5. To copy a file from demo server to your machine
$ scp demo:~/file1.txt ~/Downlods/
No comments:
Post a Comment