-1

I have an Ubuntu Server and I want only a few PCs to be able to connect to my server via SSH (on port 22). Is there a way that I can create an certificate that I would install on the few PCs that are allowed on the server?

2
  • 2
    Do you mean ssh? If so, look up private key authentication. Sep 19, 2019 at 10:32
  • As an extra level of security you could allow only specific IPs to access ssh. For instance: sudo ufw allow from 192.168.1.0/24 to any port 22 to allow a subnet, or sudo ufw allow from xxx.xxx.xxx.xxx to any port 22 to allow a specific IP. You can repeat this for all IPs to allow, and then sudo ufw enable. Keep in mind you would need open any other services you provide in ufw as well: sudo ufw allow http for example. Sep 19, 2019 at 12:22

1 Answer 1

0

You can use ssh key-based authentication.

  1. Generate private and public ssh key on one of PC using,

    ssh-keygen

  2. Configure your ubuntu server's /etc/ssh/sshd_config file

    PubkeyAuthentication yes PasswordAuthentication no

  3. restart sshd service on ubuntu server

    systemctl restart sshd.service

  4. Add genetated public key into ubuntu servers /home/users-home/.ssh/authorized_keys

  5. Place generated private key in /home/users-home/.ssh/ path on each PC.

2
  • the pcs i want to give the permissions to are windows machines. where to i have to put it there?
    – CruZer
    Sep 19, 2019 at 11:38
  • you can use putty tool.. put the private key where you prefer. Sep 19, 2019 at 12:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .