Have a Linux server, when I upload this code to the Linux server via git on the local computer, log on secret hope to achieve free, you need to use SSH keys,
First, you need to check if you already have a key. By default, the user's SSH keys are stored in its ~/.ssh
directory, open git, enter the command:
$ cd ~/.ssh $ ls id_dsa
id_dsa.pub
known_hosts
Where id_dsa
is the private key id_dsa
.pub
is your public key, if you can not find such a file (or no .ssh
directory), you can run ssh-keygen
to create their program:
$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/schacon/.ssh/id_rsa): Created directory '/home/schacon/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/schacon/.ssh/id_rsa. Your public key has been saved in /home/schacon/.ssh/id_rsa.pub. The key fingerprint is: d0: 82: 24: 8e: d7: f1: bb: 9b: 33: 53: 96: 93: 49: da: 9b: e3 [email protected]
First ssh-keygen
will confirm the storage location of the key (by default .ssh/id_rsa
), then it will ask you to enter the password key twice. If you do not want to enter a password when using a key, you can leave it blank.
View public key details:
$ cat ~/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3 Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA t3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/En mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx NrRFi9wrf+M7Q== [email protected]
Then is free dense remote login configuration, describes two common methods:
method one:
By ssh-copy-id command set, the final argument is that we should avoid the key registration server ip address.
ssh-copy-id -i ~/.ssh/id_rsa.pub 192.168.1.1
Method Two:
, Copy the contents of the local id_rsa.pub file manually copying files to a remote server /.ssh/authorized_keys also entirely possible
$ cd .ssh $ ls authorized_keys id_rsa id_rsa.pub known_hosts $ vi authorized_keys
This, SSH keyless login and you're done.