Hướng dẫn đăng nhập ssh :)

Hướng dẫn đăng nhập ssh: 
lionel@success:~$ ssh tech@tech.shopdunk.vn
Pass: 123456
Pass: Shopdunk@#2011tam
lionel@lioinel:~/.ssh$ ssh tech@tech.shopdunk.vn
sudo nano /etc/hosts
-------
1. Tạo ssh:
Bước 1: lionel@success:~$ ssh-keygen -t rsa -C "tuongpn@shopdunk.vn"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/lionel/.ssh/id_rsa): tuongpn
/home/lionel/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase): 123456
Enter same passphrase again: 123456
Your identification has been saved in /home/lionel/.ssh/tuongpn.
Your public key has been saved in /home/lionel/.ssh/tuongpn.pub.
The key fingerprint is: SHA256:VYNS7x/FGfiMsilkYDgenUJj6Yud66tMUXo9IZUgZRI tuongpn@shopdunk.vn
The key's randomart image is:
+---[RSA 2048]----+
|   E+B=.o...o .. |
|    =*o*. .o o .o|
|    oo=.... . +.o|
|    ooo .+ o . + |
|   oo.ooS   = .  |
|   .o+  .. o . . |
|   .  .   .   .  |
|  o  .           |
|   ooo.          |
+----[SHA256]-----+
Bước 2: 
Upload key vào thư mục .ssh của server
lionel@success:~$ ssh-copy-id -i ~/.ssh/tuongpn tech@192.168.1.53
Bước 3:
Để thoát khỏi server tech@192.168.1.53 dùng lệnh exit
2. Xóa ssh: sudo rm id_rsa.pub 
lionel@success:~$ cd .ssh/
lionel@success:~/.ssh$ ls
id_rsa  id_rsa.pub  known_hosts
lionel@success:~/.ssh$ sudo nano id_rsa.pub
Nội dung file id_rsa.pub là:
sh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDlMKQJ6d9CTFNej0ynwZ9YcV/VpxYBbkdAncqyUJ5nJgw0WuG4EVYfFxKfYZ1WzNImLB+fv8tQkYnOiaNecQYHPCcpl2FogOlvHBW/zQVJajdVYpzmBwSUl99EHoGP3+XiUL1d5dxHuLjmVvjwuVFP+pIobKnweRHLPK5fpWCB3p2mZP+Q2keaD8WATtowhoD6RjVvI$
3. Xóa ssh: ở bên máy tech@192.168.1.53
tech@tech:~/.ssh$ nano authorized_keys
Vào file này nó có nội dung cần xóa :))

Last updated