Sample Header Ad - 728x90

Superuser and Sudo not working on Debian 12

1 vote
2 answers
2858 views
I recently switched from Windows to Linux, more specifically to Debian 12. I'm struggling a bit because there are a lot of new things, like sudo. Anyway, I'm basically trying to put my regular user as sudo, to facilitate development issues and not have to register as a super user for everything. I used the command gpasswd -a user sami and in fact it added the user as sudo, if I use groups sami, my user appears as sudo. However, if I try to use su sami and then enter my password correctly, it simply gives no error and nothing happens. If I enter the wrong password it gives me an authentication error. As expected, if I use apt update, without root, it gives a permission denied error. But the strangest thing is that if I type sudo apt install any_package_here or sudo apt update and enter my password, it normally installs the package or update the packages. Can anyone help me? Example of the Konsole.
sami@sami-debian:~$ su sami
Senha: 
sami@sami-debian:~$ # I entered the correctly pwd
sami@sami-debian:~$ su sami
Senha: 
su: Falha de autenticação
sami@sami-debian:~$ # I entered the wrong pwd and gave me auth failed
sami@sami-debian:~$ apt update
Lendo listas de pacotes... Pronto
E: Não foi possível abrir arquivo de trava /var/lib/apt/lists/lock - open (13: Permissão negada)
E: Impossível criar acesso exclusivo ao directório /var/lib/apt/lists/
W: Problema ao remover o link do ficheiro /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permissão negada)
W: Problema ao remover o link do ficheiro /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permissão negada)
sami@sami-debian:~$ # It's in portuguese, but basically says permission denied for everything
sami@sami-debian:~$ sudo apt install 7zip
Lendo listas de pacotes... Pronto
Construindo árvore de dependências... Pronto
Lendo informação de estado... Pronto        
Os seguintes pacotes foram instalados automaticamente e já não são necessários:
  libdaxctl1 libndctl6 libpmem1 liburing2
Utilize 'sudo apt autoremove' para os remover.
Os NOVOS pacotes a seguir serão instalados:
  7zip
0 pacotes atualizados, 1 pacotes novos instalados, 0 a serem removidos e 0 não atualizados.
É preciso baixar 0 B/976 kB de arquivos.
Depois desta operação, 2.662 kB adicionais de espaço em disco serão usados.
A seleccionar pacote anteriormente não seleccionado 7zip.
(Lendo banco de dados ... 195927 ficheiros e diretórios atualmente instalados.)
A preparar para desempacotar .../7zip_22.01+dfsg-8_amd64.deb ...
A descompactar 7zip (22.01+dfsg-8) ...
Configurando 7zip (22.01+dfsg-8) ...
A processar 'triggers' para man-db (2.11.2-2) ...
sami@sami-debian:~$ # It didn't ask for a password, and I have no idea why, but installed correctly the package
sami@sami-debian:~$ su
Senha:
root@sami-debian:~$ # I entered correctly password for root user and worked as expected
sami@sami-debian:~$ sudo apt update
[sudo] senha para sami: 
Atingido:1 http://deb.debian.org/debian  bookworm InRelease
Atingido:2 http://security.debian.org/debian-security  bookworm-security InRelease                                 
Atingido:3 http://repo.mysql.com/apt/debian  bookworm InRelease                                                    
Atingido:4 http://deb.debian.org/debian  bookworm-updates InRelease                                                
Atingido:5 https://packages.microsoft.com/debian/12/prod  bookworm InRelease
Atingido:6 https://packages.microsoft.com/repos/code  stable InRelease
Lendo listas de pacotes... Pronto
Construindo árvore de dependências... Pronto
Lendo informação de estado... Pronto        
All packages are up to date.
sami@sami-debian:~$ # I entered correctly pwd
I use KDE Plasma I was hoping that if I entered the terminal, I would be able to execute the commands as if I were a superuser, but it doesn't allow it. Without this, I have to log in as root all the time to do any minimal operation, like changing branches on github. I wanted to make the job easier. I just did a git clone and when I tried to change branches, it said that I didn't have permission to change something like index.lock. So should I, every time I work in the terminal, use sudo first? I didn't test using sudo git checkout branch. I should it?
Asked by Sami Daniel (45 rep)
Sep 19, 2024, 10:59 AM
Last activity: Sep 23, 2024, 08:23 AM