When I tried to login with user01, am getting below error message, despite having correct password.
--
[user01@SRV1 ~]$ su - user01
Password:
su: incorrect password
--
I want to give password option in Single command.
please advice how to achieve the same
LinuxLinux DistributionsLinux OS DevUnix OS
Last Comment
Kevin Pham
8/22/2022 - Mon
Sudeep Sharma
In your question it seems that you are already logged in with user "user01"
[user01@SRV1 ~]$ su - user01
Log off and try to su - user01 again and check.
Sudeep
David Sankovsky
As far as I know there isn't a way to do so. Also it's very insecure!!!!
The password should be typed, to make sure that only the person who should have the required access. gets it.
Also, Don't open a new ticket on every question you have... I've 3 questions that you've opened today that relate to the same thing.
Please choose a solution for the question you left open and close them.
mac_g
ASKER
thanks David.As it is urgent no option but to raise the new question.
You cannot specify a plaint-text password and expect it to work. The password as you specify (if you view /etc/shadow) will be recorded exactly as it was typed.
You can do something like this as one line
useradd -p $(openssl passwd -1 <password>) <username>
[user01@SRV1 ~]$ su - user01
Log off and try to su - user01 again and check.
Sudeep