FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

13366 questions

15892 answers

25715 comments

50437 members

0 votes
64 views 1 comments
by

Hello 

I have created a user via CLI and I want to change the password but it is possible to do it with the passwd command inside the account.

I can change it without problem from the root account but I have not felt that a user has to ask the root owner to change the password.

Could someone tell me how to change the password of the same user without using root?

Thanks and best regards

PSI@Teltonika-TRB245:~$ passwd

Changing password for PSI

New password:

Retype password:

passwd: setuid: Operation not permitted

PSI@Teltonika-TRB245:~$

1 Answer

+2 votes
by
Hello,

Short answer: you can't.

Longer answer: /bin/passwd is a symlink to /bin/busybox for such an operation to work you'll need to have busybox setuid of root wich would defeat any useful purpose of having a separate user with different permissions.

You can trick the system with the following commands: rm /bin/passwd; cp /bin/busybox /bin/passwd; chmod 4755 /bin/passwd

This will make a separate copy of busybox with the setuid bit set only for the passwd command.

Regards,
Best answer
by

Thank you so much

The explanation was clear and the trick excellent.

I appreciate and admire your knowledge and your kindness in sharing it.

smiley