LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 07-14-2015, 07:03 AM   #1
Upendra Pratap Singh
Member
 
Registered: May 2011
Location: India
Distribution: Ubuntu 14.04
Posts: 110
Blog Entries: 4

Rep: Reputation: 0
Exclamation 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.
 
Old 07-14-2015, 09:06 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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>
 
Old 07-15-2015, 02:41 AM   #3
Upendra Pratap Singh
Member
 
Registered: May 2011
Location: India
Distribution: Ubuntu 14.04
Posts: 110

Original Poster
Blog Entries: 4

Rep: Reputation: 0
Actually he renamed the user-name in the etc/passwd file as there was only a single entry in the passwd file.

Initially my user-name was Snowbelll(three l at the end) which I wanted to change to SnowBell(only two l at the end; the third was redundant).

Please also look at the case sensitivity of the username (Snowbell or snowbell etc). I am hereby sending you the results that I got from the terminal.

Also I am not able to log in as a root.

This is the line that appears in etc/passwd file

Quote:
snowbell:x:1000:1000:SnowBell:/home/snowbell:/bin/bash
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.
 
Old 07-15-2015, 08:33 AM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware, Ubuntu
Posts: 10,220

Rep: Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413Reputation: 2413
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.
 
Old 07-15-2015, 09:28 AM   #5
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by Upendra Pratap Singh View Post
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.
 
Old 07-15-2015, 09:21 PM   #6
sgrlscz
Member
 
Registered: Aug 2008
Posts: 123

Rep: Reputation: 84
Check /etc/group. If your friend didn't update the username in there, then the new name won't be in the sudo group, and won't have sudo access.

If that's the problem, you should be able to fix it from single-user mode or by booting with a live cd.
 
Old 07-15-2015, 11:59 PM   #7
Upendra Pratap Singh
Member
 
Registered: May 2011
Location: India
Distribution: Ubuntu 14.04
Posts: 110

Original Poster
Blog Entries: 4

Rep: Reputation: 0
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)

Quote:
snowbell:x:1000:
 
Old 07-16-2015, 12:45 AM   #8
Aia
Member
 
Registered: Jun 2006
Posts: 66

Rep: Reputation: 21
the login name should be lowercase, the primary guid should be lowercase.

Quote:
snowbell:x:1000:1000:SnowBell:/home/snowbell:/bin/bash
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.

Last edited by Aia; 07-16-2015 at 12:49 AM.
 
Old 07-17-2015, 06:24 PM   #9
normanlinux
Member
 
Registered: Apr 2013
Location: S.E. England
Distribution: Arch
Posts: 161

Rep: Reputation: Disabled
sudo uses sudoers file

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.
 
Old 07-17-2015, 06:30 PM   #10
normanlinux
Member
 
Registered: Apr 2013
Location: S.E. England
Distribution: Arch
Posts: 161

Rep: Reputation: Disabled
Quote:
Originally Posted by Aia View Post
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.
 
Old 07-20-2015, 08:39 AM   #11
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Quote:
Originally Posted by normanlinux View Post
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.
 
Old 07-20-2015, 12:54 PM   #12
normanlinux
Member
 
Registered: Apr 2013
Location: S.E. England
Distribution: Arch
Posts: 161

Rep: Reputation: Disabled
" For that one should use visudo rather than direct edit as visudo will check for issues before overwriting the current sudoers when you save."

And to edit password file there is vipw
 
Old 07-21-2015, 05:37 PM   #13
sgrlscz
Member
 
Registered: Aug 2008
Posts: 123

Rep: Reputation: 84
Quote:
Originally Posted by MensaWater View Post
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.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Can't access partition on hard disk with linux OS installed Higgsboson Linux - Newbie 13 01-07-2015 06:48 PM
Access hard disk with deleted Linux partition demonvsgod Linux - Newbie 2 07-04-2013 09:33 PM
[SOLVED] Not able to access a Hard Disk Partition in fedora 14 fabe856 Linux - Software 6 05-21-2012 07:23 AM
unable to access linux after installation on new hard disk. rajiv1 Linux - Newbie 1 02-18-2010 05:03 PM
Unable to access additional hard disk deranged58 Linux - Software 6 12-06-2005 01:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration