Search Our Database

Changing Password in Linux Server by SSH

Last updated on |

Introduction

This KB article guides you through the process of changing a user’s password on a Linux server using Secure Shell (SSH). SSH provides a secure channel over an unsecured network in a client-server architecture, enabling users to log into another computer over a network, execute commands in a remote machine, and move files from one machine to another. Changing passwords regularly is a vital security practice to protect your server from unauthorized access.

Prerequisites

  1. SSH Client: Ensure you have an SSH client installed on your system. Linux and macOS typically have SSH installed by default. Windows users can use PuTTY or Windows Subsystem for Linux (WSL).
  2. Server Access: You need the IP address or hostname of the Linux server you wish to access.
  3. User Credentials: You must have the username and current password of the account for which the password is to be changed. If you’re a system administrator intending to change another user’s password, you might need root access or the appropriate sudo privileges.

1. SSH into your server.

2. If you want to change the current SSH user’s password, use the command below:

sudo passwd

3. Enter your new password and press Enter.

[almalinux@server01 ~]$ passwd
Changing password for user almalinux.
Current password:

4. After that, you need to re-enter the new password:

[almalinux@server01 ~]$ sudo passwd
Changing password for user root.
New password:
Retype new password:

5. If you want to change the password for other users, you need to use the command below:

sudo passwd <username>

Conclusion

Changing your password regularly on your Linux server is a critical security measure to prevent unauthorized access. By following the steps outlined above, you can easily update your password via SSH, ensuring your server remains secure. Remember, the new password should be strong and unique, combining letters, numbers, and special characters to increase security.

For additional assistance or if you encounter any issues, please contact our support team at support@ipserverone.com.