How to change sftp password from root

July 9, 2021 . 2 MIN READ

Changing the password for Linux or Unix over ssh

The procedure to change the user password on Linux or Unix over ssh:

  1. Open the Terminal application
  2. Type the following command to change password for vivek user using ssh:
    ssh -t vivek@IP-here passwd
  3. Type the following command to change password for root user using ssh:
    ssh -t root@server-IP-here passwd
  4. Type your current password when prompted. You must type new password twice

Let us see syntax and example in details.

Syntax

The syntax is:

ssh -t user@server-name-here passwd

ssh -t userName@server.ip.address.here passwd

ssh -t userName@192.168.1.20 passwd

ssh -t userName@192.168.1.20 /bin/passwd

Where,

  • -t: This option force pseudo-tty allocation. This can be used to execute arbitraryscreen-based programs (such as passwd) on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.

Examples

In this example, change password for user called nixcraft on server1.cyberciti.biz by issuing the passwd command over ssh:

ssh -t nixcraft@server1.cyberciti.biz passwd

ssh -t vivek@nas01 passwd

Sample outputs:

Warning: If you skip the -t option, either you will see password in a plain text on screen or you will get an error that read as follows:
passwd: pam_chauthtok(): conversation failure

In this example, change password for user called vivek on nas01 by issuing the passwd command without the -t over ssh:

ssh nixcraft@server1.cyberciti.biz passwd

ssh vivek@nas01 passwd

Sample outputs:

Animated gif 02: Change password using the passwd command without -t option over ssh. Note the password is shown in clear text.

https://www.cyberciti.biz/faq/linuxunix-change-password-using-passwd-command/

Leave a Reply

Your email address will not be published. Required fields are marked *