SSH Flashcards

1
Q

What is the command to install ssh?

A

apt-get install openssh-server

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the command to check if the status of the ssh service?

A

service sshd status

systemctl status sshd.service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the command to start the ssh service?

A

service sshd start

systemctl start sshd.service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the command to stop the sshd service?

A

service sshd stop

systemctl stop sshd.service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the command to ssh into another machine?

A

ssh user@hostname

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the command to generate public/private keys?

A

ssh-keygen

creates: ~/.ssh/id_rsa ~/.ssh/id_rsa.pub

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do ssh keys work?

A

private and public key generated by client
private key stored on client
public key copied to desired users ~/.ssh/authorized_keys
connect to server on client ssh-add ~/.ssh/id_rsa (private)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the syntax to scp a file/directory to a remote machine?

A

scp /path/to/source user@machine:/path/to/destination

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the command to configure sshd to run automatically on boot?

A

systemctl enable sshd.service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the command to configure sshd to not run automatically on boot?

A

systemctl disable sshd.service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

If using an additional unique private and public key pair, what command must you run in order to ssh into the remote machine?

A

ssh-add ~.ssh/id_rsa_second_key

  • adds the clients private key to authenticate with the clients public key stored on the remote machine
  • this is for additional key pairs, this is done transparently the first time a key pair is created
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a command to add the public key of an ssh client to the remote machine?

A

cat ~/.ssh/id_rsa.pub | ssh user@machine “mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat&raquo_space; ~/.ssh/authorized_keys”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the command to add the public key of an ssh client to the remote machine using ssh-copy?

A

ssh-copy-id

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How would you cache the ssh password for a private key during the current session

A

ssh-agent bash

ssh-add

How well did you know this?
1
Not at all
2
3
4
5
Perfectly