How to add and remove external user on the server?

In some cases there might be a need to add a new SSH user, or remove a user, from the server. Our environment is built to have one SSH user per a web site, but the user may have several SSH keys. With the SSH key, access to the server is possible without knowing the original SSH password.

Adding SSH key to server

SSH key is the most recommended method to access the server in eg. these cases:

  • Website owner or developer wants to access the server, eg. to use terminal or transfer files (scp) without using password
  • Developer (eg. from outside own organization) needs to access the server, but the site owner doesn't want to provide the credentials (this is the most recommended way).

If you don't have the SSH key yet, it can be generated by following our instructions.

Copy the public key to the server (using your own server and port details):

$ ssh-copy-id -p 12345

The public key can also be added by copying it to /home/user/.ssh/authorized_keys file. The file can be edited eg. with editor nano (add the public key to a separate row):

$ nano /home/username/.ssh/authorized_keys 

Again, you can also remove the key and prevent user's access to the server by just deleting the key row from the file.

Changing SSH password

If the SSH password needs to be changed, it can be reset using a command:  

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us