Stopping people from ssh(ing) into my Ubuntu machine

I want to be able to stop people from been able to SSH onto my machine but still need to SSH out, is this possible?


i want to be able to stop people from been able to ssh onto my machine but still need to ssh out. is this possible

Yes, just disable the SSH daemon sshd.


You have many options:

  • disable SSH daemon on boot with sudo update-rc.d ssh disable and reboot the machine (or stop the SSH daemon with sudo service ssh stop)

  • disable SSH daemon until machine is rebooted: sudo service ssh stop

  • select the users (or groups) authorized to ssh to your machine:

    sudo nano /etc/ssh/sshd_config

    add lines for each user:

    AllowUsers user

    or

    AllowGroups group

    then restart ssh: sudo service ssh restart to activate the filter


I want to be able to stop people from been able to ssh onto my machine but still need to ssh out

If you do not want anyone (yourself included) to be able to ssh to your host, simply do not run sshd. That has no influence in your ability to ssh from your computer to other computers.

E.g. via sudo update-rc.d -f ssh remove (This will ntt remove the sshd software package, but it won't automatically start again.).

I am curious though: Why not simply do not give them an account?