ssh

Học cấu hình từ xa ssh

<h2>Hướng dẫn đăng nhập ssh</h2>
lionel@success:~$ ssh tech@tech.shopdunk.vn
lionel@lioinel:~/.ssh$ ssh tech@tech.shopdunk.vn
$sudo nano /etc/hosts
<h2>1. Tạo ssh</h2>
<p>Bước 1:</p> 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]-----+
<p>Bước 2:</p>
Upload key vào thư mục .ssh của server
lionel@success:~$ ssh-copy-id -i ~/.ssh/tuongpn tech@192.168.1.53
<p>Bước 3:</p>
Để thoát khỏi server tech@192.168.1.53 dùng lệnh exit
<h2>2. Xóa ssh: sudo rm id_rsa.pub</h2>
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$
<h2>3. Xóa ssh: ở bên máy tech@192.168.1.53</h2>
tech@tech:~/.ssh$ nano authorized_keys
Vào file này nó có nội dung cần xóa :))

Last updated