unable to access hard disk partition other than the filesystem
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
unable to access hard disk partition other than the filesystem
Hello,
I am running Ubuntu 14.04 version on my laptop. When I had installed Ubuntu I misspelled user name as 'Snowbelll' instead of 'Snowbell'.
Recently I asked a friend of mine regarding how to change the user name. He made some changes in etc/passwd, etc/hosts file and some changes in /etc/shadow file.
Although the username was changed to 'Snowbell' properly, I am not able to access my other disk partitions containing music, e-books etc.
I am only able to access that partition which contains Ubuntu filesystem.
When I try to access other partitions, I am asked for the credentials. Even on entering the correct credentials, the message displays that the password is incorrect. It says that there is something wrong with the sudoer file.
Kindly help me with this problem. I can also provide you with the screenshot of the message that I get on keying in the credentials.
Do "grep snowbel /etc/passwd" to determine if he created a new user or if he changed the existing one (i.e. Do both accounts show up now?)
My guess is that he added a new user. If so that new user has its own numeric user ID (UID). The old user would have a separate UID. Any files that were on the old UID would be inaccessible to the new UID.
If you can determine both the old and the new UIDs you can change the files to the new UID if you can become root (or run sudo)
One command to do that would be to run as root (or prepended with "sudo"):
find -u <UID> |xargs chown <newUID>
This is the line that appears at the terminal prompt
Quote:
snowbell@snowbell-Aspire-4738Z:~$
This is the content in the etc/hosts file
Quote:
127.0.1.1 snowbell-Aspire-4738Z
This is the error message that appears when I try to login as su
Quote:
snowbell@snowbell-Aspire-4738Z:/etc$ sudo su
[sudo] password for snowbell:
snowbell is not in the sudoers file. This incident will be reported.
This is what happens when I try to open the sudoers file in etc directory
Quote:
snowbell@snowbell-Aspire-4738Z:/etc$ sudo cat sudoers
[sudo] password for snowbell:
snowbell is not in the sudoers file. This incident will be reported.
It is unusual to have an uppercase name in the /etc/passwd file in my experience. Not sure that is the problem as I don't use Ubuntu regularly but based on the messages you are getting it could be the problem. Boot a Live CD and mount your partition and try changing the /etc/passwd to a lower case 'snowbell' is the only thing I can think of. In Linux using a terminal, case sensitivity does matter.
snowbell@snowbell-Aspire-4738Z:/etc$ sudo su
[sudo] password for snowbell:
snowbell is not in the sudoers file. This incident will be reported.
OK the case of your user in /etc/passwd is all lowercase from what you sent. You should try "grep -i snowbell /etc/passwd" to find all cases - maybe your original Snowbelll user still exists.
The sudo message you got might be your issue - perhaps you'r'e still in sudoers as the original Snowbelll user. If that is still in /etc/passwd you may be able to login and run sudo that way.
If not and you don't know the root password you'd have to figure out how to get into root to modify things. I don't use Ubuntu so don't know how it is done on that distro. Failing everything else you could try booting from a live CD and mounting your root so that you can manually modify files.
By the way the proper way to change users is with the usermod command. Manually editing passwd and shadow is a good way to corrupt one or the other.
The name snowbell appears in the group file but then it is in small case. I wanted to change to Snowbell (notice the case: looks like these cases are creating confusion)
The red part is called gecos field That's what Ubuntu shows at the GUI login environment. That's the only part it should have been changed. Any other manual changes would have more manual intervention to fix, like creating a new user home directory or changing the uid and gid permissions to any files and directories previously owned.
In any case, the proper tool to do changes to user accounts would have been usermod with the appropriated flags.
Yep, sudo uses the sudoers file. It sounds to me that when the name was corrected in the password file it was left uncorrected in the sudoers file. So you can't sudo anything.
There could be a problem with fixing this - one of the downsides of misusing sudoers file and not having a separate root login. You need root privileges to change either passwd or sudoers files but can't obtain them because you can't use sudo.
You'll have to fallback on booting from a rescue disk, or a live distro, then mount your root partition and correct the spelling in sudoers.
In any case, the proper tool to do changes to user accounts would have been usermod with the appropriated flags.
Fo a simple misspelling of the user name there's nothing wrong with editing password file - I do it often. Just remember to edit sudoers as well. That wouldn't matter on my Arch system as I have a separate root login - although I am in the sudoers file as, unfortunatly, since ubuntu pioneered the misuse* of this there are some things that prefer to be executed with sudo.
*For those not old enough to remember, the purpose of sudo and the sudoers file was to enable some users to have limited access to specific administrative tasks without needing full root access.
For a simple misspelling of the user name there's nothing wrong with editing password file
I disagree. While I did this often in the past there is no reason to do it these days especially since direct edit of passwd does not automatically update shadow. Additionally direct edits CAN crap out your passwd file to the point that some or all users can no longer access the system. Use of usermod insures you at worst only affect access for the specific user you intended.
But it is true that usermod itself won't modify sudoers file. For that one should use visudo rather than direct edit as visudo will check for issues before overwriting the current sudoers when you save.
I disagree. While I did this often in the past there is no reason to do it these days especially since direct edit of passwd does not automatically update shadow. Additionally direct edits CAN crap out your passwd file to the point that some or all users can no longer access the system. Use of usermod insures you at worst only affect access for the specific user you intended.
But it is true that usermod itself won't modify sudoers file. For that one should use visudo rather than direct edit as visudo will check for issues before overwriting the current sudoers when you save.
Another benefit to using usermod to change the username is that it updates /etc/group, which is important when a user is in multiple groups.
On Ubuntu, the user created during install is added to the sudo group, and that gives the account sudo access. That initial account is also often added to other groups, as well.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.