FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
170 views 1 comments
by anonymous

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 anonymous
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 anonymous

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