Uploaded by Dr. Prakash Gopalakrishnan

SSH Commands

advertisement
student@desktop:~$ ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (/home/student/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/student/.ssh/id_rsa
Your public key has been saved in /home/student/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:VEAXNaN16dbupEDWlTFpojyDkblJKttGAHQb0SCSLRw student@deskto
p
The key's randomart image is:
+---[RSA 4096]----+
|.E=+.=+.o.*o= .++|
| +..o.o. B o =.+o|
| . .. + B .ooo |
|
. + + =o + .|
|
= S oo. . |
|
. o . o|
|
.
.+|
|
. .|
|
|
+----[SHA256]-----+
student@desktop:~$ pwd
/home/student
student@desktop:~$ cd .ssh
student@desktop:~/.ssh$ ls
authorized_keys id_rsa id_rsa.pub
student@desktop:~/.ssh$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQD0VSBui8Ui7qDExFZ/pu+UuICZW
aiebAt9WWdZR9qtckp2etxm+s3qxkK4xWbpnBbGgzxEeshhWjiN8to8z2LopGzY5s
gyn8elLvXBb08w4Tk0jRxVrm2hcT7cdkRG6ggTDMiIPlNVGuFgmd2FDZypdOef3kj
fkzGKxZqNFYXoHWSMCuxRO6HyzegqQ39cy06Q7ByDwIj9i9jG7pn3DaOrazAvUZnB
6f39HENEwzu/JXDgjQSzeWwwJHrO5bUCXeDLnXaNXuq6GSAmD1x8I+ykgdVquExee
cOlMq0N1MX7ODX4nDgjmb5hh6RPziFlysRp6MUZaqDShYtaoZycXc4zwcKGytLbBp
cwqGBhDaQl1nrKCplcGEMz63FZYdbcWhwIDEOTlWkjjfDsOEkYAJ2Q4hf6OhxXFyW
aRHTb0KCwhrPCJOqSXxBC0RY+1V4VIMHzYdlVYU8E/vV3Ks4r8yGv/DbVn7mirf6g
eg06VFhVP3TQ3X5NNKmWKYEhSPtaPap+8CS2HFdqizdBjP3wNmC83G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Sjo9PCQW9YoAp5AcGsY9/iA
hCZN4
aH0T6EfcVUFZ7YBc/lgPTsFFAKqilDUZbniuynGKSPkTGJwzjt3B2vWmVZHoaik/I
NeGl+
Nor3YZe29mIZgUSzHM2i6LY8H7bDDruoWR1ncQEgW2Ct2UoGAmg7tC/vgFkmyHoaG
mLYH7
yQDk9rvotiVLpgk534kbl5NpKlRwEQE8UfU/dS+lqgMyFsfJx1LQP/Q8tIAHSb4KH
05tx+
Eqf2lJJ0PSc3VHeUQnhWa7F29K/G8kFDmM1d337TKVMQhCo5dbua0X7+aUM2x9Yb9
Eg1Np
eGk10fM6PQbckdtt5ajp+DkN8tgDamOJC7380Wy31KlY/1+2JXVFj7u2CsoQ0vEyQ
/bH/O
gT1UNP5hrNSj6TxlOyNqAxg+M=
-----END OPENSSH PRIVATE KEY----student@desktop:~/.ssh$ ls
authorized_keys id_rsa id_rsa.pub
student@desktop:~/.ssh$ man ssh-keygen
student@desktop:~/.ssh$ ls
authorized_keys id_rsa id_rsa.pub
student@desktop:~/.ssh$ cat authorized_keys
student@desktop:~/.ssh$ ssh student@server
Warning: Permanently added 'server,192.168.6.2' (ECDSA) to the li
st of known hosts.
student@server's password:
To run a command as administrator (user "root"), use "sudo <comma
nd>".
See "man sudo_root" for details.
student@server:~$ ls
student@server:~$ pwd
/home/student
student@server:~$ cd .ssh
student@server:~/.ssh$ ls
authorized_keys
student@server:~/.ssh$ cat authorized_keys
student@server:~/.ssh$ ls
authorized_keys
student@server:~/.ssh$ exit
logout
Connection to server closed.
student@desktop:~/.ssh$ ls
authorized_keys id_rsa id_rsa.pub known_hosts
student@desktop:~/.ssh$ cat known_hosts
|1|qda6s2mQwmLTtY/zhSkfHkcm+bU=|A1N2SZfSNONd8UWUcBqOD0KMA0U= ecds
a-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAA
ABBBF0ton8t2lzGPVWkBRDq9Mf+E5pzw80s5gWo2yCEVnuPlj2z3G52U1aeR/Ih4Y
fUP6al6oCAnNyFhL0+itS9O28=
|1|hh4rDYAk4syWI1Xl85kaEwmkM4M=|ruypg7uA4SRHyoV+w3A1FepdFM8= ecds
a-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAA
ABBBF0ton8t2lzGPVWkBRDq9Mf+E5pzw80s5gWo2yCEVnuPlj2z3G52U1aeR/Ih4Y
fUP6al6oCAnNyFhL0+itS9O28=
student@desktop:~/.ssh$ ls
authorized_keys id_rsa id_rsa.pub known_hosts
student@desktop:~/.ssh$ cd ..
student@desktop:~$ ls
Desktop Documents Downloads Pictures Videos
student@desktop:~$ ssh-copy-id -i ~/.ssh/id_rsa student@server
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/h
ome/student/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key
(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if
you are prompted now it is to install the new keys
student@server's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'student@server'"
and check to make sure that only the key(s) you wanted were added
.
student@desktop:~$ ssh student@server
Enter passphrase for key '/home/student/.ssh/id_rsa':
student@server's password:
Last login: Mon Jan 10 04:31:28 2022 from 192.168.6.1
To run a command as administrator (user "root"), use "sudo <comma
nd>".
See "man sudo_root" for details.
student@server:~$ cd .ssh
student@server:~/.ssh$ ls
authorized_keys
student@server:~/.ssh$ cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQD0VSBui8Ui7qDExFZ/pu+UuICZW
aiebAt9WWdZR9qtckp2etxm+s3qxkK4xWbpnBbGgzxEeshhWjiN8to8z2LopGzY5s
gyn8elLvXBb08w4Tk0jRxVrm2hcT7cdkRG6ggTDMiIPlNVGuFgmd2FDZypdOef3kj
fkzGKxZqNFYXoHWSMCuxRO6HyzegqQ39cy06Q7ByDwIj9i9jG7pn3DaOrazAvUZnB
6f39HENEwzu/JXDgjQSzeWwwJHrO5bUCXeDLnXaNXuq6GSAmD1x8I+ykgdVquExee
cOlMq0N1MX7ODX4nDgjmb5hh6RPziFlysRp6MUZaqDShYtaoZycXc4zwcKGytLbBp
cwqGBhDaQl1nrKCplcGEMz63FZYdbcWhwIDEOTlWkjjfDsOEkYAJ2Q4hf6OhxXFyW
aRHTb0KCwhrPCJOqSXxBC0RY+1V4VIMHzYdlVYU8E/vV3Ks4r8yGv/DbVn7mirf6g
eg06VFhVP3TQ3X5NNKmWKYEhSPtaPap+8CS2HFdqizdBjP3wNmC83GIobIm7KlS9c
a+svMNANfuoGIAAjwteJ4koLfOLVK4RLO5BzQXHGEJpL5rmk0TA4vwkdLnM7v9eRf
QxZht6x+gjdmB7CPzIMiUF44/+jBguh5hhfX8tdcduTc+qX2dTHUWf3UTkESLMoi3
Ln58sxQ== student@desktop
student@server:~/.ssh$ exit
logout
Connection to server closed.
student@desktop:~$ cd .ssh
student@desktop:~/.ssh$ ls
authorized_keys id_rsa id_rsa.pub known_hosts
student@desktop:~/.ssh$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQD0VSBui8Ui7qDExFZ/pu+UuICZW
aiebAt9WWdZR9qtckp2etxm+s3qxkK4xWbpnBbGgzxEeshhWjiN8to8z2LopGzY5s
gyn8elLvXBb08w4Tk0jRxVrm2hcT7cdkRG6ggTDMiIPlNVGuFgmd2FDZypdOef3kj
fkzGKxZqNFYXoHWSMCuxRO6HyzegqQ39cy06Q7ByDwIj9i9jG7pn3DaOrazAvUZnB
6f39HENEwzu/JXDgjQSzeWwwJHrO5bUCXeDLnXaNXuq6GSAmD1x8I+ykgdVquExee
cOlMq0N1MX7ODX4nDgjmb5hh6RPziFlysRp6MUZaqDShYtaoZycXc4zwcKGytLbBp
cwqGBhDaQl1nrKCplcGEMz63FZYdbcWhwIDEOTlWkjjfDsOEkYAJ2Q4hf6OhxXFyW
aRHTb0KCwhrPCJOqSXxBC0RY+1V4VIMHzYdlVYU8E/vV3Ks4r8yGv/DbVn7mirf6g
eg06VFhVP3TQ3X5NNKmWKYEhSPtaPap+8CS2HFdqizdBjP3wNmC83GIobIm7KlS9c
a+svMNANfuoGIAAjwteJ4koLfOLVK4RLO5BzQXHGEJpL5rmk0TA4vwkdLnM7v9eRf
QxZht6x+gjdmB7CPzIMiUF44/+jBguh5hhfX8tdcduTc+qX2dTHUWf3UTkESLMoi3
Ln58sxQ== student@desktop
Download