On Ubuntu, user passwords are not stored in a feasibly recoverable format, but as hashes.
To be more specific, they are salted and hashed using SHA-512, and the result is stored in /etc/shadow
. On a running system, also only root may read this file, but of course if you mount the disk in a different system, it can be read by anyone.
Back to the hash, it's not really possible to reverse the hashing process and recover the original password from it. So against mathematical recovery, the passwords are safe.
However, one can "simply" brute-force it and try all possible passwords until one fits. Intelligent attackers would use dictionaries and try real words and common derivations of these first, as they have a higher probability to be used by humans. This will of course take some time, depending on computational power and length/complexity of the password. SHA512 is just a strong cryptographic hash though, but not a special password hash with extra large computation effort, like e.g. bcrypt or PBKDF2, so it's probably possible to find a rather short password within more or less reasonable time.
So no, you can not recover your password directly, but yes, if you spend enough time and computation power, you can just try until you find it.