Password not working for sudo («Authentication failure»)
Before I mention anything further, DO NOT give me a response saying that terminal won’t show password input. I’m AWARE of that. I’m typing my user password in (not a capslock issue), and for some reason it still says ‘Authentication Failure’. Is there some other password (one I’m not aware of) I’m supposed to be using other than my user password? I’ve had this ubuntu before, on another hard drive and I didn’t have this problem. (And it was the same ubuntu, ubuntu 12.04 LTS)
ai@AiNekoYokai:~$ groups ai adm cdrom sudo dip plugdev lpadmin sambashare ai@AiNekoYokai:~$ lsb_release -rd Description: Ubuntu 12.04 LTS Release: 12.04 ai@AiNekoYokai:~$ pkexec cat /etc/sudoers # # This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in /etc/sudoers.d/ instead of # directly modifying this file. # # See the man page for details on how to write a sudoers file. # Defaults env_reset Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL:ALL) ALL # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d
I can log in with my password, but it’s not accepted as valid for authentication
ai@AiNekoYokai:~$ ls /etc/sudoers.d README
pkexec apt-get update pkexec apt-get --purge --reinstall install sudo
pkexec usermod -a -G admin $USER
ai@AiNekoYokai:~$ gksudo xclock
Postgres Password Authentication Failed
I am running a Postgres 12 database on Ubuntu 18.04 on WSL (Windows Subsystem for Linux). I can connect to the database with sudo -u postgres psql without any issues, and can view and create new databases and users. I created a new user with CREATE USER myusername WITH PASSWORD ‘mypassword’; and psql returns CREATE ROLE . However, when I try to log in as this user with the password that I set with psql -h localhost -U myusername , I get psql: error: could not connect to server: FATAL: password authentication failed for user «myusername» . I have tried changing the password on this user multiple times with ALTER USER myusername WITH PASSWORD ‘newpassword’; and psql returns ALTER ROLE . A common solution I have found, such as this post, is to modify the pg_hba.conf file. My pg_hba.conf file is:
local all postgres peer # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all peer # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5 # Allow replication connections from localhost, by a user with the # replication privilege. local replication all peer host replication all 127.0.0.1/32 md5
I have tried modifying both the first and second lines to md5 and ident , and restarted the postgres server each time, to no avail. I have also tried completely uninstalling and reinstalling Postgres, which does not work either. Is there anything I am missing? Anything else that I can do to try and fix this? Thanks!
FATAL: password authentication failed for user «postgres»
getting this error message in ubuntu. in pg_hba.conf file, I tried using ‘ident’,’peer’,’trust’,’md5′ in different times.but no go. please help.
Did you do any searching / research first? Show your config files. Explain what you tried. Show the commands and errors.
4 Answers 4
# IPv4 local connections: # TYPE DATABASE USER CIDR-ADDRESS METHOD host all all 127.0.0.1/32 trust
if it does not work then try with
host all all your_ip/32 trust
then restart your data base it will work fine
If the username and password are correct then md5 is the correct value. Make sure you restart the database process or at least have it reload the configuration after modifying pg_hba.conf .
It might be came from malicious traffic, check if the logs repeated almost each seconds like below
2019-04-17 16:10:39.228 UTC [32] FATAL: password authentication failed for user "postgres" 2019-04-17 16:10:39.228 UTC [32] DETAIL: Connection matched pg_hba.conf line 95: "host all all all md5" 2019-04-17 16:10:41.916 UTC [33] FATAL: password authentication failed for user "postgres" 2019-04-17 16:10:41.916 UTC [33] DETAIL: Connection matched pg_hba.conf line 95: "host all all all md5" . .
Lets verify TCP Traffic on port 5432 using tcpdump command
$ sudo tcpdump port 5432 and '(tcp-syn|tcp-ack)!=0' tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on ens4, link-type EN10MB (Ethernet), capture size 262144 bytes 16:19:26.472838 IP XX-XXX-XXX-XXX-static.xxx.xxxxxx.net.39903 > xxx.xxx.xxx: Flags [S], seq 1779566115, win 29200, options [mss 1380,sackOK,TS val 451453976 ecr 0,nop,wscale 7], length 0 16:19:26.473135 IP xxx.xxx.xxx > XX-XXX-XXX-XXX-static.xxx.xxxxxx.net.39903: Flags [S.], seq 4028889669, ack 1779566116, win 28960, options [mss 1460,sackOK,TS val 2412144 ecr 451453976,nop,wscale 7], length 0 16:19:26.525816 IP XX-XXX-XXX-XXX-static.xxx.xxxxxx.net.39903 > xxx.xxx.xxx: Flags [.], ack 1, win 229, options [nop,nop,TS val 451453989 ecr 2412144], length 0 16:19:26.525875 IP xxx.xxx.xxx > XX-XXX-XXX-XXX-static.xxx.xxxxxx.net: Flags [P.], seq 1:42, ack 1, win 229, options [nop,nop,TS val 451453989 ecr 2412144], length 41 . .
If this is the case then set firewall rules and necessary securities to combat bots or unwanted traffics.
Why am I getting «Authentication failure» when running the «su» command?
I am having problems with the su command. I know my password and I am typing it correctly, but su indicates Authentication failure . So I checked on the internet and then went into recovery mode and changed my user’s password to what I was entering before. Even now, entering the same password on su gives me Authentication failure . What am I doing wrong?
7 Answers 7
su asks for the root password. Since Ubuntu doesn’t set a root password by default, you can’t use it to become root.
Instead, to become root, use sudo -i with your personal password.
I admit I tend to use sudo bash but your incantation makes me want to use su sudo or maybe su su sudo .
Try youtube.com/watch?v=axDObUgsuZQ instead, it will help you to solve the authentication failure error on su root
su asks for the password of the account you’re trying to login. It’s usage (simplified):
When omitting username , the username default to root . Since the root password is disabled by default on Ubuntu, no password will be valid. The preferred way to run root commands is not through a su shell, but with sudo as in:
The root account in Ubuntu is disabled by default. This is to say that it has no password (which is different from it having a blank password) and no attempt to authenticate with root’s password will succeed. Therefore, su or su — will not work.
Instead, use sudo to run a command as root:
sudo command.
If you want a root shell like you get with su , run:
If you want a root shell like you get with su — , run:
when you need to login as one of your non-login userids say git ( has no pwd)
su - git Password: su: Authentication failure
SOLUTION — use this syntax to login as userid git
It’s not a different syntax, but an entirely different program. In addition, sudo itself support logging in as another user, e.g. the equivalent command would be sudo -iu git .
I came across an OS, Minibian, where the setuid bit was missing from /bin/su , causing this error, even if the password of the root account was enabled.
On Linux, the only way to become root is to execute a setuid-root file. When you run sudo or su , their setuid bit is set, so the process’ effective user becomes root, then they do the authentiaction already as root! If it fails they exit.
Anyway, here are the symptoms and the fix:
$ su Password: su: authentication failure $ sudo su # ls -l /bin/su -rwxr-xr-x 1 root root 31092 Jun 5 2012 /bin/su # chmod u+s /bin/su # ls -l /bin/su -rwsr-xr-x 1 root root 31092 Jun 5 2012 /bin/su
Note the difference: rwx before, rws after.