Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
bashスクリプトでユーザーパスワードが正しいことを確認することはできますか? もしそうなら、その方法を教えてください。ありがとうございました
これは私のために働く:
#ensure sudo isn't saving a recent password sudo -k #prime it echo $ROOTPASSWORD | sudo -S echo hello &> /dev/null #test it if ! [ "$(sudo -n echo hello 2>&1)" == "hello" ]; then echo "Incorrect password was entered" fi