LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   How to bypass the sudo password in *buntu? (https://www.linuxquestions.org/questions/linux-security-4/how-to-bypass-the-sudo-password-in-%2Abuntu-4175684313/)

DARKBOW923 10-27-2020 01:15 PM

How to bypass the sudo password in *buntu?
 
Hello all.

I study in a place where we don't have access to sudo, i yesterday i talked with the sys admin of my college, and he tells me i can bypass (or recover) the user password (or even sudo) via a live CD and reading
Code:

etc/shadow
or even
Code:

/etc/password
.

I tried it but it doesn't work, any idea of how to see the sudo (or user) password?

Just for clear this: i don't want to pass my college pc password, its just for personal use and work.

Thanks in advance!

uteck 10-27-2020 01:56 PM

If you can boot from a live CD, why do you not have access to sudo? Is this a school provided laptop?
If you are the only user of the laptop you should be in the sudo group by default with an Ubuntu install.

You can NOT read the password from /etc/shadow or /ect/password, that would be a huge security issue. But you can reset the passwords by editing these files. But there are less risky ways to do that.

HappyTux 10-27-2020 03:51 PM

Quote:

Originally Posted by DARKBOW923 (Post 6179357)
Hello all.

I study in a place where we don't have access to sudo, i yesterday i talked with the sys admin of my college, and he tells me i can bypass (or recover) the user password (or even sudo) via a live CD and reading
Code:

etc/shadow
or even
Code:

/etc/password
.

I tried it but it doesn't work, any idea of how to see the sudo (or user) password?

Just for clear this: i don't want to pass my college pc password, its just for personal use and work.

Thanks in advance!

You can try with the live CD and editing the sudoers file to give yourself access to everything. It is near the bottom of the file where you set it up. Though you are probably just better off enabling it temporarily then using the password command to set a root user password on the machine.

Code:

root@haswell:/home/seeder1# 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        mail_badpass
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

# Allow members of group sudo to execute any command
%sudo        ALL=(ALL:ALL) ALL    <----- needs to be modified on yours

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d


michaelk 10-27-2020 03:57 PM

Quote:

any idea of how to see the sudo (or user) password?
As already posted there isn't. I don't know of any modern operating system where you can easily read a password. BTW this is something basic any system admin should know...

Quote:

i don't want to pass my college pc password, its just for personal use and work.
I do not understand. With Ubuntu the sudo password is the user's password with admin rights. If this is not the OP's personal computer or a computer where they are supposed to have sudo or su rights then regardless we should not be helping the OP.

sgosnell 10-27-2020 05:26 PM

"A place where we do not have access to sudo" makes no sense to me. Sudo is not in any place other than on a particular computer. I can't tell if the OP is trying to get sudo on his/her laptop, or into the college network, or what. I also don't understand the difference between school and personal access. Apparently the user password for the computer is known, and that would be the sudo password. If sudo is not enabled on the laptop, there are ways to do that, provided the root password is known. Without the root password and without sudo being enabled, I know of no way to get the root password.

HappyTux 10-27-2020 06:22 PM

Quote:

Originally Posted by sgosnell (Post 6179428)
"A place where we do not have access to sudo" makes no sense to me. Sudo is not in any place other than on a particular computer. I can't tell if the OP is trying to get sudo on his/her laptop, or into the college network, or what. I also don't understand the difference between school and personal access. Apparently the user password for the computer is known, and that would be the sudo password. If sudo is not enabled on the laptop, there are ways to do that, provided the root password is known. Without the root password and without sudo being enabled, I know of no way to get the root password.

No need to, the same live CD/DVD method can be used to replace or delete the password in its file. All that is needed is physical access to the machine to boot from it. Possibly another time waster asking useless questions is at hand here, who knows it does seem strange to be asking, for the obvious it should already be setup to do this upon install that would have happened.

dugan 10-27-2020 09:21 PM

This has been said several ways but:

Most systems are designed so that it's technically impossible to recover plaintext passwords. Linux is one of them, and it's by design that /etc/passwd and /etc/shadow don't contain passwords.

The sudo password is the user password.

Whether said password actually gets you sudo access is configured separately, and yes you can change that from a livecd. I'll let more experienced people write the details, but this howto should be good to start from:

https://www.digitalocean.com/communi...e-sudoers-file

frankbell 10-27-2020 09:57 PM

I hate to be a killjoy and maybe I'm just a cynical old man (well, there's no maybe about it), but I must ask, why are wanting to obtain unauthorized access to this machine?

scasey 10-27-2020 10:01 PM

Quote:

Originally Posted by frankbell (Post 6179470)
I hate to be a killjoy and maybe I'm just a cynical old man (well, there's no maybe about it), but I must ask, why are wanting to obtain unauthorized access to this machine?

...agreed...and the subject is explicitly against the LQ rules.

DARKBOW923 10-28-2020 08:13 AM

Ok guys, just to clarify it..

1.- i'm a computer technician, if i get a client who can't login in linux, i need a wat to bypass the password.

2.-, i DON'T want to bypass the college computer password, i talked with the sys admin of my college and he tells me to read shadow and password files.

3.- i dont think there's no way to bypass linux passwords, in windows we have the SAM directory, kon-boot, etc, i'm secure there's a way to bypass or change the linux users password.


Regards.

sgosnell 10-28-2020 09:29 AM

You can change the user password as long as the drive isn't encrypted. If it's encrypted, there is nothing you can do, because without the password to decrypt the drive you can't access anything.

uteck 10-28-2020 09:33 AM

If you get a person that cannot login to Linux for some reason, like they forgot their password, then you can boot into recovery mode and reset their password. The recovery mode menu in Ubuntu has a few common things in the menu for fixing issues. Unless you are using some other authentication system.
Also, recent versions of kon-boot say they will work on Linux, so give it a try.

The admin you talked to is full of shite if they think reading /etc/password works anymore. This is not 1980, and passwords are not stored in plain text. A place I used to work at we had the hash for the default password that we could edit into /etc/password then tell users to use that to login then change their password. That is the closest you will get to being able to 'read' /etc/password, and that only worked because we used NIS.

You need to read up on booting grub into single user mode to get access to a system root prompt.

sevendogsbsd 10-28-2020 09:36 AM

There is no way to recover the user's password, only change it. If you can't get into the machine at all and do not have root access, boot the machine to single user mode and change root's password.

computersavvy 10-28-2020 10:24 AM

Quote:

Originally Posted by DARKBOW923 (Post 6179544)
Ok guys, just to clarify it..

1.- i'm a computer technician, if i get a client who can't login in linux, i need a wat to bypass the password.

2.-, i DON'T want to bypass the college computer password, i talked with the sys admin of my college and he tells me to read shadow and password files.

3.- i dont think there's no way to bypass linux passwords, in windows we have the SAM directory, kon-boot, etc, i'm secure there's a way to bypass or change the linux users password.


Regards.

As has been stated, if you can boot to a live DVD/USB and get root access then it is possible to change a users password. If you can get to the recovery/single user mode (automatically gives root access) then it is also possible to change the users password. Without sudo or root access the password cannot be changed.

See "man passwd" for information on that.

dugan 10-28-2020 04:04 PM

Quote:

Originally Posted by DARKBOW923 (Post 6179544)
i talked with the sys admin of my college and he tells me to read shadow and password files.

Honestly? I think you should go back to him(?) and ask him why he told you that.


All times are GMT -5. The time now is 05:50 AM.