LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-01-2008, 02:16 AM   #1
Unforgiven79
Member
 
Registered: May 2006
Location: Italy
Distribution: FC5, Suse 10
Posts: 70

Rep: Reputation: 15
Changing user groups makes data no longer accessible


One straight problem I faced:

I have re-installed my Linux system, keeping the partition mounted as /home directory unvaried. There I have my user account, obviously.
After re-installing, the new system correctly recognizes my user account and I can access my data as with the old one.

BUT: After I just change my user account groups (basically, I want it added to the "root" group) assignments, I cannot access my data any more... I get the message "You don't have privileges to access this folder". With root access, I have checked such files and I cannot understand: it is still my user account the owner and still it has Access/modify permissions... why does assigning it to MORE groups generate such problems? Thanx
 
Old 04-01-2008, 02:52 AM   #2
BugZRevengE
Member
 
Registered: Oct 2005
Location: Australia
Distribution: Slackware & Kubuntu & CentOS
Posts: 106

Rep: Reputation: 17
Did you add your user to a the root group, or change groups, ie remove old group and add new group.

When you moved your data, you may have had access using the old group, but not your user, because linux uses user number, not name for permissions, same with groups.

You should check the /etc/group folder for groups your user is a member of (grep $USER /etc/group). Also check your userid number (grep $USER /etc/passwd)... if this is different to your old system, you may have problems.
Next check the owner/group of the files (ls -l) the user and group should be displayed. If the user or group do not match what is in the above files, you will not have access.

To fix your problem, as root run:
chown -R USERNAME GROUPNAME /PATH/TO/DATA
Where USERNAME is your USERNAME and GROUPNAME is a group you are a member of and /PATH/TO/DATA is where your files are (the -R means recursive, and will change permissions on all sub folders - so do not do this for / or you will change permissions on all files, which could cause problems)

Hope this helps
 
Old 04-01-2008, 04:27 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Don't mess with the root group PLEASE. Not having root powers will protect you against mistakes by yourself or a coding error in a program.
 
Old 04-01-2008, 04:47 PM   #4
BugZRevengE
Member
 
Registered: Oct 2005
Location: Australia
Distribution: Slackware & Kubuntu & CentOS
Posts: 106

Rep: Reputation: 17
I too agree, you should not make your user a member of the root group - it is good to have the protection of not worrying.
I could imagine the original poster may be setting up another user that has root privileges that they use for some administrative tasks, this would be OK.

Anyway - it is kind of sideline to the original problem, and hopefully the poster has a result.
 
Old 04-02-2008, 01:26 AM   #5
Unforgiven79
Member
 
Registered: May 2006
Location: Italy
Distribution: FC5, Suse 10
Posts: 70

Original Poster
Rep: Reputation: 15
Thank you for your explanation: I just changed group as root user and no further problem has occured with my user account accessing its /home/... directory.

OK, so I think I am supposed not to add it to the root group any more...
 
Old 04-02-2008, 06:02 PM   #6
BugZRevengE
Member
 
Registered: Oct 2005
Location: Australia
Distribution: Slackware & Kubuntu & CentOS
Posts: 106

Rep: Reputation: 17
This will fix it, but this is because root can essentially do anything!

The problem with adding root group to your user as the solution, is you are root for daily operations. This will allow you to totally screw up your whole system if you make a mistake (e.g. running 'rm -r /' when you mean to type 'rm -r junk/' will delete all files on the whole machine - if your user did not have root permissions, you would get an error straight away - Access Denied).

The correct solution to get your files working is what I mentioned in my first reply, that is:
chown -R $USERNAME:$YOURGROUP /home/$USERNAME
as root.
Where $USERNAME and $YOURGROUP are the username and group you normally use.
after you have done this you can be safe to remove your user from the root group.

I would suggest your user on the new system has a different ID to your old, and this is causing the problem.
You can check this by typing ls -l at the command line, and if the files are owned by another user (the 3rd field), or if this field is a number (the old user ID owner) then this is the problem. Also make sure your user has rw permission (read, write) for files and rwx for directories (the x is execute, but for directories, lets you enter them).

Hope this helps - feel free to post output of the ls -l command if you want (You can change/obscure the filenames if you don't want to publish them).
 
  


Reply



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
What FS makes HD last longer? General Linux - Hardware 4 03-25-2007 05:51 PM
cd-rom no longer accessible darinbolson Linux - General 3 09-23-2006 08:39 PM
Questions: Changing User Groups, Keeping background through restart, and more. Left Face Down Slackware 8 07-13-2006 02:02 PM
resized windows partition no longer accessible jboy22k MEPIS 3 01-24-2006 12:34 AM
changing groups dirtybird04 Linux - Newbie 3 06-02-2005 07:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:08 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