1

How to suppress su authentication failure warning?

view story
linux-howto

http://unix.stackexchange.com – I created an account "diag" and set it as expired (usermod --expiredate 1). Then I have a script which I want to run to log into it, so in the script I use the following command: su -s /bin/bash - diag This outputs like so: Your account has expired; please contact your system administrator su: Authentication failure (Ignored) diag@computer:~$ And then I'm able to use the account, as expected. I want to suppress the first three lines, the warning about the expired account. I tried adding 2> /dev/null to the end of the command, but that suppresses all the output from bash; I just get a (HowTos)