If old employees are still able to access the Linux server, it could be due to a number of reasons. Here are some steps you can take to prevent old employees from accessing the server:
Remove their account:
Remove the old employee's account from the server. This will prevent them from logging in using their username and password.
To remove an account, use the userdel
command. For example:
sudo userdel username
Revoke their SSH keys:
If the old employee has access to the server using SSH keys, you can revoke their keys by deleting their authorized keys file.
The authorized keys file is usually located in the ~/.ssh
directory of the user's home directory. To delete the file, run the following command:
rm ~/.ssh/authorized_keys
Alternatively, you can edit the file and remove the old employee's keys manually.
Change the root password:
If the old employee has access to the server using the root account, you should change the root password to prevent them from logging in.
To change the root password, use the passwd
command. For example:
sudo passwd root
Restrict access to the server:
You can also restrict access to the server by configuring the firewall or by using SSH keys for authentication.
To configure the firewall, you can use a tool such as iptables.
To use SSH keys for authentication, you can set up passwordless login using the ssh-keygen
and ssh-copy-id
commands.