As part of an attempt to implement a security measure in my root ssh session, I am trying to develop a method to run the script after n seconds of root login, as well as change the user password and log out automatically.
I am trying to change the password silently. I have the following code:
echo -e "new\nnew" | passwd -q
This, instead of changing the password silently, as mentioned in the man pages, displays this:
~/php-pastebin-v3 #echo -e "new\nnew" | passwd -q Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
which does not help.
I tried to connect stdout and stderr, however, I think I misunderstood the pipeline.
~/php-pastebin-v3 #echo -e "new\nnew" | passwd -q > /dev/null Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully ~/php-pastebin-v3 #echo -e "new\nnew" | passwd -q /dev/null 2>&1 passwd: user '/dev/null' does not exist
What is the correct way to change the password through a script, calmly?
source share